gosu 1.1.1.1 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +108 -14
  3. data/dependencies/SDL/include/SDL_assert.h +81 -50
  4. data/dependencies/SDL/include/SDL_atomic.h +135 -35
  5. data/dependencies/SDL/include/SDL_audio.h +960 -355
  6. data/dependencies/SDL/include/SDL_bits.h +11 -6
  7. data/dependencies/SDL/include/SDL_blendmode.h +91 -14
  8. data/dependencies/SDL/include/SDL_clipboard.h +30 -7
  9. data/dependencies/SDL/include/SDL_config.h +277 -27
  10. data/dependencies/SDL/include/SDL_config_android.h +13 -38
  11. data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
  12. data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
  13. data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
  14. data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
  15. data/dependencies/SDL/include/SDL_config_psp.h +16 -37
  16. data/dependencies/SDL/include/SDL_config_windows.h +28 -91
  17. data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
  18. data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
  19. data/dependencies/SDL/include/SDL_copying.h +1 -1
  20. data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
  21. data/dependencies/SDL/include/SDL_egl.h +906 -280
  22. data/dependencies/SDL/include/SDL_endian.h +101 -47
  23. data/dependencies/SDL/include/SDL_error.h +70 -19
  24. data/dependencies/SDL/include/SDL_events.h +387 -79
  25. data/dependencies/SDL/include/SDL_filesystem.h +73 -64
  26. data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
  27. data/dependencies/SDL/include/SDL_gesture.h +36 -6
  28. data/dependencies/SDL/include/SDL_haptic.h +304 -210
  29. data/dependencies/SDL/include/SDL_hidapi.h +451 -0
  30. data/dependencies/SDL/include/SDL_hints.h +1286 -897
  31. data/dependencies/SDL/include/SDL_joystick.h +577 -130
  32. data/dependencies/SDL/include/SDL_keyboard.h +162 -63
  33. data/dependencies/SDL/include/SDL_keycode.h +7 -5
  34. data/dependencies/SDL/include/SDL_loadso.h +42 -8
  35. data/dependencies/SDL/include/SDL_locale.h +34 -32
  36. data/dependencies/SDL/include/SDL_log.h +212 -19
  37. data/dependencies/SDL/include/SDL_main.h +72 -17
  38. data/dependencies/SDL/include/SDL_messagebox.h +70 -23
  39. data/dependencies/SDL/include/SDL_metal.h +27 -32
  40. data/dependencies/SDL/include/SDL_misc.h +19 -15
  41. data/dependencies/SDL/include/SDL_mouse.h +262 -110
  42. data/dependencies/SDL/include/SDL_mutex.h +286 -66
  43. data/dependencies/SDL/include/SDL_name.h +1 -1
  44. data/dependencies/SDL/include/SDL_opengl.h +1 -1
  45. data/dependencies/SDL/include/SDL_opengles.h +1 -1
  46. data/dependencies/SDL/include/SDL_opengles2.h +2 -2
  47. data/dependencies/SDL/include/SDL_pixels.h +199 -34
  48. data/dependencies/SDL/include/SDL_platform.h +39 -2
  49. data/dependencies/SDL/include/SDL_power.h +23 -10
  50. data/dependencies/SDL/include/SDL_quit.h +1 -1
  51. data/dependencies/SDL/include/SDL_rect.h +78 -28
  52. data/dependencies/SDL/include/SDL_render.h +1204 -472
  53. data/dependencies/SDL/include/SDL_revision.h +2 -2
  54. data/dependencies/SDL/include/SDL_rwops.h +605 -33
  55. data/dependencies/SDL/include/SDL_scancode.h +1 -1
  56. data/dependencies/SDL/include/SDL_sensor.h +76 -42
  57. data/dependencies/SDL/include/SDL_shape.h +38 -27
  58. data/dependencies/SDL/include/SDL_stdinc.h +96 -24
  59. data/dependencies/SDL/include/SDL_surface.h +571 -139
  60. data/dependencies/SDL/include/SDL_system.h +339 -101
  61. data/dependencies/SDL/include/SDL_syswm.h +50 -20
  62. data/dependencies/SDL/include/SDL_test.h +1 -1
  63. data/dependencies/SDL/include/SDL_test_assert.h +2 -2
  64. data/dependencies/SDL/include/SDL_test_common.h +23 -6
  65. data/dependencies/SDL/include/SDL_test_compare.h +1 -1
  66. data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
  67. data/dependencies/SDL/include/SDL_test_font.h +3 -3
  68. data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
  69. data/dependencies/SDL/include/SDL_test_harness.h +6 -6
  70. data/dependencies/SDL/include/SDL_test_images.h +1 -1
  71. data/dependencies/SDL/include/SDL_test_log.h +1 -1
  72. data/dependencies/SDL/include/SDL_test_md5.h +1 -1
  73. data/dependencies/SDL/include/SDL_test_memory.h +1 -1
  74. data/dependencies/SDL/include/SDL_test_random.h +2 -2
  75. data/dependencies/SDL/include/SDL_thread.h +226 -128
  76. data/dependencies/SDL/include/SDL_timer.h +129 -22
  77. data/dependencies/SDL/include/SDL_touch.h +48 -8
  78. data/dependencies/SDL/include/SDL_types.h +1 -1
  79. data/dependencies/SDL/include/SDL_version.h +72 -46
  80. data/dependencies/SDL/include/SDL_video.h +1266 -460
  81. data/dependencies/SDL/include/SDL_vulkan.h +100 -161
  82. data/dependencies/SDL/include/begin_code.h +22 -1
  83. data/dependencies/SDL/include/close_code.h +1 -1
  84. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  85. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  86. data/dependencies/SDL_sound/SDL_sound.c +83 -7
  87. data/dependencies/SDL_sound/SDL_sound.h +4 -4
  88. data/dependencies/SDL_sound/SDL_sound_aiff.c +9 -12
  89. data/dependencies/SDL_sound/SDL_sound_au.c +7 -7
  90. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +3 -3
  91. data/dependencies/SDL_sound/SDL_sound_flac.c +1 -1
  92. data/dependencies/SDL_sound/SDL_sound_internal.h +17 -10
  93. data/dependencies/SDL_sound/SDL_sound_modplug.c +25 -27
  94. data/dependencies/SDL_sound/SDL_sound_mp3.c +5 -17
  95. data/dependencies/SDL_sound/SDL_sound_raw.c +11 -11
  96. data/dependencies/SDL_sound/SDL_sound_shn.c +8 -7
  97. data/dependencies/SDL_sound/SDL_sound_voc.c +6 -4
  98. data/dependencies/SDL_sound/SDL_sound_vorbis.c +6 -11
  99. data/dependencies/SDL_sound/SDL_sound_wav.c +35 -29
  100. data/dependencies/SDL_sound/dr_flac.h +618 -220
  101. data/dependencies/SDL_sound/dr_mp3.h +263 -94
  102. data/dependencies/SDL_sound/libmodplug/fastmix.c +58 -64
  103. data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
  104. data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
  105. data/dependencies/SDL_sound/libmodplug/load_amf.c +11 -7
  106. data/dependencies/SDL_sound/libmodplug/load_ams.c +65 -22
  107. data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
  108. data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
  109. data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
  110. data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
  111. data/dependencies/SDL_sound/libmodplug/load_it.c +45 -49
  112. data/dependencies/SDL_sound/libmodplug/load_mdl.c +80 -53
  113. data/dependencies/SDL_sound/libmodplug/load_med.c +20 -12
  114. data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
  115. data/dependencies/SDL_sound/libmodplug/load_mt2.c +29 -17
  116. data/dependencies/SDL_sound/libmodplug/load_okt.c +12 -8
  117. data/dependencies/SDL_sound/libmodplug/load_psm.c +101 -78
  118. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
  119. data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
  120. data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
  121. data/dependencies/SDL_sound/libmodplug/load_ult.c +2 -2
  122. data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
  123. data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
  124. data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
  125. data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
  126. data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
  127. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
  128. data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
  129. data/dependencies/SDL_sound/libmodplug/snd_fx.c +24 -18
  130. data/dependencies/SDL_sound/libmodplug/sndfile.c +55 -156
  131. data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
  132. data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
  133. data/dependencies/SDL_sound/stb_vorbis.h +508 -325
  134. data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
  135. data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
  136. data/dependencies/mojoAL/mojoal.c +4594 -0
  137. data/ext/gosu/extconf.rb +29 -30
  138. data/include/Gosu/Audio.hpp +70 -85
  139. data/include/Gosu/Color.hpp +63 -107
  140. data/include/Gosu/Font.hpp +44 -48
  141. data/include/Gosu/Fwd.hpp +1 -1
  142. data/include/Gosu/Graphics.hpp +64 -75
  143. data/include/Gosu/GraphicsBase.hpp +32 -39
  144. data/include/Gosu/Image.hpp +56 -62
  145. data/include/Gosu/ImageData.hpp +23 -27
  146. data/include/Gosu/Inspection.hpp +1 -4
  147. data/include/Gosu/Math.hpp +4 -16
  148. data/include/Gosu/Platform.hpp +1 -51
  149. data/include/Gosu/Text.hpp +37 -40
  150. data/include/Gosu/TextInput.hpp +34 -40
  151. data/include/Gosu/Utility.hpp +10 -8
  152. data/include/Gosu/Version.hpp +1 -1
  153. data/include/Gosu/Window.hpp +73 -70
  154. data/lib/SDL2.dll +0 -0
  155. data/lib/gosu/compat.rb +28 -37
  156. data/lib/gosu/swig_patches.rb +31 -3
  157. data/lib/gosu.rb +2 -2
  158. data/lib64/SDL2.dll +0 -0
  159. data/rdoc/gosu.rb +9 -1
  160. data/src/Audio.cpp +88 -86
  161. data/src/AudioFile.hpp +6 -6
  162. data/src/AudioFileAudioToolbox.cpp +1 -1
  163. data/src/AudioFileSDLSound.cpp +1 -1
  164. data/src/AudioImpl.hpp +5 -5
  165. data/src/Bitmap.cpp +13 -13
  166. data/src/BitmapIO.cpp +0 -20
  167. data/src/BlockAllocator.cpp +2 -1
  168. data/src/Channel.cpp +22 -20
  169. data/src/Color.cpp +62 -55
  170. data/src/EmptyImageData.hpp +16 -18
  171. data/src/FileUnix.cpp +1 -1
  172. data/src/FileWin.cpp +1 -1
  173. data/src/Font.cpp +52 -57
  174. data/src/GosuViewController.cpp +2 -0
  175. data/src/Graphics.cpp +135 -143
  176. data/src/Image.cpp +42 -42
  177. data/src/Input.cpp +1 -1
  178. data/src/InputUIKit.cpp +1 -1
  179. data/src/LargeImageData.cpp +120 -113
  180. data/src/LargeImageData.hpp +18 -16
  181. data/src/Log.hpp +6 -6
  182. data/src/Macro.cpp +35 -37
  183. data/src/Macro.hpp +11 -11
  184. data/src/Math.cpp +8 -1
  185. data/src/RenderState.hpp +5 -5
  186. data/src/Resolution.cpp +12 -7
  187. data/src/RubyGosu.cxx +471 -502
  188. data/src/RubyGosu.h +3 -2
  189. data/src/TexChunk.cpp +50 -41
  190. data/src/TexChunk.hpp +22 -22
  191. data/src/Text.cpp +58 -59
  192. data/src/TextBuilder.cpp +60 -57
  193. data/src/TextBuilder.hpp +20 -20
  194. data/src/TextInput.cpp +127 -135
  195. data/src/TrueTypeFont.cpp +108 -108
  196. data/src/TrueTypeFont.hpp +39 -38
  197. data/src/TrueTypeFontApple.cpp +27 -23
  198. data/src/TrueTypeFontUnix.cpp +21 -26
  199. data/src/TrueTypeFontWin.cpp +30 -30
  200. data/src/Utility.cpp +82 -23
  201. data/src/WinUtility.hpp +2 -1
  202. data/src/Window.cpp +103 -86
  203. data/src/WindowUIKit.cpp +48 -51
  204. metadata +8 -20
  205. data/dependencies/SDL/include/SDL_config_os2.h +0 -188
  206. data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
  207. data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
  208. data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
  209. data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
  210. data/dependencies/al_soft/AL/alext.h +0 -585
  211. data/dependencies/al_soft/AL/efx-creative.h +0 -3
  212. data/dependencies/al_soft/AL/efx-presets.h +0 -402
  213. data/dependencies/al_soft/AL/efx.h +0 -762
  214. data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
  215. data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
  216. data/lib/OpenAL32.dll +0 -0
  217. data/lib64/OpenAL32.dll +0 -0
  218. data/src/UtilityApple.cpp +0 -16
  219. data/src/UtilityWin.cpp +0 -17
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
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-2020 Sam Lantinga <slouken@libsdl.org>
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
@@ -130,126 +130,160 @@ typedef enum
130
130
  * If you are using the sensor API or handling events from multiple threads
