ruby2d 0.11.3 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/assets/include/GLES2/gl2.h +656 -0
  3. data/assets/include/GLES2/gl2ext.h +3949 -0
  4. data/assets/include/GLES2/gl2ext_angle.h +701 -0
  5. data/assets/include/GLES2/gl2platform.h +27 -0
  6. data/assets/include/GLES3/gl3.h +1192 -0
  7. data/assets/include/GLES3/gl31.h +1507 -0
  8. data/assets/include/GLES3/gl32.h +1808 -0
  9. data/assets/include/GLES3/gl3platform.h +27 -0
  10. data/assets/include/KHR/khrplatform.h +290 -0
  11. data/assets/include/SDL2/SDL.h +1 -0
  12. data/assets/include/SDL2/SDL_assert.h +4 -2
  13. data/assets/include/SDL2/SDL_atomic.h +20 -0
  14. data/assets/include/SDL2/SDL_audio.h +40 -4
  15. data/assets/include/SDL2/SDL_blendmode.h +4 -6
  16. data/assets/include/SDL2/SDL_clipboard.h +47 -0
  17. data/assets/include/SDL2/SDL_config.h +6 -2
  18. data/assets/include/SDL2/SDL_config_android.h +2 -0
  19. data/assets/include/SDL2/SDL_config_emscripten.h +2 -0
  20. data/assets/include/SDL2/SDL_config_iphoneos.h +3 -1
  21. data/assets/include/SDL2/SDL_config_macosx.h +3 -6
  22. data/assets/include/SDL2/SDL_config_minimal.h +18 -11
  23. data/assets/include/SDL2/SDL_config_ngage.h +89 -0
  24. data/assets/include/SDL2/SDL_config_os2.h +5 -3
  25. data/assets/include/SDL2/SDL_config_pandora.h +1 -0
  26. data/assets/include/SDL2/SDL_config_windows.h +71 -45
  27. data/assets/include/SDL2/SDL_config_wingdk.h +253 -0
  28. data/assets/include/SDL2/SDL_config_winrt.h +11 -49
  29. data/assets/include/SDL2/SDL_config_xbox.h +235 -0
  30. data/assets/include/SDL2/SDL_cpuinfo.h +39 -4
  31. data/assets/include/SDL2/SDL_egl.h +59 -9
  32. data/assets/include/SDL2/SDL_endian.h +34 -3
  33. data/assets/include/SDL2/SDL_events.h +32 -1
  34. data/assets/include/SDL2/SDL_filesystem.h +5 -1
  35. data/assets/include/SDL2/SDL_gamecontroller.h +78 -5
  36. data/assets/include/SDL2/SDL_guid.h +100 -0
  37. data/assets/include/SDL2/SDL_hints.h +645 -43
  38. data/assets/include/SDL2/SDL_image.h +2045 -33
  39. data/assets/include/SDL2/SDL_joystick.h +127 -7
  40. data/assets/include/SDL2/SDL_keyboard.h +38 -1
  41. data/assets/include/SDL2/SDL_keycode.h +6 -1
  42. data/assets/include/SDL2/SDL_log.h +2 -2
  43. data/assets/include/SDL2/SDL_main.h +42 -2
  44. data/assets/include/SDL2/SDL_metal.h +2 -1
  45. data/assets/include/SDL2/SDL_mixer.h +2529 -396
  46. data/assets/include/SDL2/SDL_mouse.h +12 -1
  47. data/assets/include/SDL2/SDL_opengl.h +0 -51
  48. data/assets/include/SDL2/SDL_opengl_glext.h +2260 -231
  49. data/assets/include/SDL2/SDL_opengles2_gl2.h +374 -339
  50. data/assets/include/SDL2/SDL_opengles2_gl2ext.h +3479 -1496
  51. data/assets/include/SDL2/SDL_opengles2_gl2platform.h +6 -9
  52. data/assets/include/SDL2/SDL_opengles2_khrplatform.h +43 -14
  53. data/assets/include/SDL2/SDL_platform.h +32 -6
  54. data/assets/include/SDL2/SDL_rect.h +154 -2
  55. data/assets/include/SDL2/SDL_render.h +46 -17
  56. data/assets/include/SDL2/SDL_revision.h +4 -0
  57. data/assets/include/SDL2/SDL_rwops.h +1 -15
  58. data/assets/include/SDL2/SDL_scancode.h +46 -21
  59. data/assets/include/SDL2/SDL_sensor.h +24 -3
  60. data/assets/include/SDL2/SDL_stdinc.h +119 -8
  61. data/assets/include/SDL2/SDL_surface.h +3 -1
  62. data/assets/include/SDL2/SDL_system.h +66 -6
  63. data/assets/include/SDL2/SDL_syswm.h +2 -0
  64. data/assets/include/SDL2/SDL_test_common.h +1 -0
  65. data/assets/include/SDL2/SDL_test_font.h +90 -3
  66. data/assets/include/SDL2/SDL_thread.h +3 -3
  67. data/assets/include/SDL2/SDL_touch.h +8 -0
  68. data/assets/include/SDL2/SDL_ttf.h +2084 -155
  69. data/assets/include/SDL2/SDL_version.h +19 -3
  70. data/assets/include/SDL2/SDL_video.h +71 -9
  71. data/assets/include/SDL2/begin_code.h +4 -4
  72. data/assets/include/mrbconf.h +15 -17
  73. data/assets/include/mruby/array.h +8 -21
  74. data/assets/include/mruby/boxing_nan.h +115 -86
  75. data/assets/include/mruby/boxing_word.h +104 -78
  76. data/assets/include/mruby/common.h +6 -0
  77. data/assets/include/mruby/compile.h +3 -4
  78. data/assets/include/mruby/debug.h +4 -2
  79. data/assets/include/mruby/dump.h +5 -2
  80. data/assets/include/mruby/error.h +12 -2
  81. data/assets/include/mruby/gc.h +2 -0
  82. data/assets/include/mruby/hash.h +1 -3
  83. data/assets/include/mruby/irep.h +4 -4
  84. data/assets/include/mruby/numeric.h +21 -13
  85. data/assets/include/mruby/opcode.h +30 -0
  86. data/assets/include/mruby/ops.h +99 -101
  87. data/assets/include/mruby/presym/scanning.h +15 -9
  88. data/assets/include/mruby/proc.h +4 -2
  89. data/assets/include/mruby/string.h +3 -24
  90. data/assets/include/mruby/value.h +80 -40
  91. data/assets/include/mruby/variable.h +0 -15
  92. data/assets/include/mruby/version.h +5 -5
  93. data/assets/include/mruby.h +86 -16
  94. data/assets/macos/universal/bin/mrbc +0 -0
  95. data/assets/macos/universal/lib/libFLAC.a +0 -0
  96. data/assets/macos/universal/lib/libSDL2.a +0 -0
  97. data/assets/macos/universal/lib/libSDL2_image.a +0 -0
  98. data/assets/macos/universal/lib/libSDL2_mixer.a +0 -0
  99. data/assets/macos/universal/lib/libSDL2_ttf.a +0 -0
  100. data/assets/macos/universal/lib/libavif.a +0 -0
  101. data/assets/macos/universal/lib/libbrotlicommon-static.a +0 -0
  102. data/assets/macos/universal/lib/libbrotlidec-static.a +0 -0
  103. data/assets/macos/universal/lib/libfreetype.a +0 -0
  104. data/assets/macos/universal/lib/libgraphite2.a +0 -0
  105. data/assets/macos/universal/lib/libharfbuzz.a +0 -0
  106. data/assets/macos/universal/lib/libhwy.a +0 -0
  107. data/assets/macos/universal/lib/libjpeg.a +0 -0
  108. data/assets/macos/universal/lib/libjxl.a +0 -0
  109. data/assets/macos/universal/lib/libmodplug.a +0 -0
  110. data/assets/macos/universal/lib/libmpg123.a +0 -0
  111. data/assets/macos/universal/lib/libmruby.a +0 -0
  112. data/assets/macos/universal/lib/libogg.a +0 -0
  113. data/assets/macos/universal/lib/libpng.a +0 -0
  114. data/assets/macos/universal/lib/libtiff.a +0 -0
  115. data/assets/macos/universal/lib/libvorbis.a +0 -0
  116. data/assets/macos/universal/lib/libvorbisfile.a +0 -0
  117. data/assets/macos/universal/lib/libwebp.a +0 -0
  118. data/assets/macos/universal/lib/libzstd.a +0 -0
  119. data/assets/wasm/template.html +2 -1
  120. data/assets/windows/mingw-w64-ucrt-x86_64/bin/mrbc.exe +0 -0
  121. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a +0 -0
  122. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libLerc.a +0 -0
  123. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a +0 -0
  124. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_image.a +0 -0
  125. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a +0 -0
  126. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_ttf.a +0 -0
  127. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlicommon.a +0 -0
  128. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libbrotlidec.a +0 -0
  129. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libdeflate.a +0 -0
  130. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libfreetype.a +0 -0
  131. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a +0 -0
  132. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libharfbuzz.a +0 -0
  133. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libhwy.a +0 -0
  134. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjpeg.a +0 -0
  135. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libjxl.a +0 -0
  136. data/assets/windows/mingw-w64-ucrt-x86_64/lib/liblzma.a +0 -0
  137. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a +0 -0
  138. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmruby.a +0 -0
  139. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a +0 -0
  140. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libpng.a +0 -0
  141. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a +0 -0
  142. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a +0 -0
  143. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a +0 -0
  144. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libtiff.a +0 -0
  145. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libwebp.a +0 -0
  146. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a +0 -0
  147. data/assets/windows/mingw-w64-x86_64/bin/mrbc.exe +0 -0
  148. data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
  149. data/assets/windows/mingw-w64-x86_64/lib/libLerc.a +0 -0
  150. data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
  151. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_image.a +0 -0
  152. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
  153. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_ttf.a +0 -0
  154. data/assets/windows/mingw-w64-x86_64/lib/libbrotlicommon.a +0 -0
  155. data/assets/windows/mingw-w64-x86_64/lib/libbrotlidec.a +0 -0
  156. data/assets/windows/mingw-w64-x86_64/lib/libdeflate.a +0 -0
  157. data/assets/windows/mingw-w64-x86_64/lib/libfreetype.a +0 -0
  158. data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
  159. data/assets/windows/mingw-w64-x86_64/lib/libharfbuzz.a +0 -0
  160. data/assets/windows/mingw-w64-x86_64/lib/libhwy.a +0 -0
  161. data/assets/windows/mingw-w64-x86_64/lib/libjpeg.a +0 -0
  162. data/assets/windows/mingw-w64-x86_64/lib/libjxl.a +0 -0
  163. data/assets/windows/mingw-w64-x86_64/lib/liblzma.a +0 -0
  164. data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
  165. data/assets/windows/mingw-w64-x86_64/lib/libmruby.a +0 -0
  166. data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
  167. data/assets/windows/mingw-w64-x86_64/lib/libpng.a +0 -0
  168. data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
  169. data/assets/windows/mingw-w64-x86_64/lib/libssp.a +0 -0
  170. data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
  171. data/assets/windows/mingw-w64-x86_64/lib/libtiff.a +0 -0
  172. data/assets/windows/mingw-w64-x86_64/lib/libwebp.a +0 -0
  173. data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
  174. data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
  175. data/ext/ruby2d/canvas.c +540 -0
  176. data/ext/ruby2d/extconf.rb +33 -20
  177. data/ext/ruby2d/gl.c +3 -3
  178. data/ext/ruby2d/image.c +7 -7
  179. data/ext/ruby2d/ruby2d.c +741 -24
  180. data/ext/ruby2d/ruby2d.h +66 -3
  181. data/ext/ruby2d/sound.c +16 -2
  182. data/lib/ruby2d/canvas.rb +315 -0
  183. data/lib/ruby2d/circle.rb +30 -15
  184. data/lib/ruby2d/cli/build.rb +5 -3
  185. data/lib/ruby2d/cli/enable_console.rb +3 -1
  186. data/lib/ruby2d/color.rb +133 -77
  187. data/lib/ruby2d/core.rb +32 -0
  188. data/lib/ruby2d/dsl.rb +38 -32
  189. data/lib/ruby2d/exceptions.rb +2 -1
  190. data/lib/ruby2d/font.rb +97 -62
  191. data/lib/ruby2d/image.rb +48 -27
  192. data/lib/ruby2d/line.rb +84 -45
  193. data/lib/ruby2d/music.rb +33 -23
  194. data/lib/ruby2d/pixel.rb +10 -9
  195. data/lib/ruby2d/pixmap.rb +39 -0
  196. data/lib/ruby2d/pixmap_atlas.rb +56 -0
  197. data/lib/ruby2d/quad.rb +98 -49
  198. data/lib/ruby2d/rectangle.rb +35 -36
  199. data/lib/ruby2d/renderable.rb +7 -6
  200. data/lib/ruby2d/sound.rb +23 -17
  201. data/lib/ruby2d/sprite.rb +181 -140
  202. data/lib/ruby2d/square.rb +21 -20
  203. data/lib/ruby2d/text.rb +47 -19
  204. data/lib/ruby2d/texture.rb +13 -3
  205. data/lib/ruby2d/tileset.rb +97 -44
  206. data/lib/ruby2d/triangle.rb +91 -42
  207. data/lib/ruby2d/version.rb +3 -1
  208. data/lib/ruby2d/vertices.rb +81 -45
  209. data/lib/ruby2d/window.rb +508 -371
  210. data/lib/ruby2d.rb +11 -29
  211. metadata +51 -16
  212. data/assets/include/SDL2/SDL_config_psp.h +0 -165
  213. data/assets/include/SDL2/SDL_config_wiz.h +0 -154
  214. data/assets/include/glew.h +0 -23686
  215. data/assets/macos/universal/lib/libpng16.a +0 -0
  216. data/assets/windows/glew/README.md +0 -10
  217. data/assets/windows/glew/glew.h +0 -23686
  218. data/assets/windows/glew/libglew32.a +0 -0
  219. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libpng16.a +0 -0
  220. data/assets/windows/mingw-w64-x86_64/lib/libpng16.a +0 -0
  221. data/lib/ruby2d/entity.rb +0 -17
