gosu 1.1.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/COPYING +1 -1
- 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 +33 -30
- data/include/Gosu/Audio.hpp +70 -85
- data/include/Gosu/Color.hpp +63 -107
- data/include/Gosu/Font.hpp +44 -50
- data/include/Gosu/Fwd.hpp +1 -1
- data/include/Gosu/Graphics.hpp +64 -75
- data/include/Gosu/GraphicsBase.hpp +32 -39
- data/include/Gosu/Image.hpp +56 -62
- data/include/Gosu/ImageData.hpp +23 -27
- data/include/Gosu/Inspection.hpp +1 -4
- data/include/Gosu/Math.hpp +4 -16
- data/include/Gosu/Platform.hpp +1 -51
- data/include/Gosu/Text.hpp +37 -40
- data/include/Gosu/TextInput.hpp +34 -40
- data/include/Gosu/Utility.hpp +10 -8
- data/include/Gosu/Version.hpp +1 -1
- data/include/Gosu/Window.hpp +73 -70
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/compat.rb +28 -37
- data/lib/gosu/swig_patches.rb +31 -3
- data/lib/gosu.rb +2 -2
- data/lib64/SDL2.dll +0 -0
- data/rdoc/gosu.rb +9 -1
- 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/Bitmap.cpp +13 -13
- data/src/BitmapIO.cpp +0 -20
- data/src/BlockAllocator.cpp +2 -1
- data/src/Channel.cpp +22 -20
- data/src/Color.cpp +62 -55
- data/src/EmptyImageData.hpp +16 -18
- data/src/FileUnix.cpp +1 -1
- data/src/FileWin.cpp +1 -1
- data/src/Font.cpp +52 -57
- data/src/GosuViewController.cpp +2 -0
- data/src/Graphics.cpp +135 -143
- data/src/Image.cpp +42 -42
- data/src/Input.cpp +1 -1
- data/src/InputUIKit.cpp +1 -1
- data/src/LargeImageData.cpp +120 -113
- data/src/LargeImageData.hpp +18 -16
- data/src/Log.hpp +6 -6
- data/src/Macro.cpp +124 -169
- data/src/Macro.hpp +11 -11
- data/src/Math.cpp +8 -1
- data/src/RenderState.hpp +5 -5
- data/src/Resolution.cpp +114 -61
- data/src/RubyGosu.cxx +470 -501
- data/src/RubyGosu.h +3 -2
- data/src/TexChunk.cpp +50 -41
- data/src/TexChunk.hpp +22 -22
- data/src/Text.cpp +58 -59
- data/src/TextBuilder.cpp +60 -57
- data/src/TextBuilder.hpp +20 -20
- data/src/TextInput.cpp +127 -135
- data/src/TrueTypeFont.cpp +108 -108
- data/src/TrueTypeFont.hpp +39 -38
- data/src/TrueTypeFontApple.cpp +27 -23
- data/src/TrueTypeFontUnix.cpp +21 -26
- data/src/TrueTypeFontWin.cpp +30 -30
- data/src/Utility.cpp +82 -23
- data/src/WinUtility.hpp +2 -1
- data/src/Window.cpp +103 -86
- data/src/WindowUIKit.cpp +48 -51
- metadata +8 -20
- 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
- data/src/UtilityApple.cpp +0 -16
- data/src/UtilityWin.cpp +0 -17
@@ -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
|
@@ -38,45 +38,121 @@ extern "C" {
|
|
38
38
|
#endif
|
39
39
|
|
40
40
|
/**
|
41
|
-
*
|
41
|
+
* Get the number of milliseconds since SDL library initialization.
|
42
42
|
*
|
43
|
-
*
|
43
|
+
* This value wraps if the program runs for more than ~49 days.
|
44
|
+
*
|
45
|
+
* This function is not recommended as of SDL 2.0.18; use SDL_GetTicks64()
|
46
|
+
* instead, where the value doesn't wrap every ~49 days. There are places in
|
47
|
+
* SDL where we provide a 32-bit timestamp that can not change without
|
48
|
+
* breaking binary compatibility, though, so this function isn't officially
|
49
|
+
* deprecated.
|
50
|
+
*
|
51
|
+
* \returns an unsigned 32-bit value representing the number of milliseconds
|
52
|
+
* since the SDL library initialized.
|
53
|
+
*
|
54
|
+
* \since This function is available since SDL 2.0.0.
|
55
|
+
*
|
56
|
+
* \sa SDL_TICKS_PASSED
|
44
57
|
*/
|
45
58
|
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
46
59
|
|
47
60
|
/**
|
48
|
-
*
|
61
|
+
* Get the number of milliseconds since SDL library initialization.
|
62
|
+
*
|
63
|
+
* Note that you should not use the SDL_TICKS_PASSED macro with values
|
64
|
+
* returned by this function, as that macro does clever math to compensate for
|
65
|
+
* the 32-bit overflow every ~49 days that SDL_GetTicks() suffers from. 64-bit
|
66
|
+
* values from this function can be safely compared directly.
|
49
67
|
*
|
50
|
-
*
|
51
|
-
*
|
52
|
-
*
|
53
|
-
*
|
54
|
-
*
|
68
|
+
* For example, if you want to wait 100 ms, you could do this:
|
69
|
+
*
|
70
|
+
* ```c
|
71
|
+
* const Uint64 timeout = SDL_GetTicks64() + 100;
|
72
|
+
* while (SDL_GetTicks64() < timeout) {
|
73
|
+
* // ... do work until timeout has elapsed
|
74
|
+
* }
|
75
|
+
* ```
|
76
|
+
*
|
77
|
+
* \returns an unsigned 64-bit value representing the number of milliseconds
|
78
|
+
* since the SDL library initialized.
|
79
|
+
*
|
80
|
+
* \since This function is available since SDL 2.0.18.
|
81
|
+
*/
|
82
|
+
extern DECLSPEC Uint64 SDLCALL SDL_GetTicks64(void);
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Compare 32-bit SDL ticks values, and return true if `A` has passed `B`.
|
86
|
+
*
|
87
|
+
* This should be used with results from SDL_GetTicks(), as this macro
|
88
|
+
* attempts to deal with the 32-bit counter wrapping back to zero every ~49
|
89
|
+
* days, but should _not_ be used with SDL_GetTicks64(), which does not have
|
90
|
+
* that problem.
|
91
|
+
*
|
92
|
+
* For example, with SDL_GetTicks(), if you want to wait 100 ms, you could
|
93
|
+
* do this:
|
94
|
+
*
|
95
|
+
* ```c
|
96
|
+
* const Uint32 timeout = SDL_GetTicks() + 100;
|
97
|
+
* while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
|
98
|
+
* // ... do work until timeout has elapsed
|
99
|
+
* }
|
100
|
+
* ```
|
101
|
+
*
|
102
|
+
* Note that this does not handle tick differences greater
|
103
|
+
* than 2^31 so take care when using the above kind of code
|
104
|
+
* with large timeout delays (tens of days).
|
55
105
|
*/
|
56
106
|
#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
|
57
107
|
|
58
108
|
/**
|
59
|
-
*
|
109
|
+
* Get the current value of the high resolution counter.
|
110
|
+
*
|
111
|
+
* This function is typically used for profiling.
|
112
|
+
*
|
113
|
+
* The counter values are only meaningful relative to each other. Differences
|
114
|
+
* between values can be converted to times by using
|
115
|
+
* SDL_GetPerformanceFrequency().
|
116
|
+
*
|
117
|
+
* \returns the current counter value.
|
118
|
+
*
|
119
|
+
* \since This function is available since SDL 2.0.0.
|
120
|
+
*
|
121
|
+
* \sa SDL_GetPerformanceFrequency
|
60
122
|
*/
|
61
123
|
extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);
|
62
124
|
|
63
125
|
/**
|
64
|
-
*
|
126
|
+
* Get the count per second of the high resolution counter.
|
127
|
+
*
|
128
|
+
* \returns a platform-specific count per second.
|
129
|
+
*
|
130
|
+
* \since This function is available since SDL 2.0.0.
|
131
|
+
*
|
132
|
+
* \sa SDL_GetPerformanceCounter
|
65
133
|
*/
|
66
134
|
extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
|
67
135
|
|
68
136
|
/**
|
69
|
-
*
|
137
|
+
* Wait a specified number of milliseconds before returning.
|
138
|
+
*
|
139
|
+
* This function waits a specified number of milliseconds before returning. It
|
140
|
+
* waits at least the specified time, but possibly longer due to OS
|
141
|
+
* scheduling.
|
142
|
+
*
|
143
|
+
* \param ms the number of milliseconds to delay
|
144
|
+
*
|
145
|
+
* \since This function is available since SDL 2.0.0.
|
70
146
|
*/
|
71
147
|
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
72
148
|
|
73
149
|
/**
|
74
|
-
*
|
150
|
+
* Function prototype for the timer callback function.
|
75
151
|
*
|
76
|
-
*
|
77
|
-
*
|
78
|
-
*
|
79
|
-
*
|
152
|
+
* The callback function is passed the current timer interval and returns
|
153
|
+
* the next timer interval. If the returned value is the same as the one
|
154
|
+
* passed in, the periodic alarm continues, otherwise a new alarm is
|
155
|
+
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
|
80
156
|
*/
|
81
157
|
typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
|
82
158
|
|
@@ -86,20 +162,51 @@ typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
|
|
86
162
|
typedef int SDL_TimerID;
|
87
163
|
|
88
164
|
/**
|
89
|
-
*
|
165
|
+
* Call a callback function at a future time.
|
90
166
|
*
|
91
|
-
*
|
167
|
+
* If you use this function, you must pass `SDL_INIT_TIMER` to SDL_Init().
|
168
|
+
*
|
169
|
+
* The callback function is passed the current timer interval and the user
|
170
|
+
* supplied parameter from the SDL_AddTimer() call and should return the next
|
171
|
+
* timer interval. If the value returned from the callback is 0, the timer is
|
172
|
+
* canceled.
|
173
|
+
*
|
174
|
+
* The callback is run on a separate thread.
|
175
|
+
*
|
176
|
+
* Timers take into account the amount of time it took to execute the
|
177
|
+
* callback. For example, if the callback took 250 ms to execute and returned
|
178
|
+
* 1000 (ms), the timer would only wait another 750 ms before its next
|
179
|
+
* iteration.
|
180
|
+
*
|
181
|
+
* Timing may be inexact due to OS scheduling. Be sure to note the current
|
182
|
+
* time with SDL_GetTicks() or SDL_GetPerformanceCounter() in case your
|
183
|
+
* callback needs to adjust for variances.
|
184
|
+
*
|
185
|
+
* \param interval the timer delay, in milliseconds, passed to `callback`
|
186
|
+
* \param callback the SDL_TimerCallback function to call when the specified
|
187
|
+
* `interval` elapses
|
188
|
+
* \param param a pointer that is passed to `callback`
|
189
|
+
* \returns a timer ID or 0 if an error occurs; call SDL_GetError() for more
|
190
|
+
* information.
|
191
|
+
*
|
192
|
+
* \since This function is available since SDL 2.0.0.
|
193
|
+
*
|
194
|
+
* \sa SDL_RemoveTimer
|
92
195
|
*/
|
93
196
|
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
|
94
197
|
SDL_TimerCallback callback,
|
95
198
|
void *param);
|
96
199
|
|
97
200
|
/**
|
98
|
-
*
|
201
|
+
* Remove a timer created with SDL_AddTimer().
|
202
|
+
*
|
203
|
+
* \param id the ID of the timer to remove
|
204
|
+
* \returns SDL_TRUE if the timer is removed or SDL_FALSE if the timer wasn't
|
205
|
+
* found.
|
99
206
|
*
|
100
|
-
* \
|
207
|
+
* \since This function is available since SDL 2.0.0.
|
101
208
|
*
|
102
|
-
* \
|
209
|
+
* \sa SDL_AddTimer
|
103
210
|
*/
|
104
211
|
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
|
105
212
|
|
@@ -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
|
@@ -64,30 +64,70 @@ typedef struct SDL_Finger
|
|
64
64
|
#define SDL_MOUSE_TOUCHID ((Sint64)-1)
|
65
65
|
|
66
66
|
|
67
|
-
/* Function prototypes */
|
68
|
-
|
69
67
|
/**
|
70
|
-
*
|
68
|
+
* Get the number of registered touch devices.
|
69
|
+
*
|
70
|
+
* On some platforms SDL first sees the touch device if it was actually used.
|
71
|
+
* Therefore SDL_GetNumTouchDevices() may return 0 although devices are
|
72
|
+
* available. After using all devices at least once the number will be
|
73
|
+
* correct.
|
74
|
+
*
|
75
|
+
* This was fixed for Android in SDL 2.0.1.
|
76
|
+
*
|
77
|
+
* \returns the number of registered touch devices.
|
78
|
+
*
|
79
|
+
* \since This function is available since SDL 2.0.0.
|
80
|
+
*
|
81
|
+
* \sa SDL_GetTouchDevice
|
71
82
|
*/
|
72
83
|
extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
|
73
84
|
|
74
85
|
/**
|
75
|
-
*
|
86
|
+
* Get the touch ID with the given index.
|
87
|
+
*
|
88
|
+
* \param index the touch device index
|
89
|
+
* \returns the touch ID with the given index on success or 0 if the index is
|
90
|
+
* invalid; call SDL_GetError() for more information.
|
91
|
+
*
|
92
|
+
* \since This function is available since SDL 2.0.0.
|
93
|
+
*
|
94
|
+
* \sa SDL_GetNumTouchDevices
|
76
95
|
*/
|
77
96
|
extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
|
78
97
|
|
79
98
|
/**
|
80
|
-
*
|
99
|
+
* Get the type of the given touch device.
|
100
|
+
*
|
101
|
+
* \since This function is available since SDL 2.0.10.
|
81
102
|
*/
|
82
103
|
extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
|
83
104
|
|
84
105
|
/**
|
85
|
-
*
|
106
|
+
* Get the number of active fingers for a given touch device.
|
107
|
+
*
|
108
|
+
* \param touchID the ID of a touch device
|
109
|
+
* \returns the number of active fingers for a given touch device on success
|
110
|
+
* or 0 on failure; call SDL_GetError() for more information.
|
111
|
+
*
|
112
|
+
* \since This function is available since SDL 2.0.0.
|
113
|
+
*
|
114
|
+
* \sa SDL_GetTouchFinger
|
86
115
|
*/
|
87
116
|
extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
|
88
117
|
|
89
118
|
/**
|
90
|
-
*
|
119
|
+
* Get the finger object for specified touch device ID and finger index.
|
120
|
+
*
|
121
|
+
* The returned resource is owned by SDL and should not be deallocated.
|
122
|
+
*
|
123
|
+
* \param touchID the ID of the requested touch device
|
124
|
+
* \param index the index of the requested finger
|
125
|
+
* \returns a pointer to the SDL_Finger object or NULL if no object at the
|
126
|
+
* given ID and index could be found.
|
127
|
+
*
|
128
|
+
* \since This function is available since SDL 2.0.0.
|
129
|
+
*
|
130
|
+
* \sa SDL_RecordGesture
|
91
131
|
*/
|
92
132
|
extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
|
93
133
|
|
@@ -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
|
@@ -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
|
@@ -37,16 +37,16 @@ extern "C" {
|
|
37
37
|
#endif
|
38
38
|
|
39
39
|
/**
|
40
|
-
*
|
40
|
+
* Information about the version of SDL in use.
|
41
41
|
*
|
42
|
-
*
|
43
|
-
*
|
44
|
-
*
|
45
|
-
*
|
46
|
-
*
|
42
|
+
* Represents the library's version as three levels: major revision
|
43
|
+
* (increments with massive changes, additions, and enhancements),
|
44
|
+
* minor revision (increments with backwards-compatible changes to the
|
45
|
+
* major revision), and patchlevel (increments with fixes to the minor
|
46
|
+
* revision).
|
47
47
|
*
|
48
|
-
*
|
49
|
-
*
|
48
|
+
* \sa SDL_VERSION
|
49
|
+
* \sa SDL_GetVersion
|
50
50
|
*/
|
51
51
|
typedef struct SDL_version
|
52
52
|
{
|
@@ -59,22 +59,22 @@ typedef struct SDL_version
|
|
59
59
|
*/
|
60
60
|
#define SDL_MAJOR_VERSION 2
|
61
61
|
#define SDL_MINOR_VERSION 0
|
62
|
-
#define SDL_PATCHLEVEL
|
62
|
+
#define SDL_PATCHLEVEL 20
|
63
63
|
|
64
64
|
/**
|
65
|
-
*
|
65
|
+
* Macro to determine SDL version program was compiled against.
|
66
66
|
*
|
67
|
-
*
|
68
|
-
*
|
69
|
-
*
|
70
|
-
*
|
71
|
-
*
|
72
|
-
*
|
67
|
+
* This macro fills in a SDL_version structure with the version of the
|
68
|
+
* library you compiled against. This is determined by what header the
|
69
|
+
* compiler uses. Note that if you dynamically linked the library, you might
|
70
|
+
* have a slightly newer or older version at runtime. That version can be
|
71
|
+
* determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
|
72
|
+
* is not a macro.
|
73
73
|
*
|
74
|
-
*
|
74
|
+
* \param x A pointer to a SDL_version struct to initialize.
|
75
75
|
*
|
76
|
-
*
|
77
|
-
*
|
76
|
+
* \sa SDL_version
|
77
|
+
* \sa SDL_GetVersion
|
78
78
|
*/
|
79
79
|
#define SDL_VERSION(x) \
|
80
80
|
{ \
|
@@ -107,48 +107,74 @@ typedef struct SDL_version
|
|
107
107
|
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
|
108
108
|
|
109
109
|
/**
|
110
|
-
*
|
110
|
+
* Get the version of SDL that is linked against your program.
|
111
111
|
*
|
112
|
-
*
|
113
|
-
*
|
114
|
-
*
|
115
|
-
*
|
112
|
+
* If you are linking to SDL dynamically, then it is possible that the current
|
113
|
+
* version will be different than the version you compiled against. This
|
114
|
+
* function returns the current version, while SDL_VERSION() is a macro that
|
115
|
+
* tells you what version you compiled with.
|
116
116
|
*
|
117
|
-
*
|
118
|
-
* SDL_version compiled;
|
119
|
-
* SDL_version linked;
|
117
|
+
* This function may be called safely at any time, even before SDL_Init().
|
120
118
|
*
|
121
|
-
*
|
122
|
-
* SDL_GetVersion(&linked);
|
123
|
-
* printf("We compiled against SDL version %d.%d.%d ...\n",
|
124
|
-
* compiled.major, compiled.minor, compiled.patch);
|
125
|
-
* printf("But we linked against SDL version %d.%d.%d.\n",
|
126
|
-
* linked.major, linked.minor, linked.patch);
|
127
|
-
* \endcode
|
119
|
+
* \param ver the SDL_version structure that contains the version information
|
128
120
|
*
|
129
|
-
*
|
121
|
+
* \since This function is available since SDL 2.0.0.
|
130
122
|
*
|
131
|
-
*
|
123
|
+
* \sa SDL_GetRevision
|
132
124
|
*/
|
133
125
|
extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
|
134
126
|
|
135
127
|
/**
|
136
|
-
*
|
128
|
+
* Get the code revision of SDL that is linked against your program.
|
137
129
|
*
|
138
|
-
*
|
139
|
-
*
|
140
|
-
*
|
130
|
+
* This value is the revision of the code you are linked with and may be
|
131
|
+
* different from the code you are compiling with, which is found in the
|
132
|
+
* constant SDL_REVISION.
|
133
|
+
*
|
134
|
+
* The revision is arbitrary string (a hash value) uniquely identifying the
|
135
|
+
* exact revision of the SDL library in use, and is only useful in comparing
|
136
|
+
* against other revisions. It is NOT an incrementing number.
|
137
|
+
*
|
138
|
+
* If SDL wasn't built from a git repository with the appropriate tools, this
|
139
|
+
* will return an empty string.
|
140
|
+
*
|
141
|
+
* Prior to SDL 2.0.16, before development moved to GitHub, this returned a
|
142
|
+
* hash for a Mercurial repository.
|
143
|
+
*
|
144
|
+
* You shouldn't use this function for anything but logging it for debugging
|
145
|
+
* purposes. The string is not intended to be reliable in any way.
|
146
|
+
*
|
147
|
+
* \returns an arbitrary string, uniquely identifying the exact revision of
|
148
|
+
* the SDL library in use.
|
149
|
+
*
|
150
|
+
* \since This function is available since SDL 2.0.0.
|
151
|
+
*
|
152
|
+
* \sa SDL_GetVersion
|
141
153
|
*/
|
142
154
|
extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
|
143
155
|
|
144
156
|
/**
|
145
|
-
*
|
157
|
+
* Obsolete function, do not use.
|
158
|
+
*
|
159
|
+
* When SDL was hosted in a Mercurial repository, and was built carefully,
|
160
|
+
* this would return the revision number that the build was created from. This
|
161
|
+
* number was not reliable for several reasons, but more importantly, SDL is
|
162
|
+
* now hosted in a git repository, which does not offer numbers at all, only
|
163
|
+
* hashes. This function only ever returns zero now. Don't use it.
|
164
|
+
*
|
165
|
+
* Before SDL 2.0.16, this might have returned an unreliable, but non-zero
|
166
|
+
* number.
|
167
|
+
*
|
168
|
+
* \deprecated Use SDL_GetRevision() instead; if SDL was carefully built, it
|
169
|
+
* will return a git hash.
|
170
|
+
*
|
171
|
+
* \returns zero, always, in modern SDL releases.
|
172
|
+
*
|
173
|
+
* \since This function is available since SDL 2.0.0.
|
146
174
|
*
|
147
|
-
*
|
148
|
-
* library in use. It is an incrementing number based on commits to
|
149
|
-
* hg.libsdl.org.
|
175
|
+
* \sa SDL_GetRevision
|
150
176
|
*/
|
151
|
-
extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
|
177
|
+
extern SDL_DEPRECATED DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
|
152
178
|
|
153
179
|
|
154
180
|
/* Ends C function definitions when using C++ */
|