131
131
  * you should use these locking functions to protect access to the sensors.
132
132
  *
133
- * In particular, you are guaranteed that the sensor list won't change, so
134
- * the API functions that take a sensor index will be valid, and sensor
135
- * events will not be delivered.
133
+ * In particular, you are guaranteed that the sensor list won't change, so the
134
+ * API functions that take a sensor index will be valid, and sensor events
135
+ * will not be delivered.
136
+ *
137
+ * \since This function is available since SDL 2.0.14.
136
138
  */
137
139
  extern DECLSPEC void SDLCALL SDL_LockSensors(void);
138
140
  extern DECLSPEC void SDLCALL SDL_UnlockSensors(void);
139
141
 
140
142
  /**
141
- * \brief Count the number of sensors attached to the system right now
143
+ * Count the number of sensors attached to the system right now.
144
+ *
145
+ * \returns the number of sensors detected.
146
+ *
147
+ * \since This function is available since SDL 2.0.9.
142
148
  */
143
149
  extern DECLSPEC int SDLCALL SDL_NumSensors(void);
144
150
 
145
151
  /**
146
- * \brief Get the implementation dependent name of a sensor.
152
+ * Get the implementation dependent name of a sensor.
147
153
  *
148
- * This can be called before any sensors are opened.
149
- *
150
- * \return The sensor name, or NULL if device_index is out of range.
154
+ * \param device_index The sensor to obtain name from
155
+ * \returns the sensor name, or NULL if `device_index` is out of range.
156
+ *
157
+ * \since This function is available since SDL 2.0.9.
151
158
  */