@@ -43,6 +43,7 @@
43
43
 
44
44
  #include "SDL_stdinc.h"
45
45
  #include "SDL_error.h"
46
+ #include "SDL_guid.h"
46
47
 
47
48
  #include "begin_code.h"
48
49
  /* Set up for C function definitions, even when using C++ */
@@ -69,9 +70,7 @@ struct _SDL_Joystick;
69
70
  typedef struct _SDL_Joystick SDL_Joystick;
70
71
 
71
72
  /* A structure that encodes the stable unique id for a joystick device */
72
- typedef struct {
73
- Uint8 data[16];
74
- } SDL_JoystickGUID;
73
+ typedef SDL_GUID SDL_JoystickGUID;
75
74
 
76
75
  /**
77
76
  * This is a unique ID for a joystick for the time it is connected to the system,
@@ -125,6 +124,11 @@ typedef enum
125
124
  * the API functions that take a joystick index will be valid, and joystick
126
125
  * and game controller events will not be delivered.
127
126
  *
127
+ * As of SDL 2.26.0, you can take the joystick lock around reinitializing the
128
+ * joystick subsystem, to prevent other threads from seeing joysticks in an
129
+ * uninitialized state. However, all open joysticks will be closed and SDL
130
+ * functions called with them will fail.
131
+ *
128
132
  * \since This function is available since SDL 2.0.7.
129
133
  */
