gosu 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) 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 +19 -11
  140. data/include/Gosu/Font.hpp +40 -44
  141. data/include/Gosu/Graphics.hpp +58 -71
  142. data/include/Gosu/GraphicsBase.hpp +26 -33
  143. data/include/Gosu/Image.hpp +56 -62
  144. data/include/Gosu/ImageData.hpp +23 -27
  145. data/include/Gosu/Inspection.hpp +1 -4
  146. data/include/Gosu/TextInput.hpp +34 -40
  147. data/include/Gosu/Version.hpp +1 -1
  148. data/include/Gosu/Window.hpp +71 -70
  149. data/lib/SDL2.dll +0 -0
  150. data/lib/gosu/compat.rb +24 -37
  151. data/lib/gosu.rb +2 -2
  152. data/lib64/SDL2.dll +0 -0
  153. data/src/Audio.cpp +86 -86
  154. data/src/AudioFile.hpp +6 -6
  155. data/src/AudioFileAudioToolbox.cpp +1 -1
  156. data/src/AudioFileSDLSound.cpp +1 -1
  157. data/src/AudioImpl.hpp +5 -5
  158. data/src/BitmapIO.cpp +0 -20
  159. data/src/BlockAllocator.cpp +2 -1
  160. data/src/Channel.cpp +22 -20
  161. data/src/Color.cpp +12 -9
  162. data/src/EmptyImageData.hpp +15 -17
  163. data/src/FileUnix.cpp +1 -1
  164. data/src/FileWin.cpp +1 -1
  165. data/src/Font.cpp +48 -53
  166. data/src/Graphics.cpp +135 -143
  167. data/src/Image.cpp +41 -42
  168. data/src/Input.cpp +1 -1
  169. data/src/InputUIKit.cpp +1 -1
  170. data/src/LargeImageData.cpp +108 -101
  171. data/src/LargeImageData.hpp +17 -15
  172. data/src/Log.hpp +6 -6
  173. data/src/Macro.cpp +35 -37
  174. data/src/Macro.hpp +11 -11
  175. data/src/Math.cpp +8 -1
  176. data/src/Resolution.cpp +12 -7
  177. data/src/RubyGosu.cxx +5 -5
  178. data/src/TexChunk.cpp +50 -41
  179. data/src/TexChunk.hpp +22 -22
  180. data/src/Text.cpp +37 -37
  181. data/src/TextBuilder.cpp +60 -57
  182. data/src/TextBuilder.hpp +20 -20
  183. data/src/TextInput.cpp +127 -135
  184. data/src/TrueTypeFont.cpp +107 -107
  185. data/src/TrueTypeFont.hpp +39 -38
  186. data/src/TrueTypeFontApple.cpp +19 -22
  187. data/src/TrueTypeFontUnix.cpp +21 -26
  188. data/src/TrueTypeFontWin.cpp +30 -30
  189. data/src/Window.cpp +95 -86
  190. data/src/WindowUIKit.cpp +46 -49
  191. metadata +7 -17
  192. data/dependencies/SDL/include/SDL_config_os2.h +0 -188
  193. data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
  194. data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
  195. data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
  196. data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
  197. data/dependencies/al_soft/AL/alext.h +0 -585
  198. data/dependencies/al_soft/AL/efx-creative.h +0 -3
  199. data/dependencies/al_soft/AL/efx-presets.h +0 -402
  200. data/dependencies/al_soft/AL/efx.h +0 -762
  201. data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
  202. data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
  203. data/lib/OpenAL32.dll +0 -0
  204. data/lib64/OpenAL32.dll +0 -0
@@ -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
@@ -67,7 +67,9 @@ typedef enum
67
67
  SDL_CONTROLLER_TYPE_PS4,
68
68
  SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,
69
69
  SDL_CONTROLLER_TYPE_VIRTUAL,
70
- SDL_CONTROLLER_TYPE_PS5
70
+ SDL_CONTROLLER_TYPE_PS5,
71
+ SDL_CONTROLLER_TYPE_AMAZON_LUNA,
72
+ SDL_CONTROLLER_TYPE_GOOGLE_STADIA
71
73
  } SDL_GameControllerType;
72
74
 
73
75
  typedef enum
@@ -99,6 +101,8 @@ typedef struct SDL_GameControllerButtonBind
99
101
 
100
102
  /**
101
103
  * To count the number of game controllers in the system for the following:
104
+ *
105
+ * ```c
102
106
  * int nJoysticks = SDL_NumJoysticks();
103
107
  * int nGameControllers = 0;
104
108
  * for (int i = 0; i < nJoysticks; i++) {
@@ -106,6 +110,7 @@ typedef struct SDL_GameControllerButtonBind
106
110
  * nGameControllers++;
107
111
  * }
108
112
  * }
113
+ * ```
109
114
  *
110
115
  * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
111
116
  * guid,name,mappings
@@ -119,17 +124,39 @@ typedef struct SDL_GameControllerButtonBind
119
124
  * Buttons can be used as a controller axis and vice versa.
120
125
  *
121
126
  * This string shows an example of a valid mapping for a controller
122
- * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
123
127
  *
128
+ * ```c
129
+ * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
130
+ * ```
124
131
  */
125
132
 
