gosu 1.1.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +4 -4
  2. data/COPYING +1 -1
  3. data/dependencies/SDL/include/SDL.h +108 -14
  4. data/dependencies/SDL/include/SDL_assert.h +81 -50
  5. data/dependencies/SDL/include/SDL_atomic.h +135 -35
  6. data/dependencies/SDL/include/SDL_audio.h +960 -355
  7. data/dependencies/SDL/include/SDL_bits.h +11 -6
  8. data/dependencies/SDL/include/SDL_blendmode.h +91 -14
  9. data/dependencies/SDL/include/SDL_clipboard.h +30 -7
  10. data/dependencies/SDL/include/SDL_config.h +277 -27
  11. data/dependencies/SDL/include/SDL_config_android.h +13 -38
  12. data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
  13. data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
  14. data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
  15. data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
  16. data/dependencies/SDL/include/SDL_config_psp.h +16 -37
  17. data/dependencies/SDL/include/SDL_config_windows.h +28 -91
  18. data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
  19. data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
  20. data/dependencies/SDL/include/SDL_copying.h +1 -1
  21. data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
  22. data/dependencies/SDL/include/SDL_egl.h +906 -280
  23. data/dependencies/SDL/include/SDL_endian.h +101 -47
  24. data/dependencies/SDL/include/SDL_error.h +70 -19
  25. data/dependencies/SDL/include/SDL_events.h +387 -79
  26. data/dependencies/SDL/include/SDL_filesystem.h +73 -64
  27. data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
  28. data/dependencies/SDL/include/SDL_gesture.h +36 -6
  29. data/dependencies/SDL/include/SDL_haptic.h +304 -210
  30. data/dependencies/SDL/include/SDL_hidapi.h +451 -0
  31. data/dependencies/SDL/include/SDL_hints.h +1286 -897
  32. data/dependencies/SDL/include/SDL_joystick.h +577 -130
  33. data/dependencies/SDL/include/SDL_keyboard.h +162 -63
  34. data/dependencies/SDL/include/SDL_keycode.h +7 -5
  35. data/dependencies/SDL/include/SDL_loadso.h +42 -8
  36. data/dependencies/SDL/include/SDL_locale.h +34 -32
  37. data/dependencies/SDL/include/SDL_log.h +212 -19
  38. data/dependencies/SDL/include/SDL_main.h +72 -17
  39. data/dependencies/SDL/include/SDL_messagebox.h +70 -23
  40. data/dependencies/SDL/include/SDL_metal.h +27 -32
  41. data/dependencies/SDL/include/SDL_misc.h +19 -15
  42. data/dependencies/SDL/include/SDL_mouse.h +262 -110
  43. data/dependencies/SDL/include/SDL_mutex.h +286 -66
  44. data/dependencies/SDL/include/SDL_name.h +1 -1
  45. data/dependencies/SDL/include/SDL_opengl.h +1 -1
  46. data/dependencies/SDL/include/SDL_opengles.h +1 -1
  47. data/dependencies/SDL/include/SDL_opengles2.h +2 -2
  48. data/dependencies/SDL/include/SDL_pixels.h +199 -34
  49. data/dependencies/SDL/include/SDL_platform.h +39 -2
  50. data/dependencies/SDL/include/SDL_power.h +23 -10
  51. data/dependencies/SDL/include/SDL_quit.h +1 -1
  52. data/dependencies/SDL/include/SDL_rect.h +78 -28
  53. data/dependencies/SDL/include/SDL_render.h +1204 -472
  54. data/dependencies/SDL/include/SDL_revision.h +2 -2
  55. data/dependencies/SDL/include/SDL_rwops.h +605 -33
  56. data/dependencies/SDL/include/SDL_scancode.h +1 -1
  57. data/dependencies/SDL/include/SDL_sensor.h +76 -42
  58. data/dependencies/SDL/include/SDL_shape.h +38 -27
  59. data/dependencies/SDL/include/SDL_stdinc.h +96 -24
  60. data/dependencies/SDL/include/SDL_surface.h +571 -139
  61. data/dependencies/SDL/include/SDL_system.h +339 -101
  62. data/dependencies/SDL/include/SDL_syswm.h +50 -20
  63. data/dependencies/SDL/include/SDL_test.h +1 -1
  64. data/dependencies/SDL/include/SDL_test_assert.h +2 -2
  65. data/dependencies/SDL/include/SDL_test_common.h +23 -6
  66. data/dependencies/SDL/include/SDL_test_compare.h +1 -1
  67. data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
  68. data/dependencies/SDL/include/SDL_test_font.h +3 -3
  69. data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
  70. data/dependencies/SDL/include/SDL_test_harness.h +6 -6
  71. data/dependencies/SDL/include/SDL_test_images.h +1 -1
  72. data/dependencies/SDL/include/SDL_test_log.h +1 -1
  73. data/dependencies/SDL/include/SDL_test_md5.h +1 -1
  74. data/dependencies/SDL/include/SDL_test_memory.h +1 -1
  75. data/dependencies/SDL/include/SDL_test_random.h +2 -2
  76. data/dependencies/SDL/include/SDL_thread.h +226 -128
  77. data/dependencies/SDL/include/SDL_timer.h +129 -22
  78. data/dependencies/SDL/include/SDL_touch.h +48 -8
  79. data/dependencies/SDL/include/SDL_types.h +1 -1
  80. data/dependencies/SDL/include/SDL_version.h +72 -46
  81. data/dependencies/SDL/include/SDL_video.h +1266 -460
  82. data/dependencies/SDL/include/SDL_vulkan.h +100 -161
  83. data/dependencies/SDL/include/begin_code.h +22 -1
  84. data/dependencies/SDL/include/close_code.h +1 -1
  85. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  86. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  87. data/dependencies/SDL_sound/SDL_sound.c +83 -7
  88. data/dependencies/SDL_sound/SDL_sound.h +4 -4
  89. data/dependencies/SDL_sound/SDL_sound_aiff.c +9 -12
  90. data/dependencies/SDL_sound/SDL_sound_au.c +7 -7
  91. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +3 -3
  92. data/dependencies/SDL_sound/SDL_sound_flac.c +1 -1
  93. data/dependencies/SDL_sound/SDL_sound_internal.h +17 -10
  94. data/dependencies/SDL_sound/SDL_sound_modplug.c +25 -27
  95. data/dependencies/SDL_sound/SDL_sound_mp3.c +5 -17
  96. data/dependencies/SDL_sound/SDL_sound_raw.c +11 -11
  97. data/dependencies/SDL_sound/SDL_sound_shn.c +8 -7
  98. data/dependencies/SDL_sound/SDL_sound_voc.c +6 -4
  99. data/dependencies/SDL_sound/SDL_sound_vorbis.c +6 -11
  100. data/dependencies/SDL_sound/SDL_sound_wav.c +35 -29
  101. data/dependencies/SDL_sound/dr_flac.h +618 -220
  102. data/dependencies/SDL_sound/dr_mp3.h +263 -94
  103. data/dependencies/SDL_sound/libmodplug/fastmix.c +58 -64
  104. data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
  105. data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
  106. data/dependencies/SDL_sound/libmodplug/load_amf.c +11 -7
  107. data/dependencies/SDL_sound/libmodplug/load_ams.c +65 -22
  108. data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
  109. data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
  110. data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
  111. data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
  112. data/dependencies/SDL_sound/libmodplug/load_it.c +45 -49
  113. data/dependencies/SDL_sound/libmodplug/load_mdl.c +80 -53
  114. data/dependencies/SDL_sound/libmodplug/load_med.c +20 -12
  115. data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
  116. data/dependencies/SDL_sound/libmodplug/load_mt2.c +29 -17
  117. data/dependencies/SDL_sound/libmodplug/load_okt.c +12 -8
  118. data/dependencies/SDL_sound/libmodplug/load_psm.c +101 -78
  119. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
  120. data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
  121. data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
  122. data/dependencies/SDL_sound/libmodplug/load_ult.c +2 -2
  123. data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
  124. data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
  125. data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
  126. data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
  127. data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
  128. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
  129. data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
  130. data/dependencies/SDL_sound/libmodplug/snd_fx.c +24 -18
  131. data/dependencies/SDL_sound/libmodplug/sndfile.c +55 -156
  132. data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
  133. data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
  134. data/dependencies/SDL_sound/stb_vorbis.h +508 -325
  135. data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
  136. data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
  137. data/dependencies/mojoAL/mojoal.c +4594 -0
  138. data/ext/gosu/extconf.rb +33 -30
  139. data/include/Gosu/Audio.hpp +70 -85
  140. data/include/Gosu/Color.hpp +63 -107
  141. data/include/Gosu/Font.hpp +44 -50
  142. data/include/Gosu/Fwd.hpp +1 -1
  143. data/include/Gosu/Graphics.hpp +64 -75
  144. data/include/Gosu/GraphicsBase.hpp +32 -39
  145. data/include/Gosu/Image.hpp +56 -62
  146. data/include/Gosu/ImageData.hpp +23 -27
  147. data/include/Gosu/Inspection.hpp +1 -4
  148. data/include/Gosu/Math.hpp +4 -16
  149. data/include/Gosu/Platform.hpp +1 -51
  150. data/include/Gosu/Text.hpp +37 -40
  151. data/include/Gosu/TextInput.hpp +34 -40
  152. data/include/Gosu/Utility.hpp +10 -8
  153. data/include/Gosu/Version.hpp +1 -1
  154. data/include/Gosu/Window.hpp +73 -70
  155. data/lib/SDL2.dll +0 -0
  156. data/lib/gosu/compat.rb +28 -37
  157. data/lib/gosu/swig_patches.rb +31 -3
  158. data/lib/gosu.rb +2 -2
  159. data/lib64/SDL2.dll +0 -0
  160. data/rdoc/gosu.rb +9 -1
  161. data/src/Audio.cpp +86 -86
  162. data/src/AudioFile.hpp +6 -6
  163. data/src/AudioFileAudioToolbox.cpp +1 -1
  164. data/src/AudioFileSDLSound.cpp +1 -1
  165. data/src/AudioImpl.hpp +5 -5
  166. data/src/Bitmap.cpp +13 -13
  167. data/src/BitmapIO.cpp +0 -20
  168. data/src/BlockAllocator.cpp +2 -1
  169. data/src/Channel.cpp +22 -20
  170. data/src/Color.cpp +62 -55
  171. data/src/EmptyImageData.hpp +16 -18
  172. data/src/FileUnix.cpp +1 -1
  173. data/src/FileWin.cpp +1 -1
  174. data/src/Font.cpp +52 -57
  175. data/src/GosuViewController.cpp +2 -0
  176. data/src/Graphics.cpp +135 -143
  177. data/src/Image.cpp +42 -42
  178. data/src/Input.cpp +1 -1
  179. data/src/InputUIKit.cpp +1 -1
  180. data/src/LargeImageData.cpp +120 -113
  181. data/src/LargeImageData.hpp +18 -16
  182. data/src/Log.hpp +6 -6
  183. data/src/Macro.cpp +124 -169
  184. data/src/Macro.hpp +11 -11
  185. data/src/Math.cpp +8 -1
  186. data/src/RenderState.hpp +5 -5
  187. data/src/Resolution.cpp +114 -61
  188. data/src/RubyGosu.cxx +470 -501
  189. data/src/RubyGosu.h +3 -2
  190. data/src/TexChunk.cpp +50 -41
  191. data/src/TexChunk.hpp +22 -22
  192. data/src/Text.cpp +58 -59
  193. data/src/TextBuilder.cpp +60 -57
  194. data/src/TextBuilder.hpp +20 -20
  195. data/src/TextInput.cpp +127 -135
  196. data/src/TrueTypeFont.cpp +108 -108
  197. data/src/TrueTypeFont.hpp +39 -38
  198. data/src/TrueTypeFontApple.cpp +27 -23
  199. data/src/TrueTypeFontUnix.cpp +21 -26
  200. data/src/TrueTypeFontWin.cpp +30 -30
  201. data/src/Utility.cpp +82 -23
  202. data/src/WinUtility.hpp +2 -1
  203. data/src/Window.cpp +103 -86
  204. data/src/WindowUIKit.cpp +48 -51
  205. metadata +8 -20
  206. data/dependencies/SDL/include/SDL_config_os2.h +0 -188
  207. data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
  208. data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
  209. data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
  210. data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
  211. data/dependencies/al_soft/AL/alext.h +0 -585
  212. data/dependencies/al_soft/AL/efx-creative.h +0 -3
  213. data/dependencies/al_soft/AL/efx-presets.h +0 -402
  214. data/dependencies/al_soft/AL/efx.h +0 -762
  215. data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
  216. data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
  217. data/lib/OpenAL32.dll +0 -0
  218. data/lib64/OpenAL32.dll +0 -0
  219. data/src/UtilityApple.cpp +0 -16
  220. data/src/UtilityWin.cpp +0 -17