130
134
  extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
@@ -153,6 +157,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
153
157
  * \since This function is available since SDL 2.0.0.
154
158
  *
155
159
  * \sa SDL_JoystickName
160
+ * \sa SDL_JoystickPath
156
161
  * \sa SDL_JoystickOpen
157
162
  */
158
163
  extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
@@ -174,6 +179,23 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
174
179
  */
175
180
  extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
176
181
 
182
+ /**
183
+ * Get the implementation dependent path of a joystick.
184
+ *
185
+ * This can be called before any joysticks are opened.
186
+ *
187
+ * \param device_index the index of the joystick to query (the N'th joystick
188
+ * on the system)
189
+ * \returns the path of the selected joystick. If no path can be found, this
190
+ * function returns NULL; call SDL_GetError() for more information.
191
+ *
192
+ * \since This function is available since SDL 2.24.0.
193
+ *
194
+ * \sa SDL_JoystickPath
195
+ * \sa SDL_JoystickOpen
196
+ */
197
+ extern DECLSPEC const char *SDLCALL SDL_JoystickPathForIndex(int device_index);
198
+
177
199
  /**
178
200
  * Get the player index of a joystick, or -1 if it's not available This can be
179
201
  * called before any joysticks are opened.
@@ -330,6 +352,54 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
330
352
  int nbuttons,
331
353
  int nhats);
332
354
 
355
+ /**
356
+ * The structure that defines an extended virtual joystick description
357
+ *
358
+ * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx()
359
+ * All other elements of this structure are optional and can be left 0.
360
+ *
361
+ * \sa SDL_JoystickAttachVirtualEx
362
+ */
363
+ typedef struct SDL_VirtualJoystickDesc
364
+ {
365
+ Uint16 version; /**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` */
366
+ Uint16 type; /**< `SDL_JoystickType` */
367
+ Uint16 naxes; /**< the number of axes on this joystick */
368
+ Uint16 nbuttons; /**< the number of buttons on this joystick */
369
+ Uint16 nhats; /**< the number of hats on this joystick */
370
+ Uint16 vendor_id; /**< the USB vendor ID of this joystick */
371
+ Uint16 product_id; /**< the USB product ID of this joystick */
372
+ Uint16 padding; /**< unused */
373
+ Uint32 button_mask; /**< A mask of which buttons are valid for this controller
374
+ e.g. (1 << SDL_CONTROLLER_BUTTON_A) */
375
+ Uint32 axis_mask; /**< A mask of which axes are valid for this controller
376
+ e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) */
377
+ const char *name; /**< the name of the joystick */
378
+
379
+ void *userdata; /**< User data pointer passed to callbacks */
380
+ void (SDLCALL *Update)(void *userdata); /**< Called when the joystick state should be updated */
381
+ void (SDLCALL *SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */
382
+ int (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_JoystickRumble() */
383
+ int (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_JoystickRumbleTriggers() */
384
+ int (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_JoystickSetLED() */
385
+ int (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_JoystickSendEffect() */
386
+
387
+ } SDL_VirtualJoystickDesc;
388
+
389
+ /**
390
+ * \brief The current version of the SDL_VirtualJoystickDesc structure
391
+ */
392
+ #define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1
393
+
394
+ /**
395
+ * Attach a new virtual joystick with extended properties.
396
+ *
397
+ * \returns the joystick's device index, or -1 if an error occurred.
398
+ *
399
+ * \since This function is available since SDL 2.24.0.
400
+ */
401
+ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc);
402
+
333
403
  /**
334
404
  * Detach a virtual joystick.
335
405
  *
@@ -360,6 +430,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
360
430
  * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout,
361
431
  * SDL_WaitEvent.
362
432
  *
433
+ * Note that when sending trigger axes, you should scale the value to the full
434
+ * range of Sint16. For example, a trigger at rest would have the value of
435
+ * `SDL_JOYSTICK_AXIS_MIN`.
436
+ *
363
437
  * \param joystick the virtual joystick on which to set state.
364
438
  * \param axis the specific axis on the virtual joystick to set.
365
439
  * \param value the new value for the specified axis.
@@ -419,6 +493,19 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, in
419
493
  */
420
494
  extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick);
421
495
 
496
+ /**
497
+ * Get the implementation dependent path of a joystick.
498
+ *
499
+ * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
500
+ * \returns the path of the selected joystick. If no path can be found, this
501
+ * function returns NULL; call SDL_GetError() for more information.
502
+ *
503
+ * \since This function is available since SDL 2.24.0.
504
+ *
505
+ * \sa SDL_JoystickPathForIndex
506
+ */
507
+ extern DECLSPEC const char *SDLCALL SDL_JoystickPath(SDL_Joystick *joystick);
508
+
422
509
  /**
423
510
  * Get the player index of an opened joystick.
424
511
  *
@@ -436,7 +523,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick);
436
523
  * Set the player index of an opened joystick.
437
524
  *
438
525
  * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
439
- * \param player_index the player index to set.
526
+ * \param player_index Player index to assign to this joystick, or -1 to clear
527
+ * the player index and turn off player LEDs.
440
528
  *
441
529
  * \since This function is available since SDL 2.0.12.
442
530
  */
@@ -495,6 +583,19 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick);
495
583
  */
496
584
  extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick);
497
585
 
586
+ /**
587
+ * Get the firmware version of an opened joystick, if available.
588
+ *
589
+ * If the firmware version isn't available this function returns 0.
590
+ *
591
+ * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
592
+ * \returns the firmware version of the selected joystick, or 0 if
593
+ * unavailable.
594
+ *
595
+ * \since This function is available since SDL 2.24.0.
596
+ */
597
+ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetFirmwareVersion(SDL_Joystick *joystick);
598
+
498
599
  /**
499
600
  * Get the serial number of an opened joystick, if available.
500
601
  *
@@ -551,6 +652,25 @@ extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, ch
551
652
  */
552
653
  extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID);