126
133
  /**
127
- * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform()
128
- * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
134
+ * Load a set of Game Controller mappings from a seekable SDL data stream.
135
+ *
136
+ * You can call this function several times, if needed, to load different
137
+ * database files.
138
+ *
139
+ * If a new mapping is loaded for an already known controller GUID, the later
140
+ * version will overwrite the one currently loaded.
141
+ *
142
+ * Mappings not belonging to the current platform or with no platform field
143
+ * specified will be ignored (i.e. mappings for Linux will be ignored in
144
+ * Windows, etc).
145
+ *
146
+ * This function will load the text database entirely in memory before
147
+ * processing it, so take this into consideration if you are in a memory
148
+ * constrained environment.
129
149
  *
130
- * If \c freerw is non-zero, the stream will be closed after being read.
131
- *
132
- * \return number of mappings added, -1 on error
150
+ * \param rw the data stream for the mappings to be added
151
+ * \param freerw non-zero to close the stream after being read
152
+ * \returns the number of mappings added or -1 on error; call SDL_GetError()
153
+ * for more information.
154
+ *
155
+ * \since This function is available since SDL 2.0.2.
156
+ *
157
+ * \sa SDL_GameControllerAddMapping
158
+ * \sa SDL_GameControllerAddMappingsFromFile
159
+ * \sa SDL_GameControllerMappingForGUID
133
160
  */
134
161
  extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
135
162
 
@@ -141,161 +168,372 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw,
141
168
  #define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
142
169
 
143
170
  /**
144
- * Add or update an existing mapping configuration
171
+ * Add support for controllers that SDL is unaware of or to cause an existing
172
+ * controller to have a different binding.
173
+ *
174
+ * The mapping string has the format "GUID,name,mapping", where GUID is the
175
+ * string value from SDL_JoystickGetGUIDString(), name is the human readable
176
+ * string for the device and mappings are controller mappings to joystick
177
+ * ones. Under Windows there is a reserved GUID of "xinput" that covers all
178
+ * XInput devices. The mapping format for joystick is: {| |bX |a joystick
179
+ * button, index X |- |hX.Y |hat X with value Y |- |aX |axis X of the joystick
180
+ * |} Buttons can be used as a controller axes and vice versa.
181
+ *
182
+ * This string shows an example of a valid mapping for a controller:
183
+ *
184
+ * ```c
185
+ * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"
186
+ * ```
145
187
  *
146
- * \return 1 if mapping is added, 0 if updated, -1 on error
188
+ * \param mappingString the mapping string
189
+ * \returns 1 if a new mapping is added, 0 if an existing mapping is updated,
190
+ * -1 on error; call SDL_GetError() for more information.
191
+ *
192
+ * \since This function is available since SDL 2.0.0.
193
+ *
194
+ * \sa SDL_GameControllerMapping
195
+ * \sa SDL_GameControllerMappingForGUID
147
196
  */
148
197
  extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
149
198
 
150
199
  /**
151
- * Get the number of mappings installed
200
+ * Get the number of mappings installed.
201
+ *
202
+ * \returns the number of mappings.
152
203
  *
153
- * \return the number of mappings
204
+ * \since This function is available since SDL 2.0.6.
154
205
  */
155
206
  extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
156
207
 
157
208
  /**
158
- * Get the mapping at a particular index.
209
+ * Get the mapping at a particular index.
159
210
  *
160
- * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range.
211
+ * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
212
+ * the index is out of range.
213
+ *
214
+ * \since This function is available since SDL 2.0.6.
161
215
  */
162
216
  extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
163
217
 
164
218
  /**
165
- * Get a mapping string for a GUID
219
+ * Get the game controller mapping string for a given GUID.
220
+ *
221
+ * The returned string must be freed with SDL_free().
166
222
  *
167
- * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
223
+ * \param guid a structure containing the GUID for which a mapping is desired
224
+ * \returns a mapping string or NULL on error; call SDL_GetError() for more
225
+ * information.
226
+ *
227
+ * \since This function is available since SDL 2.0.0.
228
+ *
229
+ * \sa SDL_JoystickGetDeviceGUID
230
+ * \sa SDL_JoystickGetGUID
168
231
  */
169
232
  extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid);
170
233
 
171
234
  /**
172
- * Get a mapping string for an open GameController
235
+ * Get the current mapping of a Game Controller.
236
+ *
237
+ * The returned string must be freed with SDL_free().
238
+ *
239
+ * Details about mappings are discussed with SDL_GameControllerAddMapping().
240
+ *
241
+ * \param gamecontroller the game controller you want to get the current
242
+ * mapping for
243
+ * \returns a string that has the controller's mapping or NULL if no mapping
244
+ * is available; call SDL_GetError() for more information.
173
245
  *
174
- * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
246
+ * \since This function is available since SDL 2.0.0.
247
+ *
248
+ * \sa SDL_GameControllerAddMapping
249
+ * \sa SDL_GameControllerMappingForGUID
175
250
  */
176
251
  extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController *gamecontroller);
177
252
 
178
253
  /**
179
- * Is the joystick on this index supported by the game controller interface?
254
+ * Check if the given joystick is supported by the game controller interface.
255
+ *
256
+ * `joystick_index` is the same as the `device_index` passed to
257
+ * SDL_JoystickOpen().
258
+ *
259
+ * \param joystick_index the device_index of a device, up to
260
+ * SDL_NumJoysticks()
261
+ * \returns SDL_TRUE if the given joystick is supported by the game controller
262
+ * interface, SDL_FALSE if it isn't or it's an invalid index.
263
+ *
264
+ * \since This function is available since SDL 2.0.0.
265
+ *
266
+ * \sa SDL_GameControllerNameForIndex
267
+ * \sa SDL_GameControllerOpen
180
268
  */
