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
@@ -102,6 +102,7 @@ typedef enum
102
102
  SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
103
103
  input language or keyboard layout change.
104
104
  */
105
+ SDL_TEXTEDITING_EXT, /**< Extended keyboard text editing (composition) */
105
106
 
106
107
  /* Mouse events */
107
108
  SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
@@ -117,6 +118,7 @@ typedef enum
117
118
  SDL_JOYBUTTONUP, /**< Joystick button released */
118
119
  SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
119
120
  SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
121
+ SDL_JOYBATTERYUPDATED, /**< Joystick battery level change */
120
122
 
121
123
  /* Game controller events */
122
124
  SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */
@@ -141,7 +143,7 @@ typedef enum
141
143
  SDL_MULTIGESTURE,
142
144
 
143
145
  /* Clipboard events */
144
- SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
146
+ SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard or primary selection changed */
145
147
 
146
148
  /* Drag and drop events */
147
149
  SDL_DROPFILE = 0x1000, /**< The system requests a file open */
@@ -243,6 +245,19 @@ typedef struct SDL_TextEditingEvent
243
245
  Sint32 length; /**< The length of selected editing text */
244
246
  } SDL_TextEditingEvent;
245
247
 
248
+ /**
249
+ * \brief Extended keyboard text editing event structure (event.editExt.*) when text would be
250
+ * truncated if stored in the text buffer SDL_TextEditingEvent
251
+ */
252
+ typedef struct SDL_TextEditingExtEvent
253
+ {
254
+ Uint32 type; /**< ::SDL_TEXTEDITING_EXT */
255
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
256
+ Uint32 windowID; /**< The window with keyboard focus, if any */
257
+ char* text; /**< The editing text, which should be freed with SDL_free(), and will not be NULL */
258
+ Sint32 start; /**< The start cursor of selected editing text */
259
+ Sint32 length; /**< The length of selected editing text */
260
+ } SDL_TextEditingExtEvent;
246
261
 
247
262
  #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
248
263
  /**
@@ -303,6 +318,8 @@ typedef struct SDL_MouseWheelEvent
303
318
  Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
304
319
  float preciseX; /**< The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) */
305
320
  float preciseY; /**< The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) */
321
+ Sint32 mouseX; /**< X coordinate, relative to window (added in 2.26.0) */
322
+ Sint32 mouseY; /**< Y coordinate, relative to window (added in 2.26.0) */
306
323
  } SDL_MouseWheelEvent;
307
324
 
308
325
  /**
@@ -381,6 +398,16 @@ typedef struct SDL_JoyDeviceEvent
381
398
  Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
382
399
  } SDL_JoyDeviceEvent;
383
400
 
401
+ /**
402
+ * \brief Joysick battery level change event structure (event.jbattery.*)
403
+ */
404
+ typedef struct SDL_JoyBatteryEvent
405
+ {
406
+ Uint32 type; /**< ::SDL_JOYBATTERYUPDATED */
407
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
408
+ SDL_JoystickID which; /**< The joystick instance id */
409
+ SDL_JoystickPowerLevel level; /**< The joystick battery level */
410
+ } SDL_JoyBatteryEvent;
384
411
 
385
412
  /**
386
413
  * \brief Game controller axis motion event structure (event.caxis.*)
@@ -449,6 +476,7 @@ typedef struct SDL_ControllerSensorEvent
449
476
  SDL_JoystickID which; /**< The joystick instance id */
450
477
  Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */
451
478
  float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */
479
+ Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */
452
480
  } SDL_ControllerSensorEvent;
453
481
 
454
482
  /**
@@ -540,6 +568,7 @@ typedef struct SDL_SensorEvent
540
568
  Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
541
569
  Sint32 which; /**< The instance ID of the sensor */
542
570
  float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
571
+ Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */
543
572
  } SDL_SensorEvent;
544
573
 
545
574
  /**
@@ -601,6 +630,7 @@ typedef union SDL_Event
601
630
  SDL_WindowEvent window; /**< Window event data */
602
631
  SDL_KeyboardEvent key; /**< Keyboard event data */
603
632
  SDL_TextEditingEvent edit; /**< Text editing event data */
633
+ SDL_TextEditingExtEvent editExt; /**< Extended text editing event data */
604
634
  SDL_TextInputEvent text; /**< Text input event data */
605
635
  SDL_MouseMotionEvent motion; /**< Mouse motion event data */
606
636
  SDL_MouseButtonEvent button; /**< Mouse button event data */
@@ -610,6 +640,7 @@ typedef union SDL_Event
610
640
  SDL_JoyHatEvent jhat; /**< Joystick hat event data */
611
641
  SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
612
642
  SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
643
+ SDL_JoyBatteryEvent jbattery; /**< Joystick battery event data */
613
644
  SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
614
645
  SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