553
654
 
655
+ /**
656
+ * Get the device information encoded in a SDL_JoystickGUID structure
657
+ *
658
+ * \param guid the SDL_JoystickGUID you wish to get info about
659
+ * \param vendor A pointer filled in with the device VID, or 0 if not
660
+ * available
661
+ * \param product A pointer filled in with the device PID, or 0 if not
662
+ * available
663
+ * \param version A pointer filled in with the device version, or 0 if not
664
+ * available
665
+ * \param crc16 A pointer filled in with a CRC used to distinguish different
666
+ * products with the same VID/PID, or 0 if not available
667
+ *
668
+ * \since This function is available since SDL 2.26.0.
669
+ *
670
+ * \sa SDL_JoystickGetDeviceGUID
671
+ */
672
+ extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version, Uint16 *crc16);
673
+
554
674
  /**
555
675
  * Get the status of a specified joystick.
556
676
  *
@@ -829,9 +949,9 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 lo
829
949
  * Each call to this function cancels any previous trigger rumble effect, and
830
950
  * calling it with 0 intensity stops any rumbling.
831
951
  *
832
- * Note that this function is for _trigger_ rumble; the first joystick to
833
- * support this was the PlayStation 5's DualShock 5 controller. If you want
834
- * the (more common) whole-controller rumble, use SDL_JoystickRumble()
952
+ * Note that this is rumbling of the _triggers_ and not the game controller as
953
+ * a whole. This is currently only supported on Xbox One controllers. If you
954
+ * want the (more common) whole-controller rumble, use SDL_JoystickRumble()
835
955
  * instead.
836
956
  *
837
957
  * \param joystick The joystick to vibrate
@@ -90,9 +90,21 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
90
90
  * \since This function is available since SDL 2.0.0.
91
91
  *
92
92
  * \sa SDL_PumpEvents
93
+ * \sa SDL_ResetKeyboard
93
94
  */