181
269
  extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
182
270
 
183
271
  /**
184
- * Get the implementation dependent name of a game controller.
185
- * This can be called before any controllers are opened.
186
- * If no name can be found, this function returns NULL.
272
+ * Get the implementation dependent name for the game controller.
273
+ *
274
+ * This function can be called before any controllers are opened.
275
+ *
276
+ * `joystick_index` is the same as the `device_index` passed to
277
+ * SDL_JoystickOpen().
278
+ *
279
+ * \param joystick_index the device_index of a device, from zero to
280
+ * SDL_NumJoysticks()-1
281
+ * \returns the implementation-dependent name for the game controller, or NULL
282
+ * if there is no name or the index is invalid.
283
+ *
284
+ * \since This function is available since SDL 2.0.0.
285
+ *
286
+ * \sa SDL_GameControllerName
287
+ * \sa SDL_GameControllerOpen
288
+ * \sa SDL_IsGameController
187
289
  */
188
290
  extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
189
291
 
190
292
  /**
191
- * Get the type of a game controller.
192
- * This can be called before any controllers are opened.
293
+ * Get the type of a game controller.
294
+ *
295
+ * This can be called before any controllers are opened.
296
+ *
297
+ * \param joystick_index the device_index of a device, from zero to
298
+ * SDL_NumJoysticks()-1
299
+ * \returns the controller type.
300
+ *
301
+ * \since This function is available since SDL 2.0.12.
193
302
  */
194
303
  extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
195
304
 
196
305
  /**
197
- * Get the mapping of a game controller.
198
- * This can be called before any controllers are opened.
306
+ * Get the mapping of a game controller.
307
+ *
308
+ * This can be called before any controllers are opened.
309
+ *
310
+ * \param joystick_index the device_index of a device, from zero to
311
+ * SDL_NumJoysticks()-1
312
+ * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
313
+ * no mapping is available.
199
314
  *
200
- * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available
315
+ * \since This function is available since SDL 2.0.9.
201
316
  */
202
317
  extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index);
203
318
 
204
319
  /**
205
- * Open a game controller for use.
206
- * The index passed as an argument refers to the N'th game controller on the system.
207
- * This index is not the value which will identify this controller in future
208
- * controller events. The joystick's instance id (::SDL_JoystickID) will be
209
- * used there instead.
320
+ * Open a game controller for use.
210
321
  *
211
- * \return A controller identifier, or NULL if an error occurred.
322
+ * `joystick_index` is the same as the `device_index` passed to
323
+ * SDL_JoystickOpen().
324
+ *
325
+ * The index passed as an argument refers to the N'th game controller on the
326
+ * system. This index is not the value which will identify this controller in
327
+ * future controller events. The joystick's instance id (SDL_JoystickID) will
328
+ * be used there instead.
329
+ *
330
+ * \param joystick_index the device_index of a device, up to
331
+ * SDL_NumJoysticks()
332
+ * \returns a gamecontroller identifier or NULL if an error occurred; call
333
+ * SDL_GetError() for more information.
334
+ *
335
+ * \since This function is available since SDL 2.0.0.
336
+ *
337
+ * \sa SDL_GameControllerClose
338
+ * \sa SDL_GameControllerNameForIndex
339
+ * \sa SDL_IsGameController
212
340
  */
213
341
  extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
214
342
 
215
343
  /**
216
- * Return the SDL_GameController associated with an instance id.
344
+ * Get the SDL_GameController associated with an instance id.
345
+ *
346
+ * \param joyid the instance id to get the SDL_GameController for
347
+ * \returns an SDL_GameController on success or NULL on failure; call
348
+ * SDL_GetError() for more information.
349
+ *
350
+ * \since This function is available since SDL 2.0.4.
217
351
  */
218
352
  extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
219
353
 
220
354
  /**
221
- * Return the SDL_GameController associated with a player index.
355
+ * Get the SDL_GameController associated with a player index.
356
+ *
357
+ * Please note that the player index is _not_ the device index, nor is it the
358
+ * instance id!
359
+ *
360
+ * \param player_index the player index, which is not the device index or the
361
+ * instance id!
362
+ * \returns the SDL_GameController associated with a player index.
363
+ *
364
+ * \since This function is available since SDL 2.0.12.
365
+ *
366
+ * \sa SDL_GameControllerGetPlayerIndex
367
+ * \sa SDL_GameControllerSetPlayerIndex
222
368
  */
223
369
  extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index);
224
370
 
225
371
  /**
226
- * Return the name for this currently opened controller
372
+ * Get the implementation-dependent name for an opened game controller.
373
+ *
374
+ * This is the same name as returned by SDL_GameControllerNameForIndex(), but
375
+ * it takes a controller identifier instead of the (unstable) device index.
376
+ *
377
+ * \param gamecontroller a game controller identifier previously returned by
378
+ * SDL_GameControllerOpen()
379
+ * \returns the implementation dependent name for the game controller, or NULL
380
+ * if there is no name or the identifier passed is invalid.
381
+ *
382
+ * \since This function is available since SDL 2.0.0.
383
+ *
384
+ * \sa SDL_GameControllerNameForIndex
385
+ * \sa SDL_GameControllerOpen
227
386
  */