152
159
  extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
153
160
 
154
161
  /**
155
- * \brief Get the type of a sensor.
162
+ * Get the type of a sensor.
156
163
  *
157
- * This can be called before any sensors are opened.
164
+ * \param device_index The sensor to get the type from
165
+ * \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is
166
+ * out of range.
158
167
  *
159
- * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range.
168
+ * \since This function is available since SDL 2.0.9.
160
169
  */
161
170
  extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index);
162
171
 
163
172
  /**
164
- * \brief Get the platform dependent type of a sensor.
173
+ * Get the platform dependent type of a sensor.
165
174
  *
166
- * This can be called before any sensors are opened.
175
+ * \param device_index The sensor to check
176
+ * \returns the sensor platform dependent type, or -1 if `device_index` is out
177
+ * of range.
167
178
  *
168
- * \return The sensor platform dependent type, or -1 if device_index is out of range.
179
+ * \since This function is available since SDL 2.0.9.
169
180
  */
170
181
  extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index);
171
182
 
172
183
  /**
173
- * \brief Get the instance ID of a sensor.
184
+ * Get the instance ID of a sensor.
174
185
  *
175
- * This can be called before any sensors are opened.
186
+ * \param device_index The sensor to get instance id from
187
+ * \returns the sensor instance ID, or -1 if `device_index` is out of range.
176
188
  *
177
- * \return The sensor instance ID, or -1 if device_index is out of range.
189
+ * \since This function is available since SDL 2.0.9.
178
190
  */