94
95
  extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
95
96
 
97
+ /**
98
+ * Clear the state of the keyboard
99
+ *
100
+ * This function will generate key up events for all pressed keys.
101
+ *
102
+ * \since This function is available since SDL 2.24.0.
103
+ *
104
+ * \sa SDL_GetKeyboardState
105
+ */
106
+ extern DECLSPEC void SDLCALL SDL_ResetKeyboard(void);
107
+
96
108
  /**
97
109
  * Get the current key modifier state for the keyboard.
98
110
  *
@@ -268,9 +280,34 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
268
280
  */
269
281
  extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
270
282
 
283
+ /**
284
+ * Dismiss the composition window/IME without disabling the subsystem.
285
+ *
286
+ * \since This function is available since SDL 2.0.22.
287
+ *
288
+ * \sa SDL_StartTextInput
289
+ * \sa SDL_StopTextInput
290
+ */
291
+ extern DECLSPEC void SDLCALL SDL_ClearComposition(void);
292
+
293
+ /**
294
+ * Returns if an IME Composite or Candidate window is currently shown.
295
+ *
296
+ * \since This function is available since SDL 2.0.22.
297
+ */
298
+ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void);
299
+
271
300
  /**
272
301
  * Set the rectangle used to type Unicode text inputs.
273
302
  *
303
+ * To start text input in a given location, this function is intended to be
304
+ * called before SDL_StartTextInput, although some platforms support moving
305
+ * the rectangle even while text input (and a composition) is active.
306
+ *
307
+ * Note: If you want to use the system native IME window, try setting hint
308
+ * **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you
309
+ * any feedback.
310
+ *
274
311
  * \param rect the SDL_Rect structure representing the rectangle to receive
275
312
  * text (ignored if NULL)
276
313
  *
@@ -278,7 +315,7 @@ extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
278
315
  *
279
316
  * \sa SDL_StartTextInput
280
317
  */