228
387
  extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
229
388
 
230
389
  /**
231
- * Return the type of this currently opened controller
390
+ * Get the type of this currently opened controller
391
+ *
392
+ * This is the same name as returned by SDL_GameControllerTypeForIndex(), but
393
+ * it takes a controller identifier instead of the (unstable) device index.
394
+ *
395
+ * \param gamecontroller the game controller object to query.
396
+ * \returns the controller type.
397
+ *
398
+ * \since This function is available since SDL 2.0.12.
232
399
  */
233
400
  extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
234
401
 
235
402
  /**
236
- * Get the player index of an opened game controller, or -1 if it's not available
403
+ * Get the player index of an opened game controller.
404
+ *
405
+ * For XInput controllers this returns the XInput user index.
237
406
  *
238
- * For XInput controllers this returns the XInput user index.
407
+ * \param gamecontroller the game controller object to query.
408
+ * \returns the player index for controller, or -1 if it's not available.
409
+ *
410
+ * \since This function is available since SDL 2.0.9.
239
411
  */
240
412
  extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
241
413
 
242
414
  /**
243
- * Set the player index of an opened game controller
415
+ * Set the player index of an opened game controller.
416
+ *
417
+ * \param gamecontroller the game controller object to adjust.
418
+ * \param player_index Player index to assign to this controller.
419
+ *
420
+ * \since This function is available since SDL 2.0.12.
244
421
  */
245
422
  extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index);
246
423
 
247
424
  /**
248
- * Get the USB vendor ID of an opened controller, if available.
249
- * If the vendor ID isn't available this function returns 0.
425
+ * Get the USB vendor ID of an opened controller, if available.
426
+ *
427
+ * If the vendor ID isn't available this function returns 0.
428
+ *
429
+ * \param gamecontroller the game controller object to query.
430
+ * \return the USB vendor ID, or zero if unavailable.
431
+ *
432
+ * \since This function is available since SDL 2.0.6.
250
433
  */
251
434
  extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *gamecontroller);
252
435
 
253
436
  /**
254
- * Get the USB product ID of an opened controller, if available.
255
- * If the product ID isn't available this function returns 0.
437
+ * Get the USB product ID of an opened controller, if available.
438
+ *
439
+ * If the product ID isn't available this function returns 0.
440
+ *
441
+ * \param gamecontroller the game controller object to query.
442
+ * \return the USB product ID, or zero if unavailable.
443
+ *
444
+ * \since This function is available since SDL 2.0.6.
256
445
  */
257
446
  extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *gamecontroller);
258
447
 
259
448
  /**
260
- * Get the product version of an opened controller, if available.
261
- * If the product version isn't available this function returns 0.
449
+ * Get the product version of an opened controller, if available.
450
+ *
451
+ * If the product version isn't available this function returns 0.
452
+ *
453
+ * \param gamecontroller the game controller object to query.
454
+ * \return the USB product version, or zero if unavailable.
455
+ *
456
+ * \since This function is available since SDL 2.0.6.
262
457
  */
263
458
  extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller);
264
459
 
265
460
  /**
266
- * Get the serial number of an opened controller, if available.
267
- *
268
- * Returns the serial number of the controller, or NULL if it is not available.
461
+ * Get the serial number of an opened controller, if available.
462
+ *
463
+ * Returns the serial number of the controller, or NULL if it is not
464
+ * available.
465
+ *
466
+ * \param gamecontroller the game controller object to query.
467
+ * \return the serial number, or NULL if unavailable.
468
+ *
469
+ * \since This function is available since SDL 2.0.14.
269
470
  */
270
471
  extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller);
271
472
 
272
473
  /**
273
- * Returns SDL_TRUE if the controller has been opened and currently connected,
274
- * or SDL_FALSE if it has not.
474
+ * Check if a controller has been opened and is currently connected.
475
+ *
476
+ * \param gamecontroller a game controller identifier previously returned by
477
+ * SDL_GameControllerOpen()
478
+ * \returns SDL_TRUE if the controller has been opened and is currently
479
+ * connected, or SDL_FALSE if not.
480
+ *
481
+ * \since This function is available since SDL 2.0.0.
482
+ *
483
+ * \sa SDL_GameControllerClose
484
+ * \sa SDL_GameControllerOpen
275
485
  */
276
486
  extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller);
277
487
 
278
488
  /**
279
- * Get the underlying joystick object used by a controller
489
+ * Get the Joystick ID from a Game Controller.
490
+ *
491
+ * This function will give you a SDL_Joystick object, which allows you to use
492
+ * the SDL_Joystick functions with a SDL_GameController object. This would be
493
+ * useful for getting a joystick's position at any given time, even if it
494
+ * hasn't moved (moving it would produce an event, which would have the axis'
495
+ * value).
496
+ *
497
+ * The pointer returned is owned by the SDL_GameController. You should not
498
+ * call SDL_JoystickClose() on it, for example, since doing so will likely
499
+ * cause SDL to crash.
500
+ *
501
+ * \param gamecontroller the game controller object that you want to get a
502
+ * joystick from
503
+ * \returns a SDL_Joystick object; call SDL_GetError() for more information.
504
+ *
505
+ * \since This function is available since SDL 2.0.0.
280
506
  */
281
507
  extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
282
508
 