179
191
  extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index);
180
192
 
181
193
  /**
182
- * \brief Open a sensor for use.
194
+ * Open a sensor for use.
183
195
  *
184
- * The index passed as an argument refers to the N'th sensor on the system.
196
+ * \param device_index The sensor to open
197
+ * \returns an SDL_Sensor sensor object, or NULL if an error occurred.
185
198
  *
186
- * \return A sensor identifier, or NULL if an error occurred.
199
+ * \since This function is available since SDL 2.0.9.
187
200
  */
188
201
  extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
189
202
 
190
203
  /**
191
204
  * Return the SDL_Sensor associated with an instance id.
205
+ *
206
+ * \param instance_id The sensor from instance id
207
+ * \returns an SDL_Sensor object.
208
+ *
209
+ * \since This function is available since SDL 2.0.9.
192
210
  */
193
211
  extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id);
194
212
 
195
213
  /**
196
- * \brief Get the implementation dependent name of a sensor.
214
+ * Get the implementation dependent name of a sensor
215
+ *
216
+ * \param sensor The SDL_Sensor object
217
+ * \returns the sensor name, or NULL if `sensor` is NULL.
197
218
  *
198
- * \return The sensor name, or NULL if the sensor is NULL.
219
+ * \since This function is available since SDL 2.0.9.
199
220
  */
200
221
  extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
201
222
 
202
223
  /**
203
- * \brief Get the type of a sensor.
224
+ * Get the type of a sensor.
204
225
  *
205
- * This can be called before any sensors are opened.
226
+ * \param sensor The SDL_Sensor object to inspect
227
+ * \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` if `sensor` is
228
+ * NULL.
206
229
  *
207
- * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL.
230
+ * \since This function is available since SDL 2.0.9.
208
231
  */