281
- extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
318
+ extern DECLSPEC void SDLCALL SDL_SetTextInputRect(const SDL_Rect *rect);
282
319
 
283
320
  /**
284
321
  * Check whether the platform has screen keyboard support.
@@ -318,7 +318,12 @@ typedef enum
318
318
  SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
319
319
 
320
320
  SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
321
- SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
321
+ SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD),
322
+
323
+ SDLK_SOFTLEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTLEFT),
324
+ SDLK_SOFTRIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT),
325
+ SDLK_CALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL),
326
+ SDLK_ENDCALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL)
322
327
  } SDL_KeyCode;
323
328
 
324
329
  /**
@@ -47,9 +47,9 @@ extern "C" {
47
47
 
48
48
 
49
49
  /**
50
- * \brief The maximum size of a log message
50
+ * \brief The maximum size of a log message prior to SDL 2.0.24
51
51
  *
52
- * Messages longer than the maximum size will be truncated
52
+ * As of 2.0.24 there is no limit to the length of SDL log messages.
53
53
  */
54
54
  #define SDL_MAX_LOG_MESSAGE 4096
55
55
 
@@ -51,6 +51,15 @@
51
51
  */
52
52
  #define SDL_MAIN_NEEDED
53
53
 
54
+ #elif defined(__GDK__)
55
+ /* On GDK, SDL provides a main function that initializes the game runtime.
56
+
57
+ Please note that #include'ing SDL_main.h is not enough to get a main()
58
+ function working. You must either link against SDL2main or, if not possible,
59
+ call the SDL_GDKRunApp function from your entry point.
60
+ */
61
+ #define SDL_MAIN_NEEDED
62
+
54
63
  #elif defined(__IPHONEOS__)