615
646
  SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
@@ -60,6 +60,10 @@ extern "C" {
60
60
  * - `parent`: the containing directory of the bundle. For example:
61
61
  * `/Applications/SDLApp/`
62
62
  *
63
+ * **Nintendo 3DS Specific Functionality**: This function returns "romfs"
64
+ * directory of the application as it is uncommon to store resources outside
65
+ * the executable. As such it is not a writable directory.
66
+ *
63
67
  * The returned path is guaranteed to end with a path separator ('\' on
64
68
  * Windows, '/' on most other platforms).
65
69
  *
@@ -92,7 +96,7 @@ extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
92
96
  *
93
97
  * `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\`
94
98
  *
95
- * On Linux, the string might look like"
99
+ * On Linux, the string might look like:
96
100
  *
97
101
  * `/home/bob/.local/share/My Program Name/`
98
102
  *
@@ -69,7 +69,11 @@ typedef enum
69
69
  SDL_CONTROLLER_TYPE_VIRTUAL,
70
70
  SDL_CONTROLLER_TYPE_PS5,
71
71
  SDL_CONTROLLER_TYPE_AMAZON_LUNA,
72
- SDL_CONTROLLER_TYPE_GOOGLE_STADIA
72
+ SDL_CONTROLLER_TYPE_GOOGLE_STADIA,
73
+ SDL_CONTROLLER_TYPE_NVIDIA_SHIELD,
74
+ SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT,
75
+ SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT,
76
+ SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR
73
77
  } SDL_GameControllerType;
74
78
 
75
79
  typedef enum
@@ -289,6 +293,25 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
289
293
  */
290
294
  extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
291
295
 
296
+ /**
297
+ * Get the implementation dependent path for the game controller.
298
+ *
299
+ * This function can be called before any controllers are opened.
300
+ *
301
+ * `joystick_index` is the same as the `device_index` passed to
302
+ * SDL_JoystickOpen().
303
+ *
304
+ * \param joystick_index the device_index of a device, from zero to
305
+ * SDL_NumJoysticks()-1
306
+ * \returns the implementation-dependent path for the game controller, or NULL
307
+ * if there is no path or the index is invalid.
308
+ *
309
+ * \since This function is available since SDL 2.24.0.
310
+ *
311
+ * \sa SDL_GameControllerPath
312
+ */
313
+ extern DECLSPEC const char *SDLCALL SDL_GameControllerPathForIndex(int joystick_index);
314
+
292
315
  /**
293
316
  * Get the type of a game controller.
294
317
  *
@@ -386,6 +409,23 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(in
386
409
  */
387
410
  extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
388
411
 
412
+ /**
413
+ * Get the implementation-dependent path for an opened game controller.
414
+ *
415
+ * This is the same path as returned by SDL_GameControllerNameForIndex(), but
416
+ * it takes a controller identifier instead of the (unstable) device index.
417
+ *
418
+ * \param gamecontroller a game controller identifier previously returned by
419
+ * SDL_GameControllerOpen()
420
+ * \returns the implementation dependent path for the game controller, or NULL
421
+ * if there is no path or the identifier passed is invalid.
422
+ *
423
+ * \since This function is available since SDL 2.24.0.
424
+ *
425
+ * \sa SDL_GameControllerPathForIndex
426
+ */
427
+ extern DECLSPEC const char *SDLCALL SDL_GameControllerPath(SDL_GameController *gamecontroller);
428
+
389
429
  /**
390
430
  * Get the type of this currently opened controller
391
431
  *
@@ -415,7 +455,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController
415
455
  * Set the player index of an opened game controller.
416
456
  *
417
457
  * \param gamecontroller the game controller object to adjust.
418
- * \param player_index Player index to assign to this controller.
458
+ * \param player_index Player index to assign to this controller, or -1 to
459
+ * clear the player index and turn off player LEDs.
419
460
  *
420
461
  * \since This function is available since SDL 2.0.12.
421
462
  */
@@ -457,6 +498,18 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *
457
498
  */
458
499
  extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller);
459
500
 
501
+ /**
502
+ * Get the firmware version of an opened controller, if available.
503
+ *
504
+ * If the firmware version isn't available this function returns 0.
505
+ *
506
+ * \param gamecontroller the game controller object to query.
507
+ * \return the controller firmware version, or zero if unavailable.
508
+ *
509
+ * \since This function is available since SDL 2.24.0.
510
+ */
511
+ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller);
512
+
460
513
  /**
461
514
  * Get the serial number of an opened controller, if available.
462
515
  *
@@ -701,7 +754,7 @@ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFrom
701
754
  * The caller should not SDL_free() the returned string.
702
755
  *
703
756
  * \param button an enum value for a given SDL_GameControllerButton
704
- * \returns a string for the given button, or NULL if an invalid axis is
757
+ * \returns a string for the given button, or NULL if an invalid button is
705
758
  * specified. The string returned is of the format used by
706
759
  * SDL_GameController mapping strings.
707
760
  *
@@ -842,6 +895,25 @@ extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameContro
842
895
  */
843
896
  extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values);
844
897
 
898
+ /**
899
+ * Get the current state of a game controller sensor with the timestamp of the
900
+ * last update.
901
+ *
902
+ * The number of values and interpretation of the data is sensor dependent.
903
+ * See SDL_sensor.h for the details for each type of sensor.
904
+ *
905
+ * \param gamecontroller The controller to query
906
+ * \param type The type of sensor to query
907
+ * \param timestamp A pointer filled with the timestamp in microseconds of the
908
+ * current sensor reading if available, or 0 if not
909
+ * \param data A pointer filled with the current sensor state
910
+ * \param num_values The number of values to write to data
911
+ * \return 0 or -1 if an error occurred.
912
+ *
913
+ * \since This function is available since SDL 2.26.0.
914
+ */
915
+ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller, SDL_SensorType type, Uint64 *timestamp, float *data, int num_values);
916
+
845
917
  /**
846
918
  * Start a rumble effect on a game controller.
847
919
  *
@@ -869,8 +941,9 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecon
869
941
  * calling it with 0 intensity stops any rumbling.
870
942
  *
871
943
  * Note that this is rumbling of the _triggers_ and not the game controller as
872
- * a whole. The first controller to offer this feature was the PlayStation 5's
873
- * DualShock 5.
944
+ * a whole. This is currently only supported on Xbox One controllers. If you
945
+ * want the (more common) whole-controller rumble, use
946
+ * SDL_GameControllerRumble() instead.
874
947
  *
875
948
  * \param gamecontroller The controller to vibrate
876
949
  * \param left_rumble The intensity of the left trigger rumble motor, from 0
@@ -0,0 +1,100 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+ /**
23
+ * \file SDL_guid.h
24
+ *
25
+ * Include file for handling ::SDL_GUID values.
26
+ */
27
+
28
+ #ifndef SDL_guid_h_
29
+ #define SDL_guid_h_
30
+
31
+ #include "SDL_stdinc.h"
32
+ #include "SDL_error.h"
33
+
34
+ #include "begin_code.h"
35
+ /* Set up for C function definitions, even when using C++ */
36
+ #ifdef __cplusplus
37
+ extern "C" {
38
+ #endif
39
+
40
+ /**
41
+ * An SDL_GUID is a 128-bit identifier for an input device that
42
+ * identifies that device across runs of SDL programs on the same
43
+ * platform. If the device is detached and then re-attached to a
44
+ * different port, or if the base system is rebooted, the device
45
+ * should still report the same GUID.
46
+ *
47
+ * GUIDs are as precise as possible but are not guaranteed to
48
+ * distinguish physically distinct but equivalent devices. For
49
+ * example, two game controllers from the same vendor with the same
50
+ * product ID and revision may have the same GUID.
51
+ *
52
+ * GUIDs may be platform-dependent (i.e., the same device may report
53
+ * different GUIDs on different operating systems).
54
+ */
55
+ typedef struct {
56
+ Uint8 data[16];
57
+ } SDL_GUID;
58
+
59
+ /* Function prototypes */
60
+
61
+ /**
62
+ * Get an ASCII string representation for a given ::SDL_GUID.
63
+ *
64
+ * You should supply at least 33 bytes for pszGUID.
65
+ *
66
+ * \param guid the ::SDL_GUID you wish to convert to string
67
+ * \param pszGUID buffer in which to write the ASCII string
68
+ * \param cbGUID the size of pszGUID
69
+ *
70
+ * \since This function is available since SDL 2.24.0.
71
+ *
72
+ * \sa SDL_GUIDFromString
73
+ */
74
+ extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
75
+
76
+ /**
77
+ * Convert a GUID string into a ::SDL_GUID structure.
78
+ *
79
+ * Performs no error checking. If this function is given a string containing
80
+ * an invalid GUID, the function will silently succeed, but the GUID generated
81
+ * will not be useful.
82
+ *
83
+ * \param pchGUID string containing an ASCII representation of a GUID
84
+ * \returns a ::SDL_GUID structure.
85
+ *
86
+ * \since This function is available since SDL 2.24.0.
87
+ *
88
+ * \sa SDL_GUIDToString
89
+ */
90
+ extern DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID);
91
+
92
+ /* Ends C function definitions when using C++ */
93
+ #ifdef __cplusplus
94
+ }
95
+ #endif
96
+ #include "close_code.h"
97
+
98
+ #endif /* SDL_guid_h_ */
99
+
100
+ /* vi: set ts=4 sw=4 expandtab: */