283
509
  /**
284
- * Enable/disable controller event polling.
510
+ * Query or change current state of Game Controller events.
285
511
  *
286
- * If controller events are disabled, you must call SDL_GameControllerUpdate()
287
- * yourself and check the state of the controller when you want controller
288
- * information.
512
+ * If controller events are disabled, you must call SDL_GameControllerUpdate()
513
+ * yourself and check the state of the controller when you want controller
514
+ * information.
289
515
  *
290
- * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
516
+ * Any number can be passed to SDL_GameControllerEventState(), but only -1, 0,
517
+ * and 1 will have any effect. Other numbers will just be returned.
518
+ *
519
+ * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`
520
+ * \returns the same value passed to the function, with exception to -1
521
+ * (SDL_QUERY), which will return the current state.
522
+ *
523
+ * \since This function is available since SDL 2.0.0.
524
+ *
525
+ * \sa SDL_JoystickEventState
291
526
  */
292
527
  extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
293
528
 
294
529
  /**
295
- * Update the current state of the open game controllers.
530
+ * Manually pump game controller updates if not using the loop.
531
+ *
532
+ * This function is called automatically by the event loop if events are
533
+ * enabled. Under such circumstances, it will not be necessary to call this
534
+ * function.
296
535
  *
297
- * This is called automatically by the event loop if any game controller
298
- * events are enabled.
536
+ * \since This function is available since SDL 2.0.0.
299
537
  */
300
538
  extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
301
539
 
@@ -322,35 +560,91 @@ typedef enum
322
560
  } SDL_GameControllerAxis;
323
561
 
324
562
  /**
325
- * turn this string into a axis mapping
563
+ * Convert a string into SDL_GameControllerAxis enum.
564
+ *
565
+ * This function is called internally to translate SDL_GameController mapping
566
+ * strings for the underlying joystick device into the consistent
567
+ * SDL_GameController mapping. You do not normally need to call this function
568
+ * unless you are parsing SDL_GameController mappings in your own code.
569
+ *
570
+ * Note specially that "righttrigger" and "lefttrigger" map to
571
+ * `SDL_CONTROLLER_AXIS_TRIGGERRIGHT` and `SDL_CONTROLLER_AXIS_TRIGGERLEFT`,
572
+ * respectively.
573
+ *
574
+ * \param str string representing a SDL_GameController axis
575
+ * \returns the SDL_GameControllerAxis enum corresponding to the input string,
576
+ * or `SDL_CONTROLLER_AXIS_INVALID` if no match was found.
577
+ *
578
+ * \since This function is available since SDL 2.0.0.
579
+ *
580
+ * \sa SDL_GameControllerGetStringForAxis
326
581
  */
327
- extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
582
+ extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *str);
328
583
 
329
584
  /**
330
- * turn this axis enum into a string mapping
585
+ * Convert from an SDL_GameControllerAxis enum to a string.
586
+ *
587
+ * The caller should not SDL_free() the returned string.
588
+ *
589
+ * \param axis an enum value for a given SDL_GameControllerAxis
590
+ * \returns a string for the given axis, or NULL if an invalid axis is
591
+ * specified. The string returned is of the format used by
592
+ * SDL_GameController mapping strings.
593
+ *
594
+ * \since This function is available since SDL 2.0.0.
595
+ *
596
+ * \sa SDL_GameControllerGetAxisFromString
331
597
  */
332
598
  extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
333
599
 
334
600
  /**
335
- * Get the SDL joystick layer binding for this controller button mapping
601
+ * Get the SDL joystick layer binding for a controller axis mapping.
602
+ *
603
+ * \param gamecontroller a game controller
604
+ * \param axis an axis enum value (one of the SDL_GameControllerAxis values)
605
+ * \returns a SDL_GameControllerButtonBind describing the bind. On failure
606
+ * (like the given Controller axis doesn't exist on the device), its
607
+ * `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`.
608
+ *
609
+ * \since This function is available since SDL 2.0.0.
610
+ *
611
+ * \sa SDL_GameControllerGetBindForButton
336
612
  */
337
613
  extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
338
614
  SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
339
615
  SDL_GameControllerAxis axis);
340
616
 
341
617
  /**
342
- * Return whether a game controller has a given axis
618
+ * Query whether a game controller has a given axis.
619
+ *
620
+ * This merely reports whether the controller's mapping defined this axis, as
621
+ * that is all the information SDL has about the physical device.
622
+ *
623
+ * \param gamecontroller a game controller
624
+ * \param axis an axis enum value (an SDL_GameControllerAxis value)
625
+ * \returns SDL_TRUE if the controller has this axis, SDL_FALSE otherwise.
626
+ *
627
+ * \since This function is available since SDL 2.0.14.
343
628
  */
344
629
  extern DECLSPEC SDL_bool SDLCALL
345
630
  SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
346
631
 
347
632
  /**
348
- * Get the current state of an axis control on a game controller.
633
+ * Get the current state of an axis control on a game controller.
349
634
  *
350
- * The state is a value ranging from -32768 to 32767 (except for the triggers,
351
- * which range from 0 to 32767).
635
+ * The axis indices start at index 0.
352
636
  *
353
- * The axis indices start at index 0.
637
+ * The state is a value ranging from -32768 to 32767. Triggers, however, range
638
+ * from 0 to 32767 (they never return a negative value).
639
+ *
640
+ * \param gamecontroller a game controller
641
+ * \param axis an axis index (one of the SDL_GameControllerAxis values)
642
+ * \returns axis state (including 0) on success or 0 (also) on failure; call
643
+ * SDL_GetError() for more information.
644
+ *
645
+ * \since This function is available since SDL 2.0.0.
646
+ *
647
+ * \sa SDL_GameControllerGetButton
354
648
  */
