ruby2d 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/assets/README.md +20 -7
  3. data/assets/include/SDL2/SDL.h +135 -0
  4. data/assets/include/SDL2/SDL_assert.h +291 -0
  5. data/assets/include/SDL2/SDL_atomic.h +277 -0
  6. data/assets/include/SDL2/SDL_audio.h +826 -0
  7. data/assets/include/SDL2/SDL_bits.h +112 -0
  8. data/assets/include/SDL2/SDL_blendmode.h +120 -0
  9. data/assets/include/SDL2/SDL_clipboard.h +71 -0
  10. data/assets/include/SDL2/SDL_config.h +421 -0
  11. data/assets/include/SDL2/SDL_cpuinfo.h +188 -0
  12. data/assets/include/SDL2/SDL_egl.h +1673 -0
  13. data/assets/include/SDL2/SDL_endian.h +260 -0
  14. data/assets/include/SDL2/SDL_error.h +76 -0
  15. data/assets/include/SDL2/SDL_events.h +788 -0
  16. data/assets/include/SDL2/SDL_filesystem.h +136 -0
  17. data/assets/include/SDL2/SDL_gamecontroller.h +390 -0
  18. data/assets/include/SDL2/SDL_gesture.h +87 -0
  19. data/assets/include/SDL2/SDL_haptic.h +1238 -0
  20. data/assets/include/SDL2/SDL_hints.h +1135 -0
  21. data/assets/include/SDL2/SDL_image.h +161 -0
  22. data/assets/include/SDL2/SDL_joystick.h +408 -0
  23. data/assets/include/SDL2/SDL_keyboard.h +217 -0
  24. data/assets/include/SDL2/SDL_keycode.h +349 -0
  25. data/assets/include/SDL2/SDL_loadso.h +81 -0
  26. data/assets/include/SDL2/SDL_log.h +211 -0
  27. data/assets/include/SDL2/SDL_main.h +168 -0
  28. data/assets/include/SDL2/SDL_messagebox.h +144 -0
  29. data/assets/include/SDL2/SDL_mixer.h +651 -0
  30. data/assets/include/SDL2/SDL_mouse.h +302 -0
  31. data/assets/include/SDL2/SDL_mutex.h +251 -0
  32. data/assets/include/SDL2/SDL_name.h +33 -0
  33. data/assets/include/SDL2/SDL_opengl.h +2183 -0
  34. data/assets/include/SDL2/SDL_opengl_glext.h +11177 -0
  35. data/assets/include/SDL2/SDL_opengles.h +39 -0
  36. data/assets/include/SDL2/SDL_opengles2.h +52 -0
  37. data/assets/include/SDL2/SDL_opengles2_gl2.h +621 -0
  38. data/assets/include/SDL2/SDL_opengles2_gl2ext.h +2050 -0
  39. data/assets/include/SDL2/SDL_opengles2_gl2platform.h +30 -0
  40. data/assets/include/SDL2/SDL_opengles2_khrplatform.h +282 -0
  41. data/assets/include/SDL2/SDL_pixels.h +470 -0
  42. data/assets/include/SDL2/SDL_platform.h +198 -0
  43. data/assets/include/SDL2/SDL_power.h +75 -0
  44. data/assets/include/SDL2/SDL_quit.h +58 -0
  45. data/assets/include/SDL2/SDL_rect.h +148 -0
  46. data/assets/include/SDL2/SDL_render.h +931 -0
  47. data/assets/include/SDL2/SDL_revision.h +2 -0
  48. data/assets/include/SDL2/SDL_rwops.h +254 -0
  49. data/assets/include/SDL2/SDL_scancode.h +413 -0
  50. data/assets/include/SDL2/SDL_sensor.h +251 -0
  51. data/assets/include/SDL2/SDL_shape.h +144 -0
  52. data/assets/include/SDL2/SDL_stdinc.h +607 -0
  53. data/assets/include/SDL2/SDL_surface.h +553 -0
  54. data/assets/include/SDL2/SDL_system.h +279 -0
  55. data/assets/include/SDL2/SDL_syswm.h +324 -0
  56. data/assets/include/SDL2/SDL_test.h +69 -0
  57. data/assets/include/SDL2/SDL_test_assert.h +105 -0
  58. data/assets/include/SDL2/SDL_test_common.h +188 -0
  59. data/assets/include/SDL2/SDL_test_compare.h +69 -0
  60. data/assets/include/SDL2/SDL_test_crc32.h +124 -0
  61. data/assets/include/SDL2/SDL_test_font.h +81 -0
  62. data/assets/include/SDL2/SDL_test_fuzzer.h +384 -0
  63. data/assets/include/SDL2/SDL_test_harness.h +134 -0
  64. data/assets/include/SDL2/SDL_test_images.h +78 -0
  65. data/assets/include/SDL2/SDL_test_log.h +67 -0
  66. data/assets/include/SDL2/SDL_test_md5.h +129 -0
  67. data/assets/include/SDL2/SDL_test_memory.h +63 -0
  68. data/assets/include/SDL2/SDL_test_random.h +115 -0
  69. data/assets/include/SDL2/SDL_thread.h +343 -0
  70. data/assets/include/SDL2/SDL_timer.h +115 -0
  71. data/assets/include/SDL2/SDL_touch.h +86 -0
  72. data/assets/include/SDL2/SDL_ttf.h +294 -0
  73. data/assets/include/SDL2/SDL_types.h +29 -0
  74. data/assets/include/SDL2/SDL_version.h +162 -0
  75. data/assets/include/SDL2/SDL_video.h +1276 -0
  76. data/assets/include/SDL2/SDL_vulkan.h +278 -0
  77. data/assets/include/SDL2/begin_code.h +167 -0
  78. data/assets/include/SDL2/close_code.h +37 -0
  79. data/assets/include/glew.h +23686 -0
  80. data/assets/include/simple2d.h +735 -0
  81. data/assets/ios/MRuby.framework/Headers/mrbconf.h +3 -5
  82. data/assets/ios/MRuby.framework/Headers/mruby.h +35 -32
  83. data/assets/ios/MRuby.framework/Headers/mruby/array.h +1 -0
  84. data/assets/ios/MRuby.framework/Headers/mruby/boxing_word.h +9 -1
  85. data/assets/ios/MRuby.framework/Headers/mruby/class.h +14 -11
  86. data/assets/ios/MRuby.framework/Headers/mruby/common.h +5 -0
  87. data/assets/ios/MRuby.framework/Headers/mruby/compile.h +4 -3
  88. data/assets/ios/MRuby.framework/Headers/mruby/debug.h +3 -2
  89. data/assets/ios/MRuby.framework/Headers/mruby/dump.h +2 -2
  90. data/assets/ios/MRuby.framework/Headers/mruby/hash.h +38 -5
  91. data/assets/ios/MRuby.framework/Headers/mruby/irep.h +17 -4
  92. data/assets/ios/MRuby.framework/Headers/mruby/object.h +4 -5
  93. data/assets/ios/MRuby.framework/Headers/mruby/opcode.h +47 -139
  94. data/assets/ios/MRuby.framework/Headers/mruby/ops.h +117 -0
  95. data/assets/ios/MRuby.framework/Headers/mruby/proc.h +4 -4
  96. data/assets/ios/MRuby.framework/Headers/mruby/string.h +11 -7
  97. data/assets/ios/MRuby.framework/Headers/mruby/throw.h +4 -4
  98. data/assets/ios/MRuby.framework/Headers/mruby/variable.h +2 -4
  99. data/assets/ios/MRuby.framework/Headers/mruby/version.h +6 -6
  100. data/assets/ios/MRuby.framework/MRuby +0 -0
  101. data/assets/ios/MyApp.xcodeproj/project.pbxproj +24 -18
  102. data/assets/ios/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  103. data/assets/ios/main.c +1 -1
  104. data/assets/macos/lib/libFLAC.a +0 -0
  105. data/assets/macos/lib/libSDL2.a +0 -0
  106. data/assets/macos/lib/libSDL2_image.a +0 -0
  107. data/assets/macos/lib/libSDL2_mixer.a +0 -0
  108. data/assets/macos/lib/libSDL2_ttf.a +0 -0
  109. data/assets/macos/lib/libfreetype.a +0 -0
  110. data/assets/macos/lib/libjpeg.a +0 -0
  111. data/assets/macos/lib/libmpg123.a +0 -0
  112. data/assets/macos/lib/libogg.a +0 -0
  113. data/assets/macos/lib/libpng16.a +0 -0
  114. data/assets/macos/lib/libsimple2d.a +0 -0
  115. data/assets/macos/lib/libtiff.a +0 -0
  116. data/assets/macos/lib/libvorbis.a +0 -0
  117. data/assets/macos/lib/libvorbisfile.a +0 -0
  118. data/assets/macos/lib/libwebp.a +0 -0
  119. data/assets/mingw/bin/SDL2.dll +0 -0
  120. data/assets/mingw/bin/SDL2_image.dll +0 -0
  121. data/assets/mingw/bin/SDL2_mixer.dll +0 -0
  122. data/assets/mingw/bin/SDL2_ttf.dll +0 -0
  123. data/assets/mingw/bin/glew32.dll +0 -0
  124. data/assets/mingw/bin/libFLAC-8.dll +0 -0
  125. data/assets/mingw/bin/libfreetype-6.dll +0 -0
  126. data/assets/mingw/bin/libjpeg-9.dll +0 -0
  127. data/assets/mingw/bin/libmodplug-1.dll +0 -0
  128. data/assets/mingw/bin/libmpg123-0.dll +0 -0
  129. data/assets/mingw/bin/libogg-0.dll +0 -0
  130. data/assets/mingw/bin/libopus-0.dll +0 -0
  131. data/assets/mingw/bin/libopusfile-0.dll +0 -0
  132. data/assets/mingw/bin/libpng16-16.dll +0 -0
  133. data/assets/mingw/bin/libtiff-5.dll +0 -0
  134. data/assets/mingw/bin/libvorbis-0.dll +0 -0
  135. data/assets/mingw/bin/libvorbisfile-3.dll +0 -0
  136. data/assets/mingw/bin/libwebp-7.dll +0 -0
  137. data/assets/mingw/bin/zlib1.dll +0 -0
  138. data/assets/mingw/lib/libSDL2.a +0 -0
  139. data/assets/mingw/lib/libSDL2.dll.a +0 -0
  140. data/assets/mingw/lib/libSDL2_image.a +0 -0
  141. data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
  142. data/assets/mingw/lib/libSDL2_mixer.a +0 -0
  143. data/assets/mingw/lib/libSDL2_mixer.dll.a +0 -0
  144. data/assets/mingw/lib/libSDL2_test.a +0 -0
  145. data/assets/mingw/lib/libSDL2_ttf.a +0 -0
  146. data/assets/mingw/lib/libSDL2_ttf.dll.a +0 -0
  147. data/assets/mingw/lib/libSDL2main.a +0 -0
  148. data/assets/mingw/lib/libglew32.a +0 -0
  149. data/assets/mingw/lib/libglew32.dll.a +0 -0
  150. data/assets/mingw/lib/libsimple2d.a +0 -0
  151. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +4 -0
  152. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +4 -0
  153. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +4 -0
  154. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +4 -0
  155. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +4 -0
  156. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +4 -0
  157. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +4 -0
  158. data/assets/tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +4 -0
  159. data/assets/tvos/Assets.xcassets/LaunchImage.launchimage/Contents.json +7 -0
  160. data/assets/tvos/MRuby.framework/Headers/mrbconf.h +3 -5
  161. data/assets/tvos/MRuby.framework/Headers/mruby.h +35 -32
  162. data/assets/tvos/MRuby.framework/Headers/mruby/array.h +1 -0
  163. data/assets/tvos/MRuby.framework/Headers/mruby/boxing_word.h +9 -1
  164. data/assets/tvos/MRuby.framework/Headers/mruby/class.h +14 -11
  165. data/assets/tvos/MRuby.framework/Headers/mruby/common.h +5 -0
  166. data/assets/tvos/MRuby.framework/Headers/mruby/compile.h +4 -3
  167. data/assets/tvos/MRuby.framework/Headers/mruby/debug.h +3 -2
  168. data/assets/tvos/MRuby.framework/Headers/mruby/dump.h +2 -2
  169. data/assets/tvos/MRuby.framework/Headers/mruby/hash.h +38 -5
  170. data/assets/tvos/MRuby.framework/Headers/mruby/irep.h +17 -4
  171. data/assets/tvos/MRuby.framework/Headers/mruby/object.h +4 -5
  172. data/assets/tvos/MRuby.framework/Headers/mruby/opcode.h +47 -139
  173. data/assets/tvos/MRuby.framework/Headers/mruby/ops.h +117 -0
  174. data/assets/tvos/MRuby.framework/Headers/mruby/proc.h +4 -4
  175. data/assets/tvos/MRuby.framework/Headers/mruby/string.h +11 -7
  176. data/assets/tvos/MRuby.framework/Headers/mruby/throw.h +4 -4
  177. data/assets/tvos/MRuby.framework/Headers/mruby/variable.h +2 -4
  178. data/assets/tvos/MRuby.framework/Headers/mruby/version.h +6 -6
  179. data/assets/tvos/MRuby.framework/MRuby +0 -0
  180. data/assets/tvos/MyApp.xcodeproj/project.pbxproj +25 -19
  181. data/assets/tvos/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  182. data/assets/tvos/main.c +1 -1
  183. data/ext/ruby2d/extconf.rb +59 -50
  184. data/ext/ruby2d/ruby2d.c +0 -1
  185. data/lib/ruby2d.rb +1 -7
  186. data/lib/ruby2d/cli/launch.rb +1 -1
  187. data/lib/ruby2d/font.rb +32 -7
  188. data/lib/ruby2d/version.rb +1 -1
  189. metadata +132 -6
  190. data/assets/opal.js +0 -21637
  191. data/assets/simple2d.js +0 -1379
  192. data/assets/template.html +0 -18