209
232
  extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
210
233
 
211
234
  /**
212
- * \brief Get the platform dependent type of a sensor.
235
+ * Get the platform dependent type of a sensor.
213
236
  *
214
- * This can be called before any sensors are opened.
237
+ * \param sensor The SDL_Sensor object to inspect
238
+ * \returns the sensor platform dependent type, or -1 if `sensor` is NULL.
215
239
  *
216
- * \return The sensor platform dependent type, or -1 if the sensor is NULL.
240
+ * \since This function is available since SDL 2.0.9.
217
241
  */
218
242
  extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
219
243
 
220
244
  /**
221
- * \brief Get the instance ID of a sensor.
245
+ * Get the instance ID of a sensor.
222
246
  *
223
- * This can be called before any sensors are opened.
247
+ * \param sensor The SDL_Sensor object to inspect
248
+ * \returns the sensor instance ID, or -1 if `sensor` is NULL.
224
249
  *
225
- * \return The sensor instance ID, or -1 if the sensor is NULL.
250
+ * \since This function is available since SDL 2.0.9.
226
251
  */
227
252
  extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor);
228
253
 
229
254
  /**
230
- * Get the current state of an opened sensor.
255
+ * Get the current state of an opened sensor.
231
256
  *
232
- * The number of values and interpretation of the data is sensor dependent.
257
+ * The number of values and interpretation of the data is sensor dependent.
233
258
  *
234
- * \param sensor The sensor to query
235
- * \param data A pointer filled with the current sensor state
236
- * \param num_values The number of values to write to data
259
+ * \param sensor The SDL_Sensor object to query
260
+ * \param data A pointer filled with the current sensor state
261
+ * \param num_values The number of values to write to data
262
+ * \returns 0 or -1 if an error occurred.
237
263
  *
238
- * \return 0 or -1 if an error occurred.
264
+ * \since This function is available since SDL 2.0.9.
239
265
  */
240
266
  extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values);
241
267
 
242
268
  /**
243
- * Close a sensor previously opened with SDL_SensorOpen()
269
+ * Close a sensor previously opened with SDL_SensorOpen().
270
+ *
271
+ * \param sensor The SDL_Sensor object to close
272
+ *
273
+ * \since This function is available since SDL 2.0.9.
244
274
  */
245
275
  extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor);
246
276
 
247
277
  /**
248
- * Update the current state of the open sensors.
278
+ * Update the current state of the open sensors.
279
+ *
280
+ * This is called automatically by the event loop if sensor events are
281
+ * enabled.
249
282
  *
250
- * This is called automatically by the event loop if sensor events are enabled.
283
+ * This needs to be called from the thread that initialized the sensor
284
+ * subsystem.
251
285
  *
252
- * This needs to be called from the thread that initialized the sensor subsystem.
286
+ * \since This function is available since SDL 2.0.9.
253
287
  */
254
288
  extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