355
649
  extern DECLSPEC Sint16 SDLCALL
356
650
  SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
@@ -376,7 +670,7 @@ typedef enum
376
670
  SDL_CONTROLLER_BUTTON_DPAD_DOWN,
377
671
  SDL_CONTROLLER_BUTTON_DPAD_LEFT,
378
672
  SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
379
- SDL_CONTROLLER_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button */
673
+ SDL_CONTROLLER_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button */
380
674
  SDL_CONTROLLER_BUTTON_PADDLE1, /* Xbox Elite paddle P1 */
381
675
  SDL_CONTROLLER_BUTTON_PADDLE2, /* Xbox Elite paddle P3 */
382
676
  SDL_CONTROLLER_BUTTON_PADDLE3, /* Xbox Elite paddle P2 */
@@ -386,149 +680,315 @@ typedef enum
386
680
  } SDL_GameControllerButton;
387
681
 
388
682
  /**
389
- * turn this string into a button mapping
683
+ * Convert a string into an SDL_GameControllerButton enum.
684
+ *
685
+ * This function is called internally to translate SDL_GameController mapping
686
+ * strings for the underlying joystick device into the consistent
687
+ * SDL_GameController mapping. You do not normally need to call this function
688
+ * unless you are parsing SDL_GameController mappings in your own code.
689
+ *
690
+ * \param str string representing a SDL_GameController axis
691
+ * \returns the SDL_GameControllerButton enum corresponding to the input
692
+ * string, or `SDL_CONTROLLER_AXIS_INVALID` if no match was found.
693
+ *
694
+ * \since This function is available since SDL 2.0.0.
390
695
  */
391
- extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
696
+ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *str);
392
697
 
393
698
  /**
394
- * turn this button enum into a string mapping
699
+ * Convert from an SDL_GameControllerButton enum to a string.
700
+ *
701
+ * The caller should not SDL_free() the returned string.
702
+ *
703
+ * \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
705
+ * specified. The string returned is of the format used by
706
+ * SDL_GameController mapping strings.
707
+ *
708
+ * \since This function is available since SDL 2.0.0.
709
+ *
710
+ * \sa SDL_GameControllerGetButtonFromString
395
711
  */
396
712
  extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
397
713
 
398
714
  /**
399
- * Get the SDL joystick layer binding for this controller button mapping
715
+ * Get the SDL joystick layer binding for a controller button mapping.
716
+ *
717
+ * \param gamecontroller a game controller
718
+ * \param button an button enum value (an SDL_GameControllerButton value)
719
+ * \returns a SDL_GameControllerButtonBind describing the bind. On failure
720
+ * (like the given Controller button doesn't exist on the device),
721
+ * its `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`.
722
+ *
723
+ * \since This function is available since SDL 2.0.0.
724
+ *
725
+ * \sa SDL_GameControllerGetBindForAxis
400
726
  */
401
727
  extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
402
728
  SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
403
729
  SDL_GameControllerButton button);
404
730
 
405
731
  /**
406
- * Return whether a game controller has a given button
732
+ * Query whether a game controller has a given button.
733
+ *
734
+ * This merely reports whether the controller's mapping defined this button,
735
+ * as that is all the information SDL has about the physical device.
736
+ *
737
+ * \param gamecontroller a game controller
738
+ * \param button a button enum value (an SDL_GameControllerButton value)
739
+ * \returns SDL_TRUE if the controller has this button, SDL_FALSE otherwise.
740
+ *
741
+ * \since This function is available since SDL 2.0.14.
407
742
  */
408
743
  extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController *gamecontroller,
409
744
  SDL_GameControllerButton button);
410
745
 
411
746
  /**
412
- * Get the current state of a button on a game controller.
747
+ * Get the current state of a button on a game controller.
748
+ *
749
+ * \param gamecontroller a game controller
750
+ * \param button a button index (one of the SDL_GameControllerButton values)
751
+ * \returns 1 for pressed state or 0 for not pressed state or error; call
752
+ * SDL_GetError() for more information.
753
+ *
754
+ * \since This function is available since SDL 2.0.0.
413
755
  *
414
- * The button indices start at index 0.
756
+ * \sa SDL_GameControllerGetAxis
415
757
  */
416
758
  extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
417
759
  SDL_GameControllerButton button);
418
760
 
419
761
  /**
420
- * Get the number of touchpads on a game controller.
762
+ * Get the number of touchpads on a game controller.
763
+ *
764
+ * \since This function is available since SDL 2.0.14.
421
765
  */
422
766
  extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpads(SDL_GameController *gamecontroller);
423
767
 
424
768
  /**
425
- * Get the number of supported simultaneous fingers on a touchpad on a game controller.
769
+ * Get the number of supported simultaneous fingers on a touchpad on a game
770
+ * controller.
771
+ *
772
+ * \since This function is available since SDL 2.0.14.
426
773
  */
427
774
  extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpadFingers(SDL_GameController *gamecontroller, int touchpad);
428
775
 