@@ -0,0 +1,260 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2018 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_endian.h
24
+ *
25
+ * Functions for reading and writing endian-specific values
26
+ */
27
+
28
+ #ifndef SDL_endian_h_
29
+ #define SDL_endian_h_
30
+
31
+ #include "SDL_stdinc.h"
32
+
33
+ /**
34
+ * \name The two types of endianness
35
+ */
36
+ /* @{ */
37
+ #define SDL_LIL_ENDIAN 1234
38
+ #define SDL_BIG_ENDIAN 4321
39
+ /* @} */
40
+
41
+ #ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
42
+ #ifdef __linux__
43
+ #include <endian.h>
44
+ #define SDL_BYTEORDER __BYTE_ORDER
45
+ #else /* __linux__ */
46
+ #if defined(__hppa__) || \
47
+ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
48
+ (defined(__MIPS__) && defined(__MISPEB__)) || \
49
+ defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
50
+ defined(__sparc__)
51
+ #define SDL_BYTEORDER SDL_BIG_ENDIAN
52
+ #else
53
+ #define SDL_BYTEORDER SDL_LIL_ENDIAN
54
+ #endif
55
+ #endif /* __linux__ */
56
+ #endif /* !SDL_BYTEORDER */
57
+
58
+
59
+ #include "begin_code.h"
60
+ /* Set up for C function definitions, even when using C++ */
61
+ #ifdef __cplusplus
62
+ extern "C" {
63
+ #endif
64
+
65
+ /**
66
+ * \file SDL_endian.h
67
+ */
68
+ #if defined(__GNUC__) && defined(__i386__) && \
69
+ !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
70
+ SDL_FORCE_INLINE Uint16
71
+ SDL_Swap16(Uint16 x)
72
+ {
73
+ __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
74
+ return x;
75
+ }
76
+ #elif defined(__GNUC__) && defined(__x86_64__)
77
+ SDL_FORCE_INLINE Uint16
78
+ SDL_Swap16(Uint16 x)
79
+ {
80
+ __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
81
+ return x;
82
+ }
83
+ #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
84
+ SDL_FORCE_INLINE Uint16
85
+ SDL_Swap16(Uint16 x)
86
+ {
87
+ int result;
88
+
89
+ __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
90
+ return (Uint16)result;
91
+ }
92
+ #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
93
+ SDL_FORCE_INLINE Uint16
94
+ SDL_Swap16(Uint16 x)
95
+ {
96
+ __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
97
+ return x;
98
+ }
99
+ #elif defined(__WATCOMC__) && defined(__386__)
100
+ extern _inline Uint16 SDL_Swap16(Uint16);
101
+ #pragma aux SDL_Swap16 = \
102
+ "xchg al, ah" \
103
+ parm [ax] \
104
+ modify [ax];
105
+ #else
106
+ SDL_FORCE_INLINE Uint16
107
+ SDL_Swap16(Uint16 x)
108
+ {
109
+ return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
110
+ }
111
+ #endif
112
+
113
+ #if defined(__GNUC__) && defined(__i386__)
114
+ SDL_FORCE_INLINE Uint32
115
+ SDL_Swap32(Uint32 x)
116
+ {
117
+ __asm__("bswap %0": "=r"(x):"0"(x));
118
+ return x;
119
+ }
120
+ #elif defined(__GNUC__) && defined(__x86_64__)
121
+ SDL_FORCE_INLINE Uint32
122
+ SDL_Swap32(Uint32 x)
123
+ {
124
+ __asm__("bswapl %0": "=r"(x):"0"(x));
125
+ return x;
126
+ }
127
+ #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
128
+ SDL_FORCE_INLINE Uint32
129
+ SDL_Swap32(Uint32 x)
130
+ {
131
+ Uint32 result;
132
+
133
+ __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x));
134
+ __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x));
135
+ __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x));
136
+ return result;
137
+ }
138
+ #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
139
+ SDL_FORCE_INLINE Uint32
140
+ SDL_Swap32(Uint32 x)
141
+ {
142
+ __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
143
+ return x;
144
+ }
145
+ #elif defined(__WATCOMC__) && defined(__386__)
146
+ extern _inline Uint32 SDL_Swap32(Uint32);
147
+ #ifndef __SW_3 /* 486+ */
148
+ #pragma aux SDL_Swap32 = \
149
+ "bswap eax" \
150
+ parm [eax] \
151
+ modify [eax];
152
+ #else /* 386-only */
153
+ #pragma aux SDL_Swap32 = \
154
+ "xchg al, ah" \
155
+ "ror eax, 16" \
156
+ "xchg al, ah" \
157
+ parm [eax] \
158
+ modify [eax];
159
+ #endif
160
+ #else
161
+ SDL_FORCE_INLINE Uint32
162
+ SDL_Swap32(Uint32 x)
163
+ {
164
+ return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
165
+ ((x >> 8) & 0x0000FF00) | (x >> 24)));
166
+ }
167
+ #endif
168
+
169
+ #if defined(__GNUC__) && defined(__i386__)
170
+ SDL_FORCE_INLINE Uint64
171
+ SDL_Swap64(Uint64 x)
172
+ {
173
+ union
174
+ {
175
+ struct
176
+ {
177
+ Uint32 a, b;
178
+ } s;
179
+ Uint64 u;
180
+ } v;
181
+ v.u = x;
182
+ __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
183
+ "1"(v.s.
184
+ b));
185
+ return v.u;
186
+ }
187
+ #elif defined(__GNUC__) && defined(__x86_64__)
188
+ SDL_FORCE_INLINE Uint64
189
+ SDL_Swap64(Uint64 x)
190
+ {
191
+ __asm__("bswapq %0": "=r"(x):"0"(x));
192
+ return x;
193
+ }
194
+ #else
195
+ SDL_FORCE_INLINE Uint64
196
+ SDL_Swap64(Uint64 x)
197
+ {
198
+ Uint32 hi, lo;
199
+
200
+ /* Separate into high and low 32-bit values and swap them */
201
+ lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
202
+ x >>= 32;
203
+ hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
204
+ x = SDL_Swap32(lo);
205
+ x <<= 32;
206
+ x |= SDL_Swap32(hi);
207
+ return (x);
208
+ }
209
+ #endif
210
+
211
+
212
+ SDL_FORCE_INLINE float
213
+ SDL_SwapFloat(float x)
214
+ {
215
+ union
216
+ {
217
+ float f;
218
+ Uint32 ui32;
219
+ } swapper;
220
+ swapper.f = x;
221
+ swapper.ui32 = SDL_Swap32(swapper.ui32);
222
+ return swapper.f;
223
+ }
224
+
225
+
226
+ /**
227
+ * \name Swap to native
228
+ * Byteswap item from the specified endianness to the native endianness.
229
+ */
230
+ /* @{ */
231
+ #if SDL_BYTEORDER == SDL_LIL_ENDIAN
232
+ #define SDL_SwapLE16(X) (X)
233
+ #define SDL_SwapLE32(X) (X)
234
+ #define SDL_SwapLE64(X) (X)
235
+ #define SDL_SwapFloatLE(X) (X)
236
+ #define SDL_SwapBE16(X) SDL_Swap16(X)
237
+ #define SDL_SwapBE32(X) SDL_Swap32(X)
238
+ #define SDL_SwapBE64(X) SDL_Swap64(X)
239
+ #define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
240
+ #else
241
+ #define SDL_SwapLE16(X) SDL_Swap16(X)
242
+ #define SDL_SwapLE32(X) SDL_Swap32(X)
243
+ #define SDL_SwapLE64(X) SDL_Swap64(X)
244
+ #define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
245
+ #define SDL_SwapBE16(X) (X)
246
+ #define SDL_SwapBE32(X) (X)
247
+ #define SDL_SwapBE64(X) (X)
248
+ #define SDL_SwapFloatBE(X) (X)
249
+ #endif
250
+ /* @} *//* Swap to native */
251
+
252
+ /* Ends C function definitions when using C++ */
253
+ #ifdef __cplusplus
254
+ }
255
+ #endif
256
+ #include "close_code.h"
257
+
258
+ #endif /* SDL_endian_h_ */
259
+
260
+ /* vi: set ts=4 sw=4 expandtab: */
@@ -0,0 +1,76 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2018 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_error.h
24
+ *
25
+ * Simple error message routines for SDL.
26
+ */
27
+
28
+ #ifndef SDL_error_h_
29
+ #define SDL_error_h_
30
+
31
+ #include "SDL_stdinc.h"
32
+
33
+ #include "begin_code.h"
34
+ /* Set up for C function definitions, even when using C++ */
35
+ #ifdef __cplusplus
36
+ extern "C" {
37
+ #endif
38
+
39
+ /* Public functions */
40
+ /* SDL_SetError() unconditionally returns -1. */
41
+ extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
42
+ extern DECLSPEC const char *SDLCALL SDL_GetError(void);
43
+ extern DECLSPEC void SDLCALL SDL_ClearError(void);
44
+
45
+ /**
46
+ * \name Internal error functions
47
+ *
48
+ * \internal
49
+ * Private error reporting function - used internally.
50
+ */
51
+ /* @{ */
52
+ #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
53
+ #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
54
+ #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
55
+ typedef enum
56
+ {
57
+ SDL_ENOMEM,
58
+ SDL_EFREAD,
59
+ SDL_EFWRITE,
60
+ SDL_EFSEEK,
61
+ SDL_UNSUPPORTED,
62
+ SDL_LASTERROR
63
+ } SDL_errorcode;
64
+ /* SDL_Error() unconditionally returns -1. */
65
+ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
66
+ /* @} *//* Internal error functions */
67
+
68
+ /* Ends C function definitions when using C++ */
69
+ #ifdef __cplusplus
70
+ }
71
+ #endif
72
+ #include "close_code.h"
73
+
74
+ #endif /* SDL_error_h_ */
75
+
76
+ /* vi: set ts=4 sw=4 expandtab: */
@@ -0,0 +1,788 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2018 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_events.h
24
+ *
25
+ * Include file for SDL event handling.
26
+ */
27
+
28
+ #ifndef SDL_events_h_
29
+ #define SDL_events_h_
30
+
31
+ #include "SDL_stdinc.h"
32
+ #include "SDL_error.h"
33
+ #include "SDL_video.h"
34
+ #include "SDL_keyboard.h"
35
+ #include "SDL_mouse.h"
36
+ #include "SDL_joystick.h"
37
+ #include "SDL_gamecontroller.h"
38
+ #include "SDL_quit.h"
39
+ #include "SDL_gesture.h"
40
+ #include "SDL_touch.h"
41
+
42
+ #include "begin_code.h"
43
+ /* Set up for C function definitions, even when using C++ */
44
+ #ifdef __cplusplus
45
+ extern "C" {
46
+ #endif
47
+
48
+ /* General keyboard/mouse state definitions */
49
+ #define SDL_RELEASED 0
50
+ #define SDL_PRESSED 1
51
+
52
+ /**
53
+ * \brief The types of events that can be delivered.
54
+ */
55
+ typedef enum
56
+ {
57
+ SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
58
+
59
+ /* Application events */
60
+ SDL_QUIT = 0x100, /**< User-requested quit */
61
+
62
+ /* These application events have special meaning on iOS, see README-ios.md for details */
63
+ SDL_APP_TERMINATING, /**< The application is being terminated by the OS
64
+ Called on iOS in applicationWillTerminate()
65
+ Called on Android in onDestroy()
66
+ */
67
+ SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
68
+ Called on iOS in applicationDidReceiveMemoryWarning()
69
+ Called on Android in onLowMemory()
70
+ */
71
+ SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
72
+ Called on iOS in applicationWillResignActive()
73
+ Called on Android in onPause()
74
+ */
75
+ SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
76
+ Called on iOS in applicationDidEnterBackground()
77
+ Called on Android in onPause()
78
+ */
79
+ SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
80
+ Called on iOS in applicationWillEnterForeground()
81
+ Called on Android in onResume()
82
+ */
83
+ SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
84
+ Called on iOS in applicationDidBecomeActive()
85
+ Called on Android in onResume()
86
+ */
87
+
88
+ /* Display events */
89
+ SDL_DISPLAYEVENT = 0x150, /**< Display state change */
90
+
91
+ /* Window events */
92
+ SDL_WINDOWEVENT = 0x200, /**< Window state change */
93
+ SDL_SYSWMEVENT, /**< System specific event */
94
+
95
+ /* Keyboard events */
96
+ SDL_KEYDOWN = 0x300, /**< Key pressed */
97
+ SDL_KEYUP, /**< Key released */
98
+ SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
99
+ SDL_TEXTINPUT, /**< Keyboard text input */
100
+ SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
101
+ input language or keyboard layout change.
102
+ */
103
+
104
+ /* Mouse events */
105
+ SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
106
+ SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */
107
+ SDL_MOUSEBUTTONUP, /**< Mouse button released */
108
+ SDL_MOUSEWHEEL, /**< Mouse wheel motion */
109
+
110
+ /* Joystick events */
111
+ SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
112
+ SDL_JOYBALLMOTION, /**< Joystick trackball motion */
113
+ SDL_JOYHATMOTION, /**< Joystick hat position change */
114
+ SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
115
+ SDL_JOYBUTTONUP, /**< Joystick button released */
116
+ SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */
117
+ SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */
118
+
119
+ /* Game controller events */
120
+ SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */
121
+ SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */
122
+ SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
123
+ SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
124
+ SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
125
+ SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
126
+
127
+ /* Touch events */
128
+ SDL_FINGERDOWN = 0x700,
129
+ SDL_FINGERUP,
130
+ SDL_FINGERMOTION,
131
+
132
+ /* Gesture events */
133
+ SDL_DOLLARGESTURE = 0x800,
134
+ SDL_DOLLARRECORD,
135
+ SDL_MULTIGESTURE,
136
+
137
+ /* Clipboard events */
138
+ SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
139
+
140
+ /* Drag and drop events */
141
+ SDL_DROPFILE = 0x1000, /**< The system requests a file open */
142
+ SDL_DROPTEXT, /**< text/plain drag-and-drop event */
143
+ SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */
144
+ SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */
145
+
146
+ /* Audio hotplug events */
147
+ SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
148
+ SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
149
+
150
+ /* Sensor events */
151
+ SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */
152
+
153
+ /* Render events */
154
+ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
155
+ SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
156
+
157
+ /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
158
+ * and should be allocated with SDL_RegisterEvents()
159
+ */
160
+ SDL_USEREVENT = 0x8000,
161
+
162
+ /**
163
+ * This last event is only for bounding internal arrays
164
+ */
165
+ SDL_LASTEVENT = 0xFFFF
166
+ } SDL_EventType;
167
+
168
+ /**
169
+ * \brief Fields shared by every event
170
+ */
171
+ typedef struct SDL_CommonEvent
172
+ {
173
+ Uint32 type;
174
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
175
+ } SDL_CommonEvent;
176
+
177
+ /**
178
+ * \brief Display state change event data (event.display.*)
179
+ */
180
+ typedef struct SDL_DisplayEvent
181
+ {
182
+ Uint32 type; /**< ::SDL_DISPLAYEVENT */
183
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
184
+ Uint32 display; /**< The associated display index */
185
+ Uint8 event; /**< ::SDL_DisplayEventID */
186
+ Uint8 padding1;
187
+ Uint8 padding2;
188
+ Uint8 padding3;
189
+ Sint32 data1; /**< event dependent data */
190
+ } SDL_DisplayEvent;
191
+
192
+ /**
193
+ * \brief Window state change event data (event.window.*)
194
+ */
195
+ typedef struct SDL_WindowEvent
196
+ {
197
+ Uint32 type; /**< ::SDL_WINDOWEVENT */
198
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
199
+ Uint32 windowID; /**< The associated window */
200
+ Uint8 event; /**< ::SDL_WindowEventID */
201
+ Uint8 padding1;
202
+ Uint8 padding2;
203
+ Uint8 padding3;
204
+ Sint32 data1; /**< event dependent data */
205
+ Sint32 data2; /**< event dependent data */
206
+ } SDL_WindowEvent;
207
+
208
+ /**
209
+ * \brief Keyboard button event structure (event.key.*)
210
+ */
211
+ typedef struct SDL_KeyboardEvent
212
+ {
213
+ Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
214
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
215
+ Uint32 windowID; /**< The window with keyboard focus, if any */
216
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
217
+ Uint8 repeat; /**< Non-zero if this is a key repeat */
218
+ Uint8 padding2;
219
+ Uint8 padding3;
220
+ SDL_Keysym keysym; /**< The key that was pressed or released */
221
+ } SDL_KeyboardEvent;
222
+
223
+ #define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
224
+ /**
225
+ * \brief Keyboard text editing event structure (event.edit.*)
226
+ */
227
+ typedef struct SDL_TextEditingEvent
228
+ {
229
+ Uint32 type; /**< ::SDL_TEXTEDITING */
230
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
231
+ Uint32 windowID; /**< The window with keyboard focus, if any */
232
+ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
233
+ Sint32 start; /**< The start cursor of selected editing text */
234
+ Sint32 length; /**< The length of selected editing text */
235
+ } SDL_TextEditingEvent;
236
+
237
+
238
+ #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
239
+ /**
240
+ * \brief Keyboard text input event structure (event.text.*)
241
+ */
242
+ typedef struct SDL_TextInputEvent
243
+ {
244
+ Uint32 type; /**< ::SDL_TEXTINPUT */
245
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
246
+ Uint32 windowID; /**< The window with keyboard focus, if any */
247
+ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
248
+ } SDL_TextInputEvent;
249
+
250
+ /**
251
+ * \brief Mouse motion event structure (event.motion.*)
252
+ */
253
+ typedef struct SDL_MouseMotionEvent
254
+ {
255
+ Uint32 type; /**< ::SDL_MOUSEMOTION */
256
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
257
+ Uint32 windowID; /**< The window with mouse focus, if any */
258
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
259
+ Uint32 state; /**< The current button state */
260
+ Sint32 x; /**< X coordinate, relative to window */
261
+ Sint32 y; /**< Y coordinate, relative to window */
262
+ Sint32 xrel; /**< The relative motion in the X direction */
263
+ Sint32 yrel; /**< The relative motion in the Y direction */
264
+ } SDL_MouseMotionEvent;
265
+
266
+ /**
267
+ * \brief Mouse button event structure (event.button.*)
268
+ */
269
+ typedef struct SDL_MouseButtonEvent
270
+ {
271
+ Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
272
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
273
+ Uint32 windowID; /**< The window with mouse focus, if any */
274
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
275
+ Uint8 button; /**< The mouse button index */
276
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
277
+ Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
278
+ Uint8 padding1;
279
+ Sint32 x; /**< X coordinate, relative to window */
280
+ Sint32 y; /**< Y coordinate, relative to window */
281
+ } SDL_MouseButtonEvent;
282
+
283
+ /**
284
+ * \brief Mouse wheel event structure (event.wheel.*)
285
+ */
286
+ typedef struct SDL_MouseWheelEvent
287
+ {
288
+ Uint32 type; /**< ::SDL_MOUSEWHEEL */
289
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
290
+ Uint32 windowID; /**< The window with mouse focus, if any */
291
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
292
+ Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
293
+ Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
294
+ 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 */
295
+ } SDL_MouseWheelEvent;
296
+
297
+ /**
298
+ * \brief Joystick axis motion event structure (event.jaxis.*)
299
+ */
300
+ typedef struct SDL_JoyAxisEvent
301
+ {
302
+ Uint32 type; /**< ::SDL_JOYAXISMOTION */
303
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
304
+ SDL_JoystickID which; /**< The joystick instance id */
305
+ Uint8 axis; /**< The joystick axis index */
306
+ Uint8 padding1;
307
+ Uint8 padding2;
308
+ Uint8 padding3;
309
+ Sint16 value; /**< The axis value (range: -32768 to 32767) */
310
+ Uint16 padding4;
311
+ } SDL_JoyAxisEvent;
312
+
313
+ /**
314
+ * \brief Joystick trackball motion event structure (event.jball.*)
315
+ */
316
+ typedef struct SDL_JoyBallEvent
317
+ {
318
+ Uint32 type; /**< ::SDL_JOYBALLMOTION */
319
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
320
+ SDL_JoystickID which; /**< The joystick instance id */
321
+ Uint8 ball; /**< The joystick trackball index */
322
+ Uint8 padding1;
323
+ Uint8 padding2;
324
+ Uint8 padding3;
325
+ Sint16 xrel; /**< The relative motion in the X direction */
326
+ Sint16 yrel; /**< The relative motion in the Y direction */
327
+ } SDL_JoyBallEvent;
328
+
329
+ /**
330
+ * \brief Joystick hat position change event structure (event.jhat.*)
331
+ */
332
+ typedef struct SDL_JoyHatEvent
333
+ {
334
+ Uint32 type; /**< ::SDL_JOYHATMOTION */
335
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
336
+ SDL_JoystickID which; /**< The joystick instance id */
337
+ Uint8 hat; /**< The joystick hat index */
338
+ Uint8 value; /**< The hat position value.
339
+ * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
340
+ * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
341
+ * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
342
+ *
343
+ * Note that zero means the POV is centered.
344
+ */
345
+ Uint8 padding1;
346
+ Uint8 padding2;
347
+ } SDL_JoyHatEvent;
348
+
349
+ /**
350
+ * \brief Joystick button event structure (event.jbutton.*)
351
+ */
352
+ typedef struct SDL_JoyButtonEvent
353
+ {
354
+ Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
355
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
356
+ SDL_JoystickID which; /**< The joystick instance id */
357
+ Uint8 button; /**< The joystick button index */
358
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
359
+ Uint8 padding1;
360
+ Uint8 padding2;
361
+ } SDL_JoyButtonEvent;
362
+
363
+ /**
364
+ * \brief Joystick device event structure (event.jdevice.*)
365
+ */
366
+ typedef struct SDL_JoyDeviceEvent
367
+ {
368
+ Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
369
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
370
+ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
371
+ } SDL_JoyDeviceEvent;
372
+
373
+
374
+ /**
375
+ * \brief Game controller axis motion event structure (event.caxis.*)
376
+ */
377
+ typedef struct SDL_ControllerAxisEvent
378
+ {
379
+ Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
380
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
381
+ SDL_JoystickID which; /**< The joystick instance id */
382
+ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
383
+ Uint8 padding1;
384
+ Uint8 padding2;
385
+ Uint8 padding3;
386
+ Sint16 value; /**< The axis value (range: -32768 to 32767) */
387
+ Uint16 padding4;
388
+ } SDL_ControllerAxisEvent;
389
+
390
+
391
+ /**
392
+ * \brief Game controller button event structure (event.cbutton.*)
393
+ */
394
+ typedef struct SDL_ControllerButtonEvent
395
+ {
396
+ Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
397
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
398
+ SDL_JoystickID which; /**< The joystick instance id */
399
+ Uint8 button; /**< The controller button (SDL_GameControllerButton) */
400
+ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
401
+ Uint8 padding1;
402
+ Uint8 padding2;
403
+ } SDL_ControllerButtonEvent;
404
+
405
+
406
+ /**
407
+ * \brief Controller device event structure (event.cdevice.*)
408
+ */
409
+ typedef struct SDL_ControllerDeviceEvent
410
+ {
411
+ Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
412
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
413
+ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
414
+ } SDL_ControllerDeviceEvent;
415
+
416
+ /**
417
+ * \brief Audio device event structure (event.adevice.*)
418
+ */
419
+ typedef struct SDL_AudioDeviceEvent
420
+ {
421
+ Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
422
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
423
+ Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
424
+ Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
425
+ Uint8 padding1;
426
+ Uint8 padding2;
427
+ Uint8 padding3;
428
+ } SDL_AudioDeviceEvent;
429
+
430
+
431
+ /**
432
+ * \brief Touch finger event structure (event.tfinger.*)
433
+ */
434
+ typedef struct SDL_TouchFingerEvent
435
+ {
436
+ Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
437
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
438
+ SDL_TouchID touchId; /**< The touch device id */
439
+ SDL_FingerID fingerId;
440
+ float x; /**< Normalized in the range 0...1 */
441
+ float y; /**< Normalized in the range 0...1 */
442
+ float dx; /**< Normalized in the range -1...1 */
443
+ float dy; /**< Normalized in the range -1...1 */
444
+ float pressure; /**< Normalized in the range 0...1 */
445
+ } SDL_TouchFingerEvent;
446
+
447
+
448
+ /**
449
+ * \brief Multiple Finger Gesture Event (event.mgesture.*)
450
+ */
451
+ typedef struct SDL_MultiGestureEvent
452
+ {
453
+ Uint32 type; /**< ::SDL_MULTIGESTURE */
454
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
455
+ SDL_TouchID touchId; /**< The touch device id */
456
+ float dTheta;
457
+ float dDist;
458
+ float x;
459
+ float y;
460
+ Uint16 numFingers;
461
+ Uint16 padding;
462
+ } SDL_MultiGestureEvent;
463
+
464
+
465
+ /**
466
+ * \brief Dollar Gesture Event (event.dgesture.*)
467
+ */
468
+ typedef struct SDL_DollarGestureEvent
469
+ {
470
+ Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
471
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
472
+ SDL_TouchID touchId; /**< The touch device id */
473
+ SDL_GestureID gestureId;
474
+ Uint32 numFingers;
475
+ float error;
476
+ float x; /**< Normalized center of gesture */
477
+ float y; /**< Normalized center of gesture */
478
+ } SDL_DollarGestureEvent;
479
+
480
+
481
+ /**
482
+ * \brief An event used to request a file open by the system (event.drop.*)
483
+ * This event is enabled by default, you can disable it with SDL_EventState().
484
+ * \note If this event is enabled, you must free the filename in the event.
485
+ */
486
+ typedef struct SDL_DropEvent
487
+ {
488
+ Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
489
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
490
+ char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
491
+ Uint32 windowID; /**< The window that was dropped on, if any */
492
+ } SDL_DropEvent;
493
+
494
+
495
+ /**
496
+ * \brief Sensor event structure (event.sensor.*)
497
+ */
498
+ typedef struct SDL_SensorEvent
499
+ {
500
+ Uint32 type; /**< ::SDL_SENSORUPDATE */
501
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
502
+ Sint32 which; /**< The instance ID of the sensor */
503
+ float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
504
+ } SDL_SensorEvent;
505
+
506
+ /**
507
+ * \brief The "quit requested" event
508
+ */
509
+ typedef struct SDL_QuitEvent
510
+ {
511
+ Uint32 type; /**< ::SDL_QUIT */
512
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
513
+ } SDL_QuitEvent;
514
+
515
+ /**
516
+ * \brief OS Specific event
517
+ */
518
+ typedef struct SDL_OSEvent
519
+ {
520
+ Uint32 type; /**< ::SDL_QUIT */
521
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
522
+ } SDL_OSEvent;
523
+
524
+ /**
525
+ * \brief A user-defined event type (event.user.*)
526
+ */
527
+ typedef struct SDL_UserEvent
528
+ {
529
+ Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
530
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
531
+ Uint32 windowID; /**< The associated window if any */
532
+ Sint32 code; /**< User defined event code */
533
+ void *data1; /**< User defined data pointer */
534
+ void *data2; /**< User defined data pointer */
535
+ } SDL_UserEvent;
536
+
537
+
538
+ struct SDL_SysWMmsg;
539
+ typedef struct SDL_SysWMmsg SDL_SysWMmsg;
540
+
541
+ /**
542
+ * \brief A video driver dependent system event (event.syswm.*)
543
+ * This event is disabled by default, you can enable it with SDL_EventState()
544
+ *
545
+ * \note If you want to use this event, you should include SDL_syswm.h.
546
+ */
547
+ typedef struct SDL_SysWMEvent
548
+ {
549
+ Uint32 type; /**< ::SDL_SYSWMEVENT */
550
+ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
551
+ SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
552
+ } SDL_SysWMEvent;
553
+
554
+ /**
555
+ * \brief General event structure
556
+ */
557
+ typedef union SDL_Event
558
+ {
559
+ Uint32 type; /**< Event type, shared with all events */
560
+ SDL_CommonEvent common; /**< Common event data */
561
+ SDL_DisplayEvent display; /**< Window event data */
562
+ SDL_WindowEvent window; /**< Window event data */
563
+ SDL_KeyboardEvent key; /**< Keyboard event data */
564
+ SDL_TextEditingEvent edit; /**< Text editing event data */
565
+ SDL_TextInputEvent text; /**< Text input event data */
566
+ SDL_MouseMotionEvent motion; /**< Mouse motion event data */
567
+ SDL_MouseButtonEvent button; /**< Mouse button event data */
568
+ SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
569
+ SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
570
+ SDL_JoyBallEvent jball; /**< Joystick ball event data */
571
+ SDL_JoyHatEvent jhat; /**< Joystick hat event data */
572
+ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
573
+ SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
574
+ SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
575
+ SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
576
+ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
577
+ SDL_AudioDeviceEvent adevice; /**< Audio device event data */
578
+ SDL_SensorEvent sensor; /**< Sensor event data */
579
+ SDL_QuitEvent quit; /**< Quit request event data */
580
+ SDL_UserEvent user; /**< Custom event data */
581
+ SDL_SysWMEvent syswm; /**< System dependent window event data */
582
+ SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
583
+ SDL_MultiGestureEvent mgesture; /**< Gesture event data */
584
+ SDL_DollarGestureEvent dgesture; /**< Gesture event data */
585
+ SDL_DropEvent drop; /**< Drag and drop event data */
586
+
587
+ /* This is necessary for ABI compatibility between Visual C++ and GCC
588
+ Visual C++ will respect the push pack pragma and use 52 bytes for
589
+ this structure, and GCC will use the alignment of the largest datatype
590
+ within the union, which is 8 bytes.
591
+
592
+ So... we'll add padding to force the size to be 56 bytes for both.
593
+ */
594
+ Uint8 padding[56];
595
+ } SDL_Event;
596
+
597
+
598
+ /* Function prototypes */
599
+
600
+ /**
601
+ * Pumps the event loop, gathering events from the input devices.
602
+ *
603
+ * This function updates the event queue and internal input device state.
604
+ *
605
+ * This should only be run in the thread that sets the video mode.
606
+ */
607
+ extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
608
+
609
+ /* @{ */
610
+ typedef enum
611
+ {
612
+ SDL_ADDEVENT,
613
+ SDL_PEEKEVENT,
614
+ SDL_GETEVENT
615
+ } SDL_eventaction;
616
+
617
+ /**
618
+ * Checks the event queue for messages and optionally returns them.
619
+ *
620
+ * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
621
+ * the back of the event queue.
622
+ *
623
+ * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
624
+ * of the event queue, within the specified minimum and maximum type,
625
+ * will be returned and will not be removed from the queue.
626
+ *
627
+ * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
628
+ * of the event queue, within the specified minimum and maximum type,
629
+ * will be returned and will be removed from the queue.
630
+ *
631
+ * \return The number of events actually stored, or -1 if there was an error.
632
+ *
633
+ * This function is thread-safe.
634
+ */
635
+ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
636
+ SDL_eventaction action,
637
+ Uint32 minType, Uint32 maxType);
638
+ /* @} */
639
+
640
+ /**
641
+ * Checks to see if certain event types are in the event queue.
642
+ */
643
+ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
644
+ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
645
+
646
+ /**
647
+ * This function clears events from the event queue
648
+ * This function only affects currently queued events. If you want to make
649
+ * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
650
+ * on the main thread immediately before the flush call.
651
+ */
652
+ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
653
+ extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
654
+
655
+ /**
656
+ * \brief Polls for currently pending events.
657
+ *
658
+ * \return 1 if there are any pending events, or 0 if there are none available.
659
+ *
660
+ * \param event If not NULL, the next event is removed from the queue and
661
+ * stored in that area.
662
+ */
663
+ extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
664
+
665
+ /**
666
+ * \brief Waits indefinitely for the next available event.
667
+ *
668
+ * \return 1, or 0 if there was an error while waiting for events.
669
+ *
670
+ * \param event If not NULL, the next event is removed from the queue and
671
+ * stored in that area.
672
+ */
673
+ extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
674
+
675
+ /**
676
+ * \brief Waits until the specified timeout (in milliseconds) for the next
677
+ * available event.
678
+ *
679
+ * \return 1, or 0 if there was an error while waiting for events.
680
+ *
681
+ * \param event If not NULL, the next event is removed from the queue and
682
+ * stored in that area.
683
+ * \param timeout The timeout (in milliseconds) to wait for next event.
684
+ */
685
+ extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
686
+ int timeout);
687
+
688
+ /**
689
+ * \brief Add an event to the event queue.
690
+ *
691
+ * \return 1 on success, 0 if the event was filtered, or -1 if the event queue
692
+ * was full or there was some other error.
693
+ */
694
+ extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
695
+
696
+ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
697
+
698
+ /**
699
+ * Sets up a filter to process all events before they change internal state and
700
+ * are posted to the internal event queue.
701
+ *
702
+ * The filter is prototyped as:
703
+ * \code
704
+ * int SDL_EventFilter(void *userdata, SDL_Event * event);
705
+ * \endcode
706
+ *
707
+ * If the filter returns 1, then the event will be added to the internal queue.
708
+ * If it returns 0, then the event will be dropped from the queue, but the
709
+ * internal state will still be updated. This allows selective filtering of
710
+ * dynamically arriving events.
711
+ *
712
+ * \warning Be very careful of what you do in the event filter function, as
713
+ * it may run in a different thread!
714
+ *
715
+ * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
716
+ * event filter is only called when the window manager desires to close the
717
+ * application window. If the event filter returns 1, then the window will
718
+ * be closed, otherwise the window will remain open if possible.
719
+ *
720
+ * If the quit event is generated by an interrupt signal, it will bypass the
721
+ * internal queue and be delivered to the application at the next event poll.
722
+ */
723
+ extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
724
+ void *userdata);
725
+
726
+ /**
727
+ * Return the current event filter - can be used to "chain" filters.
728
+ * If there is no event filter set, this function returns SDL_FALSE.
729
+ */
730
+ extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
731
+ void **userdata);
732
+
733
+ /**
734
+ * Add a function which is called when an event is added to the queue.
735
+ */
736
+ extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
737
+ void *userdata);
738
+
739
+ /**
740
+ * Remove an event watch function added with SDL_AddEventWatch()
741
+ */
742
+ extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
743
+ void *userdata);
744
+
745
+ /**
746
+ * Run the filter function on the current event queue, removing any
747
+ * events for which the filter returns 0.
748
+ */
749
+ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
750
+ void *userdata);
751
+
752
+ /* @{ */
753
+ #define SDL_QUERY -1
754
+ #define SDL_IGNORE 0
755
+ #define SDL_DISABLE 0
756
+ #define SDL_ENABLE 1
757
+
758
+ /**
759
+ * This function allows you to set the state of processing certain events.
760
+ * - If \c state is set to ::SDL_IGNORE, that event will be automatically
761
+ * dropped from the event queue and will not be filtered.
762
+ * - If \c state is set to ::SDL_ENABLE, that event will be processed
763
+ * normally.
764
+ * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the
765
+ * current processing state of the specified event.
766
+ */
767
+ extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
768
+ /* @} */
769
+ #define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)
770
+
771
+ /**
772
+ * This function allocates a set of user-defined events, and returns
773
+ * the beginning event number for that set of events.
774
+ *
775
+ * If there aren't enough user-defined events left, this function
776
+ * returns (Uint32)-1
777
+ */
778
+ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
779
+
780
+ /* Ends C function definitions when using C++ */
781
+ #ifdef __cplusplus
782
+ }
783
+ #endif
784
+ #include "close_code.h"
785
+
786
+ #endif /* SDL_events_h_ */
787
+
788
+ /* vi: set ts=4 sw=4 expandtab: */