gosu 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependencies/SDL/include/SDL.h +108 -14
- data/dependencies/SDL/include/SDL_assert.h +81 -50
- data/dependencies/SDL/include/SDL_atomic.h +135 -35
- data/dependencies/SDL/include/SDL_audio.h +960 -355
- data/dependencies/SDL/include/SDL_bits.h +11 -6
- data/dependencies/SDL/include/SDL_blendmode.h +91 -14
- data/dependencies/SDL/include/SDL_clipboard.h +30 -7
- data/dependencies/SDL/include/SDL_config.h +277 -27
- data/dependencies/SDL/include/SDL_config_android.h +13 -38
- data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
- data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
- data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
- data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
- data/dependencies/SDL/include/SDL_config_psp.h +16 -37
- data/dependencies/SDL/include/SDL_config_windows.h +28 -91
- data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
- data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
- data/dependencies/SDL/include/SDL_copying.h +1 -1
- data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
- data/dependencies/SDL/include/SDL_egl.h +906 -280
- data/dependencies/SDL/include/SDL_endian.h +101 -47
- data/dependencies/SDL/include/SDL_error.h +70 -19
- data/dependencies/SDL/include/SDL_events.h +387 -79
- data/dependencies/SDL/include/SDL_filesystem.h +73 -64
- data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
- data/dependencies/SDL/include/SDL_gesture.h +36 -6
- data/dependencies/SDL/include/SDL_haptic.h +304 -210
- data/dependencies/SDL/include/SDL_hidapi.h +451 -0
- data/dependencies/SDL/include/SDL_hints.h +1286 -897
- data/dependencies/SDL/include/SDL_joystick.h +577 -130
- data/dependencies/SDL/include/SDL_keyboard.h +162 -63
- data/dependencies/SDL/include/SDL_keycode.h +7 -5
- data/dependencies/SDL/include/SDL_loadso.h +42 -8
- data/dependencies/SDL/include/SDL_locale.h +34 -32
- data/dependencies/SDL/include/SDL_log.h +212 -19
- data/dependencies/SDL/include/SDL_main.h +72 -17
- data/dependencies/SDL/include/SDL_messagebox.h +70 -23
- data/dependencies/SDL/include/SDL_metal.h +27 -32
- data/dependencies/SDL/include/SDL_misc.h +19 -15
- data/dependencies/SDL/include/SDL_mouse.h +262 -110
- data/dependencies/SDL/include/SDL_mutex.h +286 -66
- data/dependencies/SDL/include/SDL_name.h +1 -1
- data/dependencies/SDL/include/SDL_opengl.h +1 -1
- data/dependencies/SDL/include/SDL_opengles.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2.h +2 -2
- data/dependencies/SDL/include/SDL_pixels.h +199 -34
- data/dependencies/SDL/include/SDL_platform.h +39 -2
- data/dependencies/SDL/include/SDL_power.h +23 -10
- data/dependencies/SDL/include/SDL_quit.h +1 -1
- data/dependencies/SDL/include/SDL_rect.h +78 -28
- data/dependencies/SDL/include/SDL_render.h +1204 -472
- data/dependencies/SDL/include/SDL_revision.h +2 -2
- data/dependencies/SDL/include/SDL_rwops.h +605 -33
- data/dependencies/SDL/include/SDL_scancode.h +1 -1
- data/dependencies/SDL/include/SDL_sensor.h +76 -42
- data/dependencies/SDL/include/SDL_shape.h +38 -27
- data/dependencies/SDL/include/SDL_stdinc.h +96 -24
- data/dependencies/SDL/include/SDL_surface.h +571 -139
- data/dependencies/SDL/include/SDL_system.h +339 -101
- data/dependencies/SDL/include/SDL_syswm.h +50 -20
- data/dependencies/SDL/include/SDL_test.h +1 -1
- data/dependencies/SDL/include/SDL_test_assert.h +2 -2
- data/dependencies/SDL/include/SDL_test_common.h +23 -6
- data/dependencies/SDL/include/SDL_test_compare.h +1 -1
- data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
- data/dependencies/SDL/include/SDL_test_font.h +3 -3
- data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
- data/dependencies/SDL/include/SDL_test_harness.h +6 -6
- data/dependencies/SDL/include/SDL_test_images.h +1 -1
- data/dependencies/SDL/include/SDL_test_log.h +1 -1
- data/dependencies/SDL/include/SDL_test_md5.h +1 -1
- data/dependencies/SDL/include/SDL_test_memory.h +1 -1
- data/dependencies/SDL/include/SDL_test_random.h +2 -2
- data/dependencies/SDL/include/SDL_thread.h +226 -128
- data/dependencies/SDL/include/SDL_timer.h +129 -22
- data/dependencies/SDL/include/SDL_touch.h +48 -8
- data/dependencies/SDL/include/SDL_types.h +1 -1
- data/dependencies/SDL/include/SDL_version.h +72 -46
- data/dependencies/SDL/include/SDL_video.h +1266 -460
- data/dependencies/SDL/include/SDL_vulkan.h +100 -161
- data/dependencies/SDL/include/begin_code.h +22 -1
- data/dependencies/SDL/include/close_code.h +1 -1
- data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
- data/dependencies/SDL_sound/SDL_sound.c +83 -7
- data/dependencies/SDL_sound/SDL_sound.h +4 -4
- data/dependencies/SDL_sound/SDL_sound_aiff.c +9 -12
- data/dependencies/SDL_sound/SDL_sound_au.c +7 -7
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +3 -3
- data/dependencies/SDL_sound/SDL_sound_flac.c +1 -1
- data/dependencies/SDL_sound/SDL_sound_internal.h +17 -10
- data/dependencies/SDL_sound/SDL_sound_modplug.c +25 -27
- data/dependencies/SDL_sound/SDL_sound_mp3.c +5 -17
- data/dependencies/SDL_sound/SDL_sound_raw.c +11 -11
- data/dependencies/SDL_sound/SDL_sound_shn.c +8 -7
- data/dependencies/SDL_sound/SDL_sound_voc.c +6 -4
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +6 -11
- data/dependencies/SDL_sound/SDL_sound_wav.c +35 -29
- data/dependencies/SDL_sound/dr_flac.h +618 -220
- data/dependencies/SDL_sound/dr_mp3.h +263 -94
- data/dependencies/SDL_sound/libmodplug/fastmix.c +58 -64
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
- data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
- data/dependencies/SDL_sound/libmodplug/load_amf.c +11 -7
- data/dependencies/SDL_sound/libmodplug/load_ams.c +65 -22
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
- data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
- data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +45 -49
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +80 -53
- data/dependencies/SDL_sound/libmodplug/load_med.c +20 -12
- data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +29 -17
- data/dependencies/SDL_sound/libmodplug/load_okt.c +12 -8
- data/dependencies/SDL_sound/libmodplug/load_psm.c +101 -78
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
- data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
- data/dependencies/SDL_sound/libmodplug/load_ult.c +2 -2
- data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
- data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
- data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
- data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +24 -18
- data/dependencies/SDL_sound/libmodplug/sndfile.c +55 -156
- data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
- data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
- data/dependencies/SDL_sound/stb_vorbis.h +508 -325
- data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
- data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
- data/dependencies/mojoAL/mojoal.c +4594 -0
- data/ext/gosu/extconf.rb +29 -30
- data/include/Gosu/Audio.hpp +70 -85
- data/include/Gosu/Color.hpp +19 -11
- data/include/Gosu/Font.hpp +40 -44
- data/include/Gosu/Graphics.hpp +58 -71
- data/include/Gosu/GraphicsBase.hpp +26 -33
- data/include/Gosu/Image.hpp +56 -62
- data/include/Gosu/ImageData.hpp +23 -27
- data/include/Gosu/Inspection.hpp +1 -4
- data/include/Gosu/TextInput.hpp +34 -40
- data/include/Gosu/Version.hpp +1 -1
- data/include/Gosu/Window.hpp +71 -70
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/compat.rb +24 -37
- data/lib/gosu.rb +2 -2
- data/lib64/SDL2.dll +0 -0
- data/src/Audio.cpp +86 -86
- data/src/AudioFile.hpp +6 -6
- data/src/AudioFileAudioToolbox.cpp +1 -1
- data/src/AudioFileSDLSound.cpp +1 -1
- data/src/AudioImpl.hpp +5 -5
- data/src/BitmapIO.cpp +0 -20
- data/src/BlockAllocator.cpp +2 -1
- data/src/Channel.cpp +22 -20
- data/src/Color.cpp +12 -9
- data/src/EmptyImageData.hpp +15 -17
- data/src/FileUnix.cpp +1 -1
- data/src/FileWin.cpp +1 -1
- data/src/Font.cpp +48 -53
- data/src/Graphics.cpp +135 -143
- data/src/Image.cpp +41 -42
- data/src/Input.cpp +1 -1
- data/src/InputUIKit.cpp +1 -1
- data/src/LargeImageData.cpp +108 -101
- data/src/LargeImageData.hpp +17 -15
- data/src/Log.hpp +6 -6
- data/src/Macro.cpp +35 -37
- data/src/Macro.hpp +11 -11
- data/src/Math.cpp +8 -1
- data/src/Resolution.cpp +12 -7
- data/src/RubyGosu.cxx +5 -5
- data/src/TexChunk.cpp +50 -41
- data/src/TexChunk.hpp +22 -22
- data/src/Text.cpp +37 -37
- data/src/TextBuilder.cpp +60 -57
- data/src/TextBuilder.hpp +20 -20
- data/src/TextInput.cpp +127 -135
- data/src/TrueTypeFont.cpp +107 -107
- data/src/TrueTypeFont.hpp +39 -38
- data/src/TrueTypeFontApple.cpp +19 -22
- data/src/TrueTypeFontUnix.cpp +21 -26
- data/src/TrueTypeFontWin.cpp +30 -30
- data/src/Window.cpp +95 -86
- data/src/WindowUIKit.cpp +46 -49
- metadata +7 -17
- data/dependencies/SDL/include/SDL_config_os2.h +0 -188
- data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
- data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
- data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
- data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
- data/dependencies/al_soft/AL/alext.h +0 -585
- data/dependencies/al_soft/AL/efx-creative.h +0 -3
- data/dependencies/al_soft/AL/efx-presets.h +0 -402
- data/dependencies/al_soft/AL/efx.h +0 -762
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/lib/OpenAL32.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98e9ee1c852cb1d1a27cfebd4f4e2e28eed5348feb2ec1e5a26970ab16ceadca
|
4
|
+
data.tar.gz: 2191e45a7decbf43a919dd1acd9517bd778572893475d9c6801c6f4109b04afa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8827283b9324763479b211360259fb85798d9a33e91cd14aace844ad50ac78bb7668255d32bc82c8873229ec16f12c32be44ecbc8facb998cf6756ca47c3b212
|
7
|
+
data.tar.gz: 6544155d5b65c73e653ac7172dfe9ab89f6ca079a4fc1daea3bc14d4db23c0b77b15c638049d6f9ee3b69699c546450ae6a40f1f7d88a81d095c67482a59ded4
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -42,6 +42,7 @@
|
|
42
42
|
#include "SDL_filesystem.h"
|
43
43
|
#include "SDL_gamecontroller.h"
|
44
44
|
#include "SDL_haptic.h"
|
45
|
+
#include "SDL_hidapi.h"
|
45
46
|
#include "SDL_hints.h"
|
46
47
|
#include "SDL_joystick.h"
|
47
48
|
#include "SDL_loadso.h"
|
@@ -93,37 +94,130 @@ extern "C" {
|
|
93
94
|
/* @} */
|
94
95
|
|
95
96
|
/**
|
96
|
-
*
|
97
|
+
* Initialize the SDL library.
|
98
|
+
*
|
99
|
+
* SDL_Init() simply forwards to calling SDL_InitSubSystem(). Therefore, the
|
100
|
+
* two may be used interchangeably. Though for readability of your code
|
101
|
+
* SDL_InitSubSystem() might be preferred.
|
102
|
+
*
|
103
|
+
* The file I/O (for example: SDL_RWFromFile) and threading (SDL_CreateThread)
|
104
|
+
* subsystems are initialized by default. Message boxes
|
105
|
+
* (SDL_ShowSimpleMessageBox) also attempt to work without initializing the
|
106
|
+
* video subsystem, in hopes of being useful in showing an error dialog when
|
107
|
+
* SDL_Init fails. You must specifically initialize other subsystems if you
|
108
|
+
* use them in your application.
|
109
|
+
*
|
110
|
+
* Logging (such as SDL_Log) works without initialization, too.
|
111
|
+
*
|
112
|
+
* `flags` may be any of the following OR'd together:
|
113
|
+
*
|
114
|
+
* - `SDL_INIT_TIMER`: timer subsystem
|
115
|
+
* - `SDL_INIT_AUDIO`: audio subsystem
|
116
|
+
* - `SDL_INIT_VIDEO`: video subsystem; automatically initializes the events
|
117
|
+
* subsystem
|
118
|
+
* - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the
|
119
|
+
* events subsystem
|
120
|
+
* - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem
|
121
|
+
* - `SDL_INIT_GAMECONTROLLER`: controller subsystem; automatically
|
122
|
+
* initializes the joystick subsystem
|
123
|
+
* - `SDL_INIT_EVENTS`: events subsystem
|
124
|
+
* - `SDL_INIT_EVERYTHING`: all of the above subsystems
|
125
|
+
* - `SDL_INIT_NOPARACHUTE`: compatibility; this flag is ignored
|
126
|
+
*
|
127
|
+
* Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem()
|
128
|
+
* for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or
|
129
|
+
* call SDL_Quit() to force shutdown). If a subsystem is already loaded then
|
130
|
+
* this call will increase the ref-count and return.
|
131
|
+
*
|
132
|
+
* \param flags subsystem initialization flags
|
133
|
+
* \returns 0 on success or a negative error code on failure; call
|
134
|
+
* SDL_GetError() for more information.
|
135
|
+
*
|
136
|
+
* \since This function is available since SDL 2.0.0.
|
137
|
+
*
|
138
|
+
* \sa SDL_InitSubSystem
|
139
|
+
* \sa SDL_Quit
|
140
|
+
* \sa SDL_SetMainReady
|
141
|
+
* \sa SDL_WasInit
|
97
142
|
*/
|
98
143
|
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
|
99
144
|
|
100
145
|
/**
|
101
|
-
*
|
146
|
+
* Compatibility function to initialize the SDL library.
|
147
|
+
*
|
148
|
+
* In SDL2, this function and SDL_Init() are interchangeable.
|
102
149
|
*
|
103
|
-
*
|
104
|
-
*
|
105
|
-
*
|
106
|
-
*
|
107
|
-
*
|
150
|
+
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
151
|
+
* \returns 0 on success or a negative error code on failure; call
|
152
|
+
* SDL_GetError() for more information.
|
153
|
+
*
|
154
|
+
* \since This function is available since SDL 2.0.0.
|
155
|
+
*
|
156
|
+
* \sa SDL_Init
|
157
|
+
* \sa SDL_Quit
|
158
|
+
* \sa SDL_QuitSubSystem
|
108
159
|
*/
|
109
160
|
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
|
110
161
|
|
111
162
|
/**
|
112
|
-
*
|
163
|
+
* Shut down specific SDL subsystems.
|
164
|
+
*
|
165
|
+
* If you start a subsystem using a call to that subsystem's init function
|
166
|
+
* (for example SDL_VideoInit()) instead of SDL_Init() or SDL_InitSubSystem(),
|
167
|
+
* SDL_QuitSubSystem() and SDL_WasInit() will not work. You will need to use
|
168
|
+
* that subsystem's quit function (SDL_VideoQuit()) directly instead. But
|
169
|
+
* generally, you should not be using those functions directly anyhow; use
|
170
|
+
* SDL_Init() instead.
|
171
|
+
*
|
172
|
+
* You still need to call SDL_Quit() even if you close all open subsystems
|
173
|
+
* with SDL_QuitSubSystem().
|
174
|
+
*
|
175
|
+
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
176
|
+
*
|
177
|
+
* \since This function is available since SDL 2.0.0.
|
178
|
+
*
|
179
|
+
* \sa SDL_InitSubSystem
|
180
|
+
* \sa SDL_Quit
|
113
181
|
*/
|
114
182
|
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
115
183
|
|
116
184
|
/**
|
117
|
-
*
|
118
|
-
*
|
185
|
+
* Get a mask of the specified subsystems which are currently initialized.
|
186
|
+
*
|
187
|
+
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
188
|
+
* \returns a mask of all initialized subsystems if `flags` is 0, otherwise it
|
189
|
+
* returns the initialization status of the specified subsystems.
|
190
|
+
*
|
191
|
+
* The return value does not include SDL_INIT_NOPARACHUTE.
|
119
192
|
*
|
120
|
-
*
|
193
|
+
* \since This function is available since SDL 2.0.0.
|
194
|
+
*
|
195
|
+
* \sa SDL_Init
|
196
|
+
* \sa SDL_InitSubSystem
|
121
197
|
*/
|
122
198
|
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
123
199
|
|
124
200
|
/**
|
125
|
-
*
|
126
|
-
*
|
201
|
+
* Clean up all initialized subsystems.
|
202
|
+
*
|
203
|
+
* You should call this function even if you have already shutdown each
|
204
|
+
* initialized subsystem with SDL_QuitSubSystem(). It is safe to call this
|
205
|
+
* function even in the case of errors in initialization.
|
206
|
+
*
|
207
|
+
* If you start a subsystem using a call to that subsystem's init function
|
208
|
+
* (for example SDL_VideoInit()) instead of SDL_Init() or SDL_InitSubSystem(),
|
209
|
+
* then you must use that subsystem's quit function (SDL_VideoQuit()) to shut
|
210
|
+
* it down before calling SDL_Quit(). But generally, you should not be using
|
211
|
+
* those functions directly anyhow; use SDL_Init() instead.
|
212
|
+
*
|
213
|
+
* You can use this function with atexit() to ensure that it is run when your
|
214
|
+
* application is shutdown, but it is not wise to do this from a library or
|
215
|
+
* other dynamically loaded code.
|
216
|
+
*
|
217
|
+
* \since This function is available since SDL 2.0.0.
|
218
|
+
*
|
219
|
+
* \sa SDL_Init
|
220
|
+
* \sa SDL_QuitSubSystem
|
127
221
|
*/
|
128
222
|
extern DECLSPEC void SDLCALL SDL_Quit(void);
|
129
223
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -53,8 +53,10 @@ assert can have unique static variables associated with it.
|
|
53
53
|
#define SDL_TriggerBreakpoint() __debugbreak()
|
54
54
|
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
|
55
55
|
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
|
56
|
-
#elif ( defined(__APPLE__) && defined(__arm64__) ) /* this might work on other ARM targets, but this is a known quantity... */
|
56
|
+
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
|
57
57
|
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
|
58
|
+
#elif defined(__APPLE__) && defined(__arm__)
|
59
|
+
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
|
58
60
|
#elif defined(__386__) && defined(__WATCOMC__)
|
59
61
|
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
|
60
62
|
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
|
@@ -187,92 +189,121 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
|
|
187
189
|
#define SDL_assert_always(condition) SDL_enabled_assert(condition)
|
188
190
|
|
189
191
|
|
192
|
+
/**
|
193
|
+
* A callback that fires when an SDL assertion fails.
|
194
|
+
*
|
195
|
+
* \param data a pointer to the SDL_AssertData structure corresponding to the
|
196
|
+
* current assertion
|
197
|
+
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler()
|
198
|
+
* \returns an SDL_AssertState value indicating how to handle the failure.
|
199
|
+
*/
|
190
200
|
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
|
191
201
|
const SDL_AssertData* data, void* userdata);
|
192
202
|
|
193
203
|
/**
|
194
|
-
*
|
204
|
+
* Set an application-defined assertion handler.
|
195
205
|
*
|
196
|
-
*
|
197
|
-
*
|
198
|
-
*
|
199
|
-
*
|
206
|
+
* This function allows an application to show its own assertion UI and/or
|
207
|
+
* force the response to an assertion failure. If the application doesn't
|
208
|
+
* provide this, SDL will try to do the right thing, popping up a
|
209
|
+
* system-specific GUI dialog, and probably minimizing any fullscreen windows.
|
200
210
|
*
|
201
|
-
*
|
202
|
-
*
|
211
|
+
* This callback may fire from any thread, but it runs wrapped in a mutex, so
|
212
|
+
* it will only fire from one thread at a time.
|
203
213
|
*
|
204
|
-
*
|
214
|
+
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
|
205
215
|
*
|
206
|
-
*
|
216
|
+
* \param handler the SDL_AssertionHandler function to call when an assertion
|
217
|
+
* fails or NULL for the default handler
|
218
|
+
* \param userdata a pointer that is passed to `handler`
|
207
219
|
*
|
208
|
-
*
|
220
|
+
* \since This function is available since SDL 2.0.0.
|
209
221
|
*
|
210
|
-
*
|
211
|
-
* \param userdata A pointer passed to the callback as-is.
|
222
|
+
* \sa SDL_GetAssertionHandler
|
212
223
|
*/
|
213
224
|
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
|
214
225
|
SDL_AssertionHandler handler,
|
215
226
|
void *userdata);
|
216
227
|
|
217
228
|
/**
|
218
|
-
*
|
229
|
+
* Get the default assertion handler.
|
219
230
|
*
|
220
|
-
*
|
221
|
-
*
|
222
|
-
*
|
223
|
-
*
|
231
|
+
* This returns the function pointer that is called by default when an
|
232
|
+
* assertion is triggered. This is an internal function provided by SDL, that
|
233
|
+
* is used for assertions when SDL_SetAssertionHandler() hasn't been used to
|
234
|
+
* provide a different function.
|
224
235
|
*
|
225
|
-
*
|
236
|
+
* \returns the default SDL_AssertionHandler that is called when an assert
|
237
|
+
* triggers.
|
238
|
+
*
|
239
|
+
* \since This function is available since SDL 2.0.2.
|
240
|
+
*
|
241
|
+
* \sa SDL_GetAssertionHandler
|
226
242
|
*/
|
227
243
|
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
|
228
244
|
|
229
245
|
/**
|
230
|
-
*
|
246
|
+
* Get the current assertion handler.
|
247
|
+
*
|
248
|
+
* This returns the function pointer that is called when an assertion is
|
249
|
+
* triggered. This is either the value last passed to
|
250
|
+
* SDL_SetAssertionHandler(), or if no application-specified function is set,
|
251
|
+
* is equivalent to calling SDL_GetDefaultAssertionHandler().
|
231
252
|
*
|
232
|
-
*
|
233
|
-
*
|
234
|
-
*
|
235
|
-
*
|
253
|
+
* The parameter `puserdata` is a pointer to a void*, which will store the
|
254
|
+
* "userdata" pointer that was passed to SDL_SetAssertionHandler(). This value
|
255
|
+
* will always be NULL for the default handler. If you don't care about this
|
256
|
+
* data, it is safe to pass a NULL pointer to this function to ignore it.
|
236
257
|
*
|
237
|
-
*
|
238
|
-
*
|
239
|
-
*
|
240
|
-
*
|
241
|
-
*
|
242
|
-
*
|
258
|
+
* \param puserdata pointer which is filled with the "userdata" pointer that
|
259
|
+
* was passed to SDL_SetAssertionHandler()
|
260
|
+
* \returns the SDL_AssertionHandler that is called when an assert triggers.
|
261
|
+
*
|
262
|
+
* \since This function is available since SDL 2.0.2.
|
263
|
+
*
|
264
|
+
* \sa SDL_SetAssertionHandler
|
243
265
|
*/
|
244
266
|
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
|
245
267
|
|
246
268
|
/**
|
247
|
-
*
|
269
|
+
* Get a list of all assertion failures.
|
270
|
+
*
|
271
|
+
* This function gets all assertions triggered since the last call to
|
272
|
+
* SDL_ResetAssertionReport(), or the start of the program.
|
248
273
|
*
|
249
|
-
*
|
250
|
-
* or the start of the program.
|
274
|
+
* The proper way to examine this data looks something like this:
|
251
275
|
*
|
252
|
-
*
|
276
|
+
* ```c
|
277
|
+
* const SDL_AssertData *item = SDL_GetAssertionReport();
|
278
|
+
* while (item) {
|
279
|
+
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
|
280
|
+
* item->condition, item->function, item->filename,
|
281
|
+
* item->linenum, item->trigger_count,
|
282
|
+
* item->always_ignore ? "yes" : "no");
|
283
|
+
* item = item->next;
|
284
|
+
* }
|
285
|
+
* ```
|
253
286
|
*
|
254
|
-
*
|
255
|
-
*
|
256
|
-
* while (item) {
|
257
|
-
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
|
258
|
-
* item->condition, item->function, item->filename,
|
259
|
-
* item->linenum, item->trigger_count,
|
260
|
-
* item->always_ignore ? "yes" : "no");
|
261
|
-
* item = item->next;
|
262
|
-
* }
|
263
|
-
* </code>
|
287
|
+
* \returns a list of all failed assertions or NULL if the list is empty. This
|
288
|
+
* memory should not be modified or freed by the application.
|
264
289
|
*
|
265
|
-
*
|
266
|
-
*
|
290
|
+
* \since This function is available since SDL 2.0.0.
|
291
|
+
*
|
292
|
+
* \sa SDL_ResetAssertionReport
|
267
293
|
*/
|
268
294
|
extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
|
269
295
|
|
270
296
|
/**
|
271
|
-
*
|
297
|
+
* Clear the list of all assertion failures.
|
298
|
+
*
|
299
|
+
* This function will clear the list of all assertions triggered up to that
|
300
|
+
* point. Immediately following this call, SDL_GetAssertionReport will return
|
301
|
+
* no items. In addition, any previously-triggered assertions will be reset to
|
302
|
+
* a trigger_count of zero, and their always_ignore state will be false.
|
272
303
|
*
|
273
|
-
*
|
304
|
+
* \since This function is available since SDL 2.0.0.
|
274
305
|
*
|
275
|
-
*
|
306
|
+
* \sa SDL_GetAssertionReport
|
276
307
|
*/
|
277
308
|
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
|
278
309
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -89,25 +89,51 @@ extern "C" {
|
|
89
89
|
typedef int SDL_SpinLock;
|
90
90
|
|
91
91
|
/**
|
92
|
-
*
|
92
|
+
* Try to lock a spin lock by setting it to a non-zero value.
|
93
93
|
*
|
94
|
-
*
|
94
|
+
* ***Please note that spinlocks are dangerous if you don't know what you're
|
95
|
+
* doing. Please be careful using any sort of spinlock!***
|
95
96
|
*
|
96
|
-
* \
|
97
|
+
* \param lock a pointer to a lock variable
|
98
|
+
* \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already
|
99
|
+
* held.
|
100
|
+
*
|
101
|
+
* \since This function is available since SDL 2.0.0.
|
102
|
+
*
|
103
|
+
* \sa SDL_AtomicLock
|
104
|
+
* \sa SDL_AtomicUnlock
|
97
105
|
*/
|
98
106
|
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
|
99
107
|
|
100
108
|
/**
|
101
|
-
*
|
109
|
+
* Lock a spin lock by setting it to a non-zero value.
|
110
|
+
*
|
111
|
+
* ***Please note that spinlocks are dangerous if you don't know what you're
|
112
|
+
* doing. Please be careful using any sort of spinlock!***
|
113
|
+
*
|
114
|
+
* \param lock a pointer to a lock variable
|
115
|
+
*
|
116
|
+
* \since This function is available since SDL 2.0.0.
|
102
117
|
*
|
103
|
-
* \
|
118
|
+
* \sa SDL_AtomicTryLock
|
119
|
+
* \sa SDL_AtomicUnlock
|
104
120
|
*/
|
105
121
|
extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
|
106
122
|
|
107
123
|
/**
|
108
|
-
*
|
124
|
+
* Unlock a spin lock by setting it to 0.
|
125
|
+
*
|
126
|
+
* Always returns immediately.
|
127
|
+
*
|
128
|
+
* ***Please note that spinlocks are dangerous if you don't know what you're
|
129
|
+
* doing. Please be careful using any sort of spinlock!***
|
130
|
+
*
|
131
|
+
* \param lock a pointer to a lock variable
|
132
|
+
*
|
133
|
+
* \since This function is available since SDL 2.0.0.
|
109
134
|
*
|
110
|
-
* \
|
135
|
+
* \sa SDL_AtomicLock
|
136
|
+
* \sa SDL_AtomicTryLock
|
111
137
|
*/
|
112
138
|
extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
|
113
139
|
|
@@ -126,7 +152,7 @@ void _ReadWriteBarrier(void);
|
|
126
152
|
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
|
127
153
|
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
|
128
154
|
#elif defined(__WATCOMC__)
|
129
|
-
extern
|
155
|
+
extern __inline void SDL_CompilerBarrier(void);
|
130
156
|
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
|
131
157
|
#else
|
132
158
|
#define SDL_CompilerBarrier() \
|
@@ -137,20 +163,22 @@ extern _inline void SDL_CompilerBarrier (void);
|
|
137
163
|
* Memory barriers are designed to prevent reads and writes from being
|
138
164
|
* reordered by the compiler and being seen out of order on multi-core CPUs.
|
139
165
|
*
|
140
|
-
* A typical pattern would be for thread A to write some data and a flag,
|
141
|
-
*
|
142
|
-
*
|
166
|
+
* A typical pattern would be for thread A to write some data and a flag, and
|
167
|
+
* for thread B to read the flag and get the data. In this case you would
|
168
|
+
* insert a release barrier between writing the data and the flag,
|
143
169
|
* guaranteeing that the data write completes no later than the flag is
|
144
|
-
* written, and you would insert an acquire barrier between reading the
|
145
|
-
*
|
146
|
-
*
|
170
|
+
* written, and you would insert an acquire barrier between reading the flag
|
171
|
+
* and reading the data, to ensure that all the reads associated with the flag
|
172
|
+
* have completed.
|
147
173
|
*
|
148
|
-
* In this pattern you should always see a release barrier paired with
|
149
|
-
*
|
150
|
-
*
|
174
|
+
* In this pattern you should always see a release barrier paired with an
|
175
|
+
* acquire barrier and you should gate the data reads/writes with a single
|
176
|
+
* flag variable.
|
151
177
|
*
|
152
178
|
* For more information on these semantics, take a look at the blog post:
|
153
179
|
* http://preshing.com/20120913/acquire-and-release-semantics
|
180
|
+
*
|
181
|
+
* \since This function is available since SDL 2.0.6.
|
154
182
|
*/
|
155
183
|
extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
|
156
184
|
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
|
@@ -216,32 +244,73 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
|
|
216
244
|
typedef struct { int value; } SDL_atomic_t;
|
217
245
|
|
218
246
|
/**
|
219
|
-
*
|
247
|
+
* Set an atomic variable to a new value if it is currently an old value.
|
220
248
|
*
|
221
|
-
*
|
249
|
+
* ***Note: If you don't know what this function is for, you shouldn't use
|
250
|
+
* it!***
|
222
251
|
*
|
223
|
-
* \
|
224
|
-
|
252
|
+
* \param a a pointer to an SDL_atomic_t variable to be modified
|
253
|
+
* \param oldval the old value
|
254
|
+
* \param newval the new value
|
255
|
+
* \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
|
256
|
+
*
|
257
|
+
* \since This function is available since SDL 2.0.0.
|
258
|
+
*
|
259
|
+
* \sa SDL_AtomicCASPtr
|
260
|
+
* \sa SDL_AtomicGet
|
261
|
+
* \sa SDL_AtomicSet
|
262
|
+
*/
|
225
263
|
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
|
226
264
|
|
227
265
|
/**
|
228
|
-
*
|
266
|
+
* Set an atomic variable to a value.
|
267
|
+
*
|
268
|
+
* This function also acts as a full memory barrier.
|
269
|
+
*
|
270
|
+
* ***Note: If you don't know what this function is for, you shouldn't use
|
271
|
+
* it!***
|
272
|
+
*
|
273
|
+
* \param a a pointer to an SDL_atomic_t variable to be modified
|
274
|
+
* \param v the desired value
|
275
|
+
* \returns the previous value of the atomic variable.
|
276
|
+
*
|
277
|
+
* \since This function is available since SDL 2.0.2.
|
229
278
|
*
|
230
|
-
* \
|
279
|
+
* \sa SDL_AtomicGet
|
231
280
|
*/
|
232
281
|
extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
|
233
282
|
|
234
283
|
/**
|
235
|
-
*
|
284
|
+
* Get the value of an atomic variable.
|
285
|
+
*
|
286
|
+
* ***Note: If you don't know what this function is for, you shouldn't use
|
287
|
+
* it!***
|
288
|
+
*
|
289
|
+
* \param a a pointer to an SDL_atomic_t variable
|
290
|
+
* \returns the current value of an atomic variable.
|
291
|
+
*
|
292
|
+
* \since This function is available since SDL 2.0.2.
|
293
|
+
*
|
294
|
+
* \sa SDL_AtomicSet
|
236
295
|
*/
|
237
296
|
extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
|
238
297
|
|
239
298
|
/**
|
240
|
-
*
|
299
|
+
* Add to an atomic variable.
|
300
|
+
*
|
301
|
+
* This function also acts as a full memory barrier.
|
241
302
|
*
|
242
|
-
*
|
303
|
+
* ***Note: If you don't know what this function is for, you shouldn't use
|
304
|
+
* it!***
|
243
305
|
*
|
244
|
-
* \
|
306
|
+
* \param a a pointer to an SDL_atomic_t variable to be modified
|
307
|
+
* \param v the desired value to add
|
308
|
+
* \returns the previous value of the atomic variable.
|
309
|
+
*
|
310
|
+
* \since This function is available since SDL 2.0.2.
|
311
|
+
*
|
312
|
+
* \sa SDL_AtomicDecRef
|
313
|
+
* \sa SDL_AtomicIncRef
|
245
314
|
*/
|
246
315
|
extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
|
247
316
|
|
@@ -263,23 +332,54 @@ extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
|
|
263
332
|
#endif
|
264
333
|
|
265
334
|
/**
|
266
|
-
*
|
335
|
+
* Set a pointer to a new value if it is currently an old value.
|
267
336
|
*
|
268
|
-
*
|
337
|
+
* ***Note: If you don't know what this function is for, you shouldn't use
|
338
|
+
* it!***
|
269
339
|
*
|
270
|
-
* \
|
271
|
-
|
340
|
+
* \param a a pointer to a pointer
|
341
|
+
* \param oldval the old pointer value
|
342
|
+
* \param newval the new pointer value
|
343
|
+
* \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
|
344
|
+
*
|
345
|
+
* \since This function is available since SDL 2.0.0.
|
346
|
+
*
|
347
|
+
* \sa SDL_AtomicCAS
|
348
|
+
* \sa SDL_AtomicGetPtr
|
349
|
+
* \sa SDL_AtomicSetPtr
|
350
|
+
*/
|
272
351
|
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval);
|
273
352
|
|
274
353
|
/**
|
275
|
-
*
|
354
|
+
* Set a pointer to a value atomically.
|
355
|
+
*
|
356
|
+
* ***Note: If you don't know what this function is for, you shouldn't use
|
357
|
+
* it!***
|
358
|
+
*
|
359
|
+
* \param a a pointer to a pointer
|
360
|
+
* \param v the desired pointer value
|
361
|
+
* \returns the previous value of the pointer.
|
362
|
+
*
|
363
|
+
* \since This function is available since SDL 2.0.2.
|
276
364
|
*
|
277
|
-
* \
|
365
|
+
* \sa SDL_AtomicCASPtr
|
366
|
+
* \sa SDL_AtomicGetPtr
|
278
367
|
*/
|
279
368
|
extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
|
280
369
|
|
281
370
|
/**
|
282
|
-
*
|
371
|
+
* Get the value of a pointer atomically.
|
372
|
+
*
|
373
|
+
* ***Note: If you don't know what this function is for, you shouldn't use
|
374
|
+
* it!***
|
375
|
+
*
|
376
|
+
* \param a a pointer to a pointer
|
377
|
+
* \returns the current value of a pointer.
|
378
|
+
*
|
379
|
+
* \since This function is available since SDL 2.0.2.
|
380
|
+
*
|
381
|
+
* \sa SDL_AtomicCASPtr
|
382
|
+
* \sa SDL_AtomicSetPtr
|
283
383
|
*/
|
284
384
|
extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
|
285
385
|
|