429
776
  /**
430
- * Get the current state of a finger on a touchpad on a game controller.
777
+ * Get the current state of a finger on a touchpad on a game controller.
778
+ *
779
+ * \since This function is available since SDL 2.0.14.
431
780
  */
432
781
  extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
433
782
 
434
783
  /**
435
- * Return whether a game controller has a particular sensor.
784
+ * Return whether a game controller has a particular sensor.
436
785
  *
437
- * \param gamecontroller The controller to query
438
- * \param type The type of sensor to query
786
+ * \param gamecontroller The controller to query
787
+ * \param type The type of sensor to query
788
+ * \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise.
439
789
  *
440
- * \return SDL_TRUE if the sensor exists, SDL_FALSE otherwise.
790
+ * \since This function is available since SDL 2.0.14.
441
791
  */
442
792
  extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController *gamecontroller, SDL_SensorType type);
443
793
 
444
794
  /**
445
- * Set whether data reporting for a game controller sensor is enabled
795
+ * Set whether data reporting for a game controller sensor is enabled.
446
796
  *
447
- * \param gamecontroller The controller to update
448
- * \param type The type of sensor to enable/disable
449
- * \param enabled Whether data reporting should be enabled
797
+ * \param gamecontroller The controller to update
798
+ * \param type The type of sensor to enable/disable
799
+ * \param enabled Whether data reporting should be enabled
800
+ * \returns 0 or -1 if an error occurred.
450
801
  *
451
- * \return 0 or -1 if an error occurred.
802
+ * \since This function is available since SDL 2.0.14.
452
803
  */
453
804
  extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type, SDL_bool enabled);
454
805
 
455
806
  /**
456
- * Query whether sensor data reporting is enabled for a game controller
807
+ * Query whether sensor data reporting is enabled for a game controller.
457
808
  *
458
- * \param gamecontroller The controller to query
459
- * \param type The type of sensor to query
809
+ * \param gamecontroller The controller to query
810
+ * \param type The type of sensor to query
811
+ * \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise.
460
812
  *
461
- * \return SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise.
813
+ * \since This function is available since SDL 2.0.14.
462
814
  */
463
815
  extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type);
464
816
 
465
817
  /**
466
- * Get the current state of a game controller sensor.
818
+ * Get the data rate (number of events per second) of a game controller
819
+ * sensor.
820
+ *
821
+ * \param gamecontroller The controller to query
822
+ * \param type The type of sensor to query
823
+ * \return the data rate, or 0.0f if the data rate is not available.
824
+ *
825
+ * \since This function is available since SDL 2.0.16.
826
+ */
827
+ extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameController *gamecontroller, SDL_SensorType type);
828
+
829
+ /**
830
+ * Get the current state of a game controller sensor.
467
831
  *
468
- * The number of values and interpretation of the data is sensor dependent.
469
- * See SDL_sensor.h for the details for each type of sensor.
832
+ * The number of values and interpretation of the data is sensor dependent.
833
+ * See SDL_sensor.h for the details for each type of sensor.
470
834
  *
471
- * \param gamecontroller The controller to query
472
- * \param type The type of sensor to query
473
- * \param data A pointer filled with the current sensor state
474
- * \param num_values The number of values to write to data
835
+ * \param gamecontroller The controller to query
836
+ * \param type The type of sensor to query
837
+ * \param data A pointer filled with the current sensor state
838
+ * \param num_values The number of values to write to data
839
+ * \return 0 or -1 if an error occurred.
475
840
  *
476
- * \return 0 or -1 if an error occurred.
841
+ * \since This function is available since SDL 2.0.14.
477
842
  */
478
843
  extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values);
479
844
 
480
845
  /**
481
- * Start a rumble effect
482
- * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
846
+ * Start a rumble effect on a game controller.
847
+ *
848
+ * Each call to this function cancels any previous rumble effect, and calling
849
+ * it with 0 intensity stops any rumbling.
483
850
  *
484
- * \param gamecontroller The controller to vibrate
485
- * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF
486
- * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
487
- * \param duration_ms The duration of the rumble effect, in milliseconds
851
+ * \param gamecontroller The controller to vibrate
852
+ * \param low_frequency_rumble The intensity of the low frequency (left)
853
+ * rumble motor, from 0 to 0xFFFF
854
+ * \param high_frequency_rumble The intensity of the high frequency (right)
855
+ * rumble motor, from 0 to 0xFFFF
856
+ * \param duration_ms The duration of the rumble effect, in milliseconds
857
+ * \returns 0, or -1 if rumble isn't supported on this controller
488
858
  *
489
- * \return 0, or -1 if rumble isn't supported on this controller
859
+ * \since This function is available since SDL 2.0.9.
860
+ *
861
+ * \sa SDL_GameControllerHasRumble
490
862
  */
491
863
  extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
492
864
 