55
64
  /* On iOS SDL provides a main function that creates an application delegate
56
65
  and starts the iOS application run loop.
@@ -92,6 +101,22 @@
92
101
  */
93
102
  #define SDL_MAIN_AVAILABLE
94
103
 
104
+ #elif defined(__PS2__)
105
+ #define SDL_MAIN_AVAILABLE
106
+
107
+ #define SDL_PS2_SKIP_IOP_RESET() \
108
+ void reset_IOP(); \
109
+ void reset_IOP() {}
110
+
111
+ #elif defined(__3DS__)
112
+ /*
113
+ On N3DS, SDL provides a main function that sets up the screens
114
+ and storage.
115
+
116
+ If you provide this yourself, you may define SDL_MAIN_HANDLED
117
+ */
118
+ #define SDL_MAIN_AVAILABLE
119
+
95
120
  #endif
96
121
  #endif /* SDL_MAIN_HANDLED */
97
122
 
@@ -145,7 +170,7 @@ extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
145
170
  */
146
171
  extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
147
172
 
148
- #ifdef __WIN32__
173
+ #if defined(__WIN32__) || defined(__GDK__)
149
174
 
150
175
  /**
151
176
  * Register a win32 window class for SDL's use.
@@ -189,7 +214,7 @@ extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void
189
214
  */
190
215
  extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
191
216
 
192
- #endif /* __WIN32__ */
217
+ #endif /* defined(__WIN32__) || defined(__GDK__) */
193
218
 
194
219
 
195
220
  #ifdef __WINRT__
@@ -224,6 +249,21 @@ extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_fun
224
249
 
225
250
  #endif /* __IPHONEOS__ */
226
251
 
252
+ #ifdef __GDK__
253
+
254
+ /**
255
+ * Initialize and launch an SDL GDK application.
256
+ *
257
+ * \param mainFunction the SDL app's C-style main(), an SDL_main_func
258
+ * \param reserved reserved for future use; should be NULL
259
+ * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve
260
+ * more information on the failure.
261
+ *
262
+ * \since This function is available since SDL 2.24.0.
263
+ */
264
+ extern DECLSPEC int SDLCALL SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved);
265
+
266
+ #endif /* __GDK__ */
227
267
 
228
268
  #ifdef __cplusplus
229
269
  }
@@ -82,7 +82,7 @@ extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
82
82
  *
83
83
  * \since This function is available since SDL 2.0.14.
84
84
  *
85
- * \sa SDL_MetalCreateView
85
+ * \sa SDL_Metal_CreateView
86
86
  */
87
87
  extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
88
88
 
@@ -92,6 +92,7 @@ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
92
92
  *
93
93
  * \param window SDL_Window from which the drawable size should be queried
94
94
  * \param w Pointer to variable for storing the width in pixels, may be NULL
95
+ * \param h Pointer to variable for storing the height in pixels, may be NULL
95
96
  *
96
97
  * \since This function is available since SDL 2.0.14.
97
98
  *