255
289
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
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
@@ -44,33 +44,38 @@ extern "C" {
44
44
  #define SDL_WINDOW_LACKS_SHAPE -3
45
45
 
46
46
  /**
47
- * \brief Create a window that can be shaped with the specified position, dimensions, and flags.
47
+ * Create a window that can be shaped with the specified position, dimensions,
48
+ * and flags.
48
49
  *
49
- * \param title The title of the window, in UTF-8 encoding.
50
- * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
51
- * ::SDL_WINDOWPOS_UNDEFINED.
52
- * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
53
- * ::SDL_WINDOWPOS_UNDEFINED.
54
- * \param w The width of the window.
55
- * \param h The height of the window.
56
- * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
57
- * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED,
58
- * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE,
59
- * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED,
60
- * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
50
+ * \param title The title of the window, in UTF-8 encoding.
51
+ * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
52
+ * ::SDL_WINDOWPOS_UNDEFINED.
53
+ * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
54
+ * ::SDL_WINDOWPOS_UNDEFINED.
55
+ * \param w The width of the window.
56
+ * \param h The height of the window.
57
+ * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with
58
+ * any of the following: ::SDL_WINDOW_OPENGL,
59
+ * ::SDL_WINDOW_INPUT_GRABBED, ::SDL_WINDOW_HIDDEN,
60
+ * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
61
+ * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_BORDERLESS is always set,
62
+ * and ::SDL_WINDOW_FULLSCREEN is always unset.
63
+ * \return the window created, or NULL if window creation failed.
61
64
  *
62
- * \return The window created, or NULL if window creation failed.
65
+ * \since This function is available since SDL 2.0.0.
63
66
  *
64
- * \sa SDL_DestroyWindow()
67
+ * \sa SDL_DestroyWindow
65
68
  */
66
69
  extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
67
70
 
68
71
  /**
69
- * \brief Return whether the given window is a shaped window.
72
+ * Return whether the given window is a shaped window.
70
73
  *
71
74
  * \param window The window to query for being shaped.
75
+ * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if
76
+ * the window is unshaped or NULL.
72
77
  *
73
- * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
78
+ * \since This function is available since SDL 2.0.0.
74
79
  *
75
80
  * \sa SDL_CreateShapedWindow
76
81
  */
@@ -106,29 +111,35 @@ typedef struct SDL_WindowShapeMode {
106
111
  } SDL_WindowShapeMode;
107
112
 
108
113
  /**
109
- * \brief Set the shape and parameters of a shaped window.
114
+ * Set the shape and parameters of a shaped window.
110
115
  *
111
116
  * \param window The shaped window whose parameters should be set.
112
117
  * \param shape A surface encoding the desired shape for the window.
113
118
  * \param shape_mode The parameters to set for the shaped window.
119
+ * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape
120
+ * argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does
121
+ * not reference a valid shaped window.
114
122
  *
115
- * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
116
- * if the SDL_Window given does not reference a valid shaped window.
123
+ * \since This function is available since SDL 2.0.0.
117
124
  *
118
125
  * \sa SDL_WindowShapeMode
119
- * \sa SDL_GetShapedWindowMode.
126
+ * \sa SDL_GetShapedWindowMode
120
127
  */
121
128
  extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
122
129
 
123
130
  /**
124
- * \brief Get the shape parameters of a shaped window.
131
+ * Get the shape parameters of a shaped window.
125
132
  *
126
133
  * \param window The shaped window whose parameters should be retrieved.
127
- * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
134
+ * \param shape_mode An empty shape-mode structure to fill, or NULL to check
135
+ * whether the window has a shape.
136
+ * \return 0 if the window has a shape and, provided shape_mode was not NULL,
137
+ * shape_mode has been filled with the mode data,
138
+ * SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped
139
+ * window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a
140
+ * shapeable window currently lacking a shape.
128
141
  *
129
- * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
130
- * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
131
- * the SDL_Window given is a shapeable window currently lacking a shape.
142
+ * \since This function is available since SDL 2.0.0.
132
143
  *
133
144
  * \sa SDL_WindowShapeMode
134
145
  * \sa SDL_SetWindowShape
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Simple DirectMedia Layer
3
- Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
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
@@ -115,6 +115,17 @@ char *alloca();
115
115
  # endif
116
116
  #endif
117
117
 
118
+ /**
119
+ * Check if the compiler supports a given builtin.
120
+ * Supported by virtually all clang versions and recent gcc. Use this
121
+ * instead of checking the clang version if possible.
122
+ */
123
+ #ifdef __has_builtin
124
+ #define _SDL_HAS_BUILTIN(x) __has_builtin(x)
125
+ #else
126
+ #define _SDL_HAS_BUILTIN(x) 0
127
+ #endif
128
+
118
129
  /**
119
130
  * The number of elements in an array.
120
131
  */
@@ -223,7 +234,7 @@ typedef uint64_t Uint64;
223
234
 
224
235
  /* @} *//* Basic data types */
225
236
 
226
- /* Make sure we have macros for printing 64 bit values.
237
+ /* Make sure we have macros for printing width-based integers.
227
238
  * <stdint.h> should define these but this is not true all platforms.
228
239
  * (for example win32) */
229
240
  #ifndef SDL_PRIs64
@@ -270,6 +281,34 @@ typedef uint64_t Uint64;
270
281
  #define SDL_PRIX64 "llX"
271
282
  #endif
272
283
  #endif
284
+ #ifndef SDL_PRIs32
285
+ #ifdef PRId32
286
+ #define SDL_PRIs32 PRId32
287
+ #else
288
+ #define SDL_PRIs32 "d"
289
+ #endif
290
+ #endif
291
+ #ifndef SDL_PRIu32
292
+ #ifdef PRIu32
293
+ #define SDL_PRIu32 PRIu32
294
+ #else
295
+ #define SDL_PRIu32 "u"
296
+ #endif
297
+ #endif
298
+ #ifndef SDL_PRIx32
299
+ #ifdef PRIx32
300
+ #define SDL_PRIx32 PRIx32
301
+ #else
302
+ #define SDL_PRIx32 "x"
303
+ #endif
304
+ #endif
305
+ #ifndef SDL_PRIX32
306
+ #ifdef PRIX32
307
+ #define SDL_PRIX32 PRIX32
308
+ #else
309
+ #define SDL_PRIX32 "X"
310
+ #endif
311
+ #endif
273
312
 
274
313
  /* Annotations to help code analysis tools */
275
314
  #ifdef SDL_DISABLE_ANALYZE_MACROS
@@ -338,7 +377,7 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
338
377
 
339
378
  /** \cond */
340
379
  #ifndef DOXYGEN_SHOULD_IGNORE_THIS
341
- #if !defined(__ANDROID__)
380
+ #if !defined(__ANDROID__) && !defined(__VITA__)
342
381
  /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
343
382
  typedef enum
344
383
  {
@@ -375,7 +414,9 @@ typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
375
414
  typedef void (SDLCALL *SDL_free_func)(void *mem);
376
415
 
377
416
  /**
378
- * \brief Get the current set of SDL memory functions
417
+ * Get the current set of SDL memory functions
418
+ *
419
+ * \since This function is available since SDL 2.0.7.
379
420
  */
380
421
  extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
381
422
  SDL_calloc_func *calloc_func,
@@ -383,12 +424,9 @@ extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func
383
424
  SDL_free_func *free_func);
384
425
 
385
426
  /**
386
- * \brief Replace SDL's memory allocation functions with a custom set
427
+ * Replace SDL's memory allocation functions with a custom set
387
428
  *
388
- * \note If you are replacing SDL's memory functions, you should call
389
- * SDL_GetNumAllocations() and be very careful if it returns non-zero.
390
- * That means that your free function will be called with memory
391
- * allocated by the previous memory allocation functions.
429
+ * \since This function is available since SDL 2.0.7.
392
430
  */
393
431
  extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
394
432
  SDL_calloc_func calloc_func,
@@ -396,7 +434,9 @@ extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
396
434
  SDL_free_func free_func);