493
865
  /**
494
- * Start a rumble effect in the game controller's triggers
495
- * Each call to this function cancels any previous trigger rumble effect, and calling it with 0 intensity stops any rumbling.
866
+ * Start a rumble effect in the game controller's triggers.
867
+ *
868
+ * Each call to this function cancels any previous trigger rumble effect, and
869
+ * calling it with 0 intensity stops any rumbling.
496
870
  *
497
- * \param gamecontroller The controller to vibrate
498
- * \param left_rumble The intensity of the left trigger rumble motor, from 0 to 0xFFFF
499
- * \param right_rumble The intensity of the right trigger rumble motor, from 0 to 0xFFFF
500
- * \param duration_ms The duration of the rumble effect, in milliseconds
871
+ * 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.
501
874
  *
502
- * \return 0, or -1 if rumble isn't supported on this controller
875
+ * \param gamecontroller The controller to vibrate
876
+ * \param left_rumble The intensity of the left trigger rumble motor, from 0
877
+ * to 0xFFFF
878
+ * \param right_rumble The intensity of the right trigger rumble motor, from 0
879
+ * to 0xFFFF
880
+ * \param duration_ms The duration of the rumble effect, in milliseconds
881
+ * \returns 0, or -1 if trigger rumble isn't supported on this controller
882
+ *
883
+ * \since This function is available since SDL 2.0.14.
884
+ *
885
+ * \sa SDL_GameControllerHasRumbleTriggers
503
886
  */
504
887
  extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
505
888
 
506
889
  /**
507
- * Return whether a controller has an LED
890
+ * Query whether a game controller has an LED.
508
891
  *
509
- * \param gamecontroller The controller to query
892
+ * \param gamecontroller The controller to query
893
+ * \returns SDL_TRUE, or SDL_FALSE if this controller does not have a
894
+ * modifiable LED
510
895
  *
511
- * \return SDL_TRUE, or SDL_FALSE if this controller does not have a modifiable LED
896
+ * \since This function is available since SDL 2.0.14.
512
897
  */
513
898
  extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *gamecontroller);
514
899
 
515
900
  /**
516
- * Update a controller's LED color.
901
+ * Query whether a game controller has rumble support.
902
+ *
903
+ * \param gamecontroller The controller to query
904
+ * \returns SDL_TRUE, or SDL_FALSE if this controller does not have rumble
905
+ * support
906
+ *
907
+ * \since This function is available since SDL 2.0.18.
908
+ *
909
+ * \sa SDL_GameControllerRumble
910
+ */
911
+ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumble(SDL_GameController *gamecontroller);
912
+
913
+ /**
914
+ * Query whether a game controller has rumble support on triggers.
915
+ *
916
+ * \param gamecontroller The controller to query
917
+ * \returns SDL_TRUE, or SDL_FALSE if this controller does not have trigger
918
+ * rumble support
919
+ *
920
+ * \since This function is available since SDL 2.0.18.
921
+ *
922
+ * \sa SDL_GameControllerRumbleTriggers
923
+ */
924
+ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumbleTriggers(SDL_GameController *gamecontroller);
925
+
926
+ /**
927
+ * Update a game controller's LED color.
517
928
  *
518
- * \param gamecontroller The controller to update
519
- * \param red The intensity of the red LED
520
- * \param green The intensity of the green LED
521
- * \param blue The intensity of the blue LED
929
+ * \param gamecontroller The controller to update
930
+ * \param red The intensity of the red LED
931
+ * \param green The intensity of the green LED
932
+ * \param blue The intensity of the blue LED
933
+ * \returns 0, or -1 if this controller does not have a modifiable LED
522
934
  *
523
- * \return 0, or -1 if this controller does not have a modifiable LED
935
+ * \since This function is available since SDL 2.0.14.
524
936
  */
525
937
  extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 green, Uint8 blue);
526
938
 
527
939
  /**
528
- * Close a controller previously opened with SDL_GameControllerOpen().
940
+ * Send a controller specific effect packet
941
+ *
942
+ * \param gamecontroller The controller to affect
943
+ * \param data The data to send to the controller
944
+ * \param size The size of the data to send to the controller
945
+ * \returns 0, or -1 if this controller or driver doesn't support effect
946
+ * packets
947
+ *
948
+ * \since This function is available since SDL 2.0.16.
949
+ */
950
+ extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gamecontroller, const void *data, int size);
951
+
952
+ /**
953
+ * Close a game controller previously opened with SDL_GameControllerOpen().
954
+ *
955
+ * \param gamecontroller a game controller identifier previously returned by
956
+ * SDL_GameControllerOpen()
957
+ *
958
+ * \since This function is available since SDL 2.0.0.
959
+ *
960
+ * \sa SDL_GameControllerOpen
529
961
  */
530
962
  extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
531
963
 
964
+ /**
965
+ * Return the sfSymbolsName for a given button on a game controller on Apple
966
+ * platforms.
967
+ *
968
+ * \param gamecontroller the controller to query
969
+ * \param button a button on the game controller
970
+ * \returns the sfSymbolsName or NULL if the name can't be found
971
+ *
972
+ * \since This function is available since SDL 2.0.18.
973
+ *
974
+ * \sa SDL_GameControllerGetAppleSFSymbolsNameForAxis
975
+ */
976
+ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button);
977
+
978
+ /**
979
+ * Return the sfSymbolsName for a given axis on a game controller on Apple
980
+ * platforms.
981
+ *
982
+ * \param gamecontroller the controller to query
983
+ * \param axis an axis on the game controller
984
+ * \returns the sfSymbolsName or NULL if the name can't be found
985
+ *
986
+ * \since This function is available since SDL 2.0.18.
987
+ *
988
+ * \sa SDL_GameControllerGetAppleSFSymbolsNameForButton
989
+ */
990
+ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
991
+
532
992
 
533
993
  /* Ends C function definitions when using C++ */
534
994
  #ifdef __cplusplus