@@ -0,0 +1,451 @@
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_hidapi.h
24
+ *
25
+ * Header file for SDL HIDAPI functions.
26
+ *
27
+ * This is an adaptation of the original HIDAPI interface by Alan Ott,
28
+ * and includes source code licensed under the following BSD license:
29
+ *
30
+ Copyright (c) 2010, Alan Ott, Signal 11 Software
31
+ All rights reserved.
32
+
33
+ Redistribution and use in source and binary forms, with or without
34
+ modification, are permitted provided that the following conditions are met:
35
+
36
+ * Redistributions of source code must retain the above copyright notice,
37
+ this list of conditions and the following disclaimer.
38
+ * Redistributions in binary form must reproduce the above copyright
39
+ notice, this list of conditions and the following disclaimer in the
40
+ documentation and/or other materials provided with the distribution.
41
+ * Neither the name of Signal 11 Software nor the names of its
42
+ contributors may be used to endorse or promote products derived from
43
+ this software without specific prior written permission.
44
+
45
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
46
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
49
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
50
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
51
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
52
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
53
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
55
+ POSSIBILITY OF SUCH DAMAGE.
56
+ *
57
+ * If you would like a version of SDL without this code, you can build SDL
58
+ * with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for example
59
+ * on iOS or tvOS to avoid a dependency on the CoreBluetooth framework.
60
+ */
61
+
62
+ #ifndef SDL_hidapi_h_
63
+ #define SDL_hidapi_h_
64
+
65
+ #include "SDL_stdinc.h"
66
+
67
+ #include "begin_code.h"
68
+ /* Set up for C function definitions, even when using C++ */
69
+ #ifdef __cplusplus
70
+ extern "C" {
71
+ #endif
72
+
73
+ /**
74
+ * \brief A handle representing an open HID device
75
+ */
76
+ struct SDL_hid_device_;
77
+ typedef struct SDL_hid_device_ SDL_hid_device; /**< opaque hidapi structure */
78
+
79
+ /** hidapi info structure */
80
+ /**
81
+ * \brief Information about a connected HID device
82
+ */
83
+ typedef struct SDL_hid_device_info
84
+ {
85
+ /** Platform-specific device path */
86
+ char *path;
87
+ /** Device Vendor ID */
88
+ unsigned short vendor_id;
89
+ /** Device Product ID */
90
+ unsigned short product_id;
91
+ /** Serial Number */
92
+ wchar_t *serial_number;
93
+ /** Device Release Number in binary-coded decimal,
94
+ also known as Device Version Number */
95
+ unsigned short release_number;
96
+ /** Manufacturer String */
97
+ wchar_t *manufacturer_string;
98
+ /** Product string */
99
+ wchar_t *product_string;
100
+ /** Usage Page for this Device/Interface
101
+ (Windows/Mac only). */
102
+ unsigned short usage_page;
103
+ /** Usage for this Device/Interface
104
+ (Windows/Mac only).*/
105
+ unsigned short usage;
106
+ /** The USB interface which this logical device
107
+ represents.
108
+
109
+ * Valid on both Linux implementations in all cases.
110
+ * Valid on the Windows implementation only if the device
111
+ contains more than one interface. */
112
+ int interface_number;
113
+
114
+ /** Additional information about the USB interface.
115
+ Valid on libusb and Android implementations. */
116
+ int interface_class;
117
+ int interface_subclass;
118
+ int interface_protocol;
119
+
120
+ /** Pointer to the next device */
121
+ struct SDL_hid_device_info *next;
122
+ } SDL_hid_device_info;
123
+
124
+
125
+ /**
126
+ * Initialize the HIDAPI library.
127
+ *
128
+ * This function initializes the HIDAPI library. Calling it is not strictly
129
+ * necessary, as it will be called automatically by SDL_hid_enumerate() and
130
+ * any of the SDL_hid_open_*() functions if it is needed. This function should
131
+ * be called at the beginning of execution however, if there is a chance of
132
+ * HIDAPI handles being opened by different threads simultaneously.
133
+ *
134
+ * Each call to this function should have a matching call to SDL_hid_exit()
135
+ *
136
+ * \returns 0 on success and -1 on error.
137
+ *
138
+ * \since This function is available since SDL 2.0.18.
139
+ *
140
+ * \sa SDL_hid_exit
141
+ */
142
+ extern DECLSPEC int SDLCALL SDL_hid_init(void);
143
+
144
+ /**
145
+ * Finalize the HIDAPI library.
146
+ *
147
+ * This function frees all of the static data associated with HIDAPI. It
148
+ * should be called at the end of execution to avoid memory leaks.
149
+ *
150
+ * \returns 0 on success and -1 on error.
151
+ *
152
+ * \since This function is available since SDL 2.0.18.
153
+ *
154
+ * \sa SDL_hid_init
155
+ */
156
+ extern DECLSPEC int SDLCALL SDL_hid_exit(void);
157
+
158
+ /**
159
+ * Check to see if devices may have been added or removed.
160
+ *
161
+ * Enumerating the HID devices is an expensive operation, so you can call this
162
+ * to see if there have been any system device changes since the last call to
163
+ * this function. A change in the counter returned doesn't necessarily mean
164
+ * that anything has changed, but you can call SDL_hid_enumerate() to get an
165
+ * updated device list.
166
+ *
167
+ * Calling this function for the first time may cause a thread or other system
168
+ * resource to be allocated to track device change notifications.
169
+ *
170
+ * \returns a change counter that is incremented with each potential device
171
+ * change, or 0 if device change detection isn't available.
172
+ *
173
+ * \since This function is available since SDL 2.0.18.
174
+ *
175
+ * \sa SDL_hid_enumerate
176
+ */
177
+ extern DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void);
178
+
179
+ /**
180
+ * Enumerate the HID Devices.
181
+ *
182
+ * This function returns a linked list of all the HID devices attached to the
183
+ * system which match vendor_id and product_id. If `vendor_id` is set to 0
184
+ * then any vendor matches. If `product_id` is set to 0 then any product
185
+ * matches. If `vendor_id` and `product_id` are both set to 0, then all HID
186
+ * devices will be returned.
187
+ *
188
+ * \param vendor_id The Vendor ID (VID) of the types of device to open.
189
+ * \param product_id The Product ID (PID) of the types of device to open.
190
+ * \returns a pointer to a linked list of type SDL_hid_device_info, containing
191
+ * information about the HID devices attached to the system, or NULL
192
+ * in the case of failure. Free this linked list by calling
193
+ * SDL_hid_free_enumeration().
194
+ *
195
+ * \since This function is available since SDL 2.0.18.
196
+ *
197
+ * \sa SDL_hid_device_change_count
198
+ */
199
+ extern DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id);
200
+
201
+ /**
202
+ * Free an enumeration Linked List
203
+ *
204
+ * This function frees a linked list created by SDL_hid_enumerate().
205
+ *
206
+ * \param devs Pointer to a list of struct_device returned from
207
+ * SDL_hid_enumerate().
208
+ *
209
+ * \since This function is available since SDL 2.0.18.
210
+ */
211
+ extern DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs);
212
+
213
+ /**
214
+ * Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally
215
+ * a serial number.
216
+ *
217
+ * If `serial_number` is NULL, the first device with the specified VID and PID
218
+ * is opened.
219
+ *
220
+ * \param vendor_id The Vendor ID (VID) of the device to open.
221
+ * \param product_id The Product ID (PID) of the device to open.
222
+ * \param serial_number The Serial Number of the device to open (Optionally
223
+ * NULL).
224
+ * \returns a pointer to a SDL_hid_device object on success or NULL on
225
+ * failure.
226
+ *
227
+ * \since This function is available since SDL 2.0.18.
228
+ */
229
+ extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);
230
+
231
+ /**
232
+ * Open a HID device by its path name.
233
+ *
234
+ * The path name be determined by calling SDL_hid_enumerate(), or a
235
+ * platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
236
+ *
237
+ * \param path The path name of the device to open
238
+ * \returns a pointer to a SDL_hid_device object on success or NULL on
239
+ * failure.
240
+ *
241
+ * \since This function is available since SDL 2.0.18.
242
+ */
243
+ extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */);
244
+
245
+ /**
246
+ * Write an Output report to a HID device.
247
+ *
248
+ * The first byte of `data` must contain the Report ID. For devices which only
249
+ * support a single report, this must be set to 0x0. The remaining bytes
250
+ * contain the report data. Since the Report ID is mandatory, calls to
251
+ * SDL_hid_write() will always contain one more byte than the report contains.
252
+ * For example, if a hid report is 16 bytes long, 17 bytes must be passed to
253
+ * SDL_hid_write(), the Report ID (or 0x0, for devices with a single report),
254
+ * followed by the report data (16 bytes). In this example, the length passed
255
+ * in would be 17.
256
+ *
257
+ * SDL_hid_write() will send the data on the first OUT endpoint, if one
258
+ * exists. If it does not, it will send the data through the Control Endpoint
259
+ * (Endpoint 0).
260
+ *
261
+ * \param dev A device handle returned from SDL_hid_open().
262
+ * \param data The data to send, including the report number as the first
263
+ * byte.
264
+ * \param length The length in bytes of the data to send.
265
+ * \returns the actual number of bytes written and -1 on error.
266
+ *
267
+ * \since This function is available since SDL 2.0.18.
268
+ */
269
+ extern DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length);
270
+
271
+ /**
272
+ * Read an Input report from a HID device with timeout.
273
+ *
274
+ * Input reports are returned to the host through the INTERRUPT IN endpoint.
275
+ * The first byte will contain the Report number if the device uses numbered
276
+ * reports.
277
+ *
278
+ * \param dev A device handle returned from SDL_hid_open().
279
+ * \param data A buffer to put the read data into.
280
+ * \param length The number of bytes to read. For devices with multiple
281
+ * reports, make sure to read an extra byte for the report
282
+ * number.
283
+ * \param milliseconds timeout in milliseconds or -1 for blocking wait.
284
+ * \returns the actual number of bytes read and -1 on error. If no packet was
285
+ * available to be read within the timeout period, this function
286
+ * returns 0.
287
+ *
288
+ * \since This function is available since SDL 2.0.18.
289
+ */
290
+ extern DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds);
291
+
292
+ /**
293
+ * Read an Input report from a HID device.
294
+ *
295
+ * Input reports are returned to the host through the INTERRUPT IN endpoint.
296
+ * The first byte will contain the Report number if the device uses numbered
297
+ * reports.
298
+ *
299
+ * \param dev A device handle returned from SDL_hid_open().
300
+ * \param data A buffer to put the read data into.
301
+ * \param length The number of bytes to read. For devices with multiple
302
+ * reports, make sure to read an extra byte for the report
303
+ * number.
304
+ * \returns the actual number of bytes read and -1 on error. If no packet was
305
+ * available to be read and the handle is in non-blocking mode, this
306
+ * function returns 0.
307
+ *
308
+ * \since This function is available since SDL 2.0.18.
309
+ */
310
+ extern DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *data, size_t length);
311
+
312
+ /**
313
+ * Set the device handle to be non-blocking.
314
+ *
315
+ * In non-blocking mode calls to SDL_hid_read() will return immediately with a
316
+ * value of 0 if there is no data to be read. In blocking mode, SDL_hid_read()
317
+ * will wait (block) until there is data to read before returning.
318
+ *
319
+ * Nonblocking can be turned on and off at any time.
320
+ *
321
+ * \param dev A device handle returned from SDL_hid_open().
322
+ * \param nonblock enable or not the nonblocking reads - 1 to enable
323
+ * nonblocking - 0 to disable nonblocking.
324
+ * \returns 0 on success and -1 on error.
325
+ *
326
+ * \since This function is available since SDL 2.0.18.
327
+ */
328
+ extern DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int nonblock);
329
+
330
+ /**
331
+ * Send a Feature report to the device.
332
+ *
333
+ * Feature reports are sent over the Control endpoint as a Set_Report
334
+ * transfer. The first byte of `data` must contain the Report ID. For devices
335
+ * which only support a single report, this must be set to 0x0. The remaining
336
+ * bytes contain the report data. Since the Report ID is mandatory, calls to
337
+ * SDL_hid_send_feature_report() will always contain one more byte than the
338
+ * report contains. For example, if a hid report is 16 bytes long, 17 bytes
339
+ * must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for
340
+ * devices which do not use numbered reports), followed by the report data (16
341
+ * bytes). In this example, the length passed in would be 17.
342
+ *
343
+ * \param dev A device handle returned from SDL_hid_open().
344
+ * \param data The data to send, including the report number as the first
345
+ * byte.
346
+ * \param length The length in bytes of the data to send, including the report
347
+ * number.
348
+ * \returns the actual number of bytes written and -1 on error.
349
+ *
350
+ * \since This function is available since SDL 2.0.18.
351
+ */
352
+ extern DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length);
353
+
354
+ /**
355
+ * Get a feature report from a HID device.
356
+ *
357
+ * Set the first byte of `data` to the Report ID of the report to be read.
358
+ * Make sure to allow space for this extra byte in `data`. Upon return, the
359
+ * first byte will still contain the Report ID, and the report data will start
360
+ * in data[1].
361
+ *
362
+ * \param dev A device handle returned from SDL_hid_open().
363
+ * \param data A buffer to put the read data into, including the Report ID.
364
+ * Set the first byte of `data` to the Report ID of the report to
365
+ * be read, or set it to zero if your device does not use numbered
366
+ * reports.
367
+ * \param length The number of bytes to read, including an extra byte for the
368
+ * report ID. The buffer can be longer than the actual report.
369
+ * \returns the number of bytes read plus one for the report ID (which is
370
+ * still in the first byte), or -1 on error.
371
+ *
372
+ * \since This function is available since SDL 2.0.18.
373
+ */
374
+ extern DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length);
375
+
376
+ /**
377
+ * Close a HID device.
378
+ *
379
+ * \param dev A device handle returned from SDL_hid_open().
380
+ *
381
+ * \since This function is available since SDL 2.0.18.
382
+ */
383
+ extern DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev);
384
+
385
+ /**
386
+ * Get The Manufacturer String from a HID device.
387
+ *
388
+ * \param dev A device handle returned from SDL_hid_open().
389
+ * \param string A wide string buffer to put the data into.
390
+ * \param maxlen The length of the buffer in multiples of wchar_t.
391
+ * \returns 0 on success and -1 on error.
392
+ *
393
+ * \since This function is available since SDL 2.0.18.
394
+ */
395
+ extern DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
396
+
397
+ /**
398
+ * Get The Product String from a HID device.
399
+ *
400
+ * \param dev A device handle returned from SDL_hid_open().
401
+ * \param string A wide string buffer to put the data into.
402
+ * \param maxlen The length of the buffer in multiples of wchar_t.
403
+ * \returns 0 on success and -1 on error.
404
+ *
405
+ * \since This function is available since SDL 2.0.18.
406
+ */
407
+ extern DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
408
+
409
+ /**
410
+ * Get The Serial Number String from a HID device.
411
+ *
412
+ * \param dev A device handle returned from SDL_hid_open().
413
+ * \param string A wide string buffer to put the data into.
414
+ * \param maxlen The length of the buffer in multiples of wchar_t.
415
+ * \returns 0 on success and -1 on error.
416
+ *
417
+ * \since This function is available since SDL 2.0.18.
418
+ */
419
+ extern DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
420
+
421
+ /**
422
+ * Get a string from a HID device, based on its string index.
423
+ *
424
+ * \param dev A device handle returned from SDL_hid_open().
425
+ * \param string_index The index of the string to get.
426
+ * \param string A wide string buffer to put the data into.
427
+ * \param maxlen The length of the buffer in multiples of wchar_t.
428
+ * \returns 0 on success and -1 on error.
429
+ *
430
+ * \since This function is available since SDL 2.0.18.
431
+ */
432
+ extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen);
433
+
434
+ /**
435
+ * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers
436
+ *
437
+ * \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan
438
+ *
439
+ * \since This function is available since SDL 2.0.18.
440
+ */
441
+ extern DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL_bool active);
442
+
443
+ /* Ends C function definitions when using C++ */
444
+ #ifdef __cplusplus
445
+ }
446
+ #endif
447
+ #include "close_code.h"
448
+
449
+ #endif /* SDL_hidapi_h_ */
450
+
451
+ /* vi: set sts=4 ts=4 sw=4 expandtab: */