397
435
 
398
436
  /**
399
- * \brief Get the number of outstanding (unfreed) allocations
437
+ * Get the number of outstanding (unfreed) allocations
438
+ *
439
+ * \since This function is available since SDL 2.0.7.
400
440
  */
401
441
  extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
402
442
 
@@ -407,15 +447,23 @@ extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, in
407
447
 
408
448
  extern DECLSPEC int SDLCALL SDL_abs(int x);
409
449
 
410
- /* !!! FIXME: these have side effects. You probably shouldn't use them. */
411
- /* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
450
+ /* NOTE: these double-evaluate their arguments, so you should never have side effects in the parameters */
412
451
  #define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
413
452
  #define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
453
+ #define SDL_clamp(x, a, b) (((x) < (a)) ? (a) : (((x) > (b)) ? (b) : (x)))
414
454
 
455
+ extern DECLSPEC int SDLCALL SDL_isalpha(int x);
456
+ extern DECLSPEC int SDLCALL SDL_isalnum(int x);
457
+ extern DECLSPEC int SDLCALL SDL_isblank(int x);
458
+ extern DECLSPEC int SDLCALL SDL_iscntrl(int x);
415
459
  extern DECLSPEC int SDLCALL SDL_isdigit(int x);
460
+ extern DECLSPEC int SDLCALL SDL_isxdigit(int x);
461
+ extern DECLSPEC int SDLCALL SDL_ispunct(int x);
416
462
  extern DECLSPEC int SDLCALL SDL_isspace(int x);
417
463
  extern DECLSPEC int SDLCALL SDL_isupper(int x);
418
464
  extern DECLSPEC int SDLCALL SDL_islower(int x);
465
+ extern DECLSPEC int SDLCALL SDL_isprint(int x);
466
+ extern DECLSPEC int SDLCALL SDL_isgraph(int x);
419
467
  extern DECLSPEC int SDLCALL SDL_toupper(int x);
420
468
  extern DECLSPEC int SDLCALL SDL_tolower(int x);
421
469
 
@@ -432,7 +480,7 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
432
480
  {
433
481
  #ifdef __APPLE__
434
482
  memset_pattern4(dst, &val, dwords * 4);
435
- #elif defined(__GNUC__) && defined(i386)
483
+ #elif defined(__GNUC__) && defined(__i386__)
436
484
  int u0, u1, u2;
437
485
  __asm__ __volatile__ (
438
486
  "cld \n\t"
@@ -445,14 +493,14 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
445
493
  size_t _n = (dwords + 3) / 4;
446
494
  Uint32 *_p = SDL_static_cast(Uint32 *, dst);
447
495
  Uint32 _val = (val);
448
- if (dwords == 0)
496
+ if (dwords == 0) {
449
497
  return;
450
- switch (dwords % 4)
451
- {
452
- case 0: do { *_p++ = _val; /* fallthrough */
453
- case 3: *_p++ = _val; /* fallthrough */
454
- case 2: *_p++ = _val; /* fallthrough */
455
- case 1: *_p++ = _val; /* fallthrough */
498
+ }
499
+ switch (dwords % 4) {
500
+ case 0: do { *_p++ = _val; SDL_FALLTHROUGH;
501
+ case 3: *_p++ = _val; SDL_FALLTHROUGH;
502
+ case 2: *_p++ = _val; SDL_FALLTHROUGH;
503
+ case 1: *_p++ = _val;
456
504
  } while ( --_n );
457
505
  }
458
506
  #endif
@@ -512,6 +560,8 @@ extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING
512
560
  extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
513
561
  extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
514
562
  extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
563
+ extern DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
564
+ extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, const char *fmt, va_list ap);
515
565
 
516
566
  #ifndef HAVE_M_PI
517
567
  #ifndef M_PI
@@ -519,14 +569,28 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size
519
569
  #endif
520
570
  #endif
521
571
 
572
+ /**
573
+ * Use this function to compute arc cosine of `x`.
574
+ *
575
+ * The definition of `y = acos(x)` is `x = cos(y)`.
576
+ *
577
+ * Domain: `-1 <= x <= 1`
578
+ *
579
+ * Range: `0 <= y <= Pi`
580
+ *
581
+ * \param x floating point value, in radians.
582
+ * \returns arc cosine of `x`.
583
+ *
584
+ * \since This function is available since SDL 2.0.2.
585
+ */
522
586
  extern DECLSPEC double SDLCALL SDL_acos(double x);
523
587
  extern DECLSPEC float SDLCALL SDL_acosf(float x);
524
588
  extern DECLSPEC double SDLCALL SDL_asin(double x);
525
589
  extern DECLSPEC float SDLCALL SDL_asinf(float x);
526
590
  extern DECLSPEC double SDLCALL SDL_atan(double x);
527
591
  extern DECLSPEC float SDLCALL SDL_atanf(float x);
528
- extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
529
- extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
592
+ extern DECLSPEC double SDLCALL SDL_atan2(double y, double x);
593
+ extern DECLSPEC float SDLCALL SDL_atan2f(float y, float x);
530
594
  extern DECLSPEC double SDLCALL SDL_ceil(double x);
531
595
  extern DECLSPEC float SDLCALL SDL_ceilf(float x);
532
596
  extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
@@ -549,6 +613,10 @@ extern DECLSPEC double SDLCALL SDL_log10(double x);
549
613
  extern DECLSPEC float SDLCALL SDL_log10f(float x);
550
614
  extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
551
615
  extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
616
+ extern DECLSPEC double SDLCALL SDL_round(double x);
617
+ extern DECLSPEC float SDLCALL SDL_roundf(float x);
618
+ extern DECLSPEC long SDLCALL SDL_lround(double x);
619
+ extern DECLSPEC long SDLCALL SDL_lroundf(float x);
552
620
  extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
553
621
  extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
554
622
  extern DECLSPEC double SDLCALL SDL_sin(double x);
@@ -572,9 +640,12 @@ extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
572
640
  extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
573
641
  size_t * inbytesleft, char **outbuf,
574
642
  size_t * outbytesleft);
643
+
575
644
  /**
576
- * This function converts a string between encodings in one pass, returning a
577
- * string that must be freed with SDL_free() or NULL on error.
645
+ * This function converts a string between encodings in one pass, returning a
646
+ * string that must be freed with SDL_free() or NULL on error.
647
+ *
648
+ * \since This function is available since SDL 2.0.0.
578
649
  */
579
650
  extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
580
651
  const char *fromcode,
@@ -583,6 +654,7 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
583
654
  #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
584
655
  #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
585
656
  #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
657
+ #define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S)+1)*sizeof(wchar_t))
586
658
 
587
659
  /* force builds using Clang's static analysis tools to use literal C runtime
588
660
  here, since there are possibly tests that are ineffective otherwise. */