SDLRuby 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +31 -0
- data/Rakefile +12 -0
- data/lib/SDLRuby/audio.rb +65 -0
- data/lib/SDLRuby/cursor.rb +46 -0
- data/lib/SDLRuby/display.rb +79 -0
- data/lib/SDLRuby/event/accessor.rb +127 -0
- data/lib/SDLRuby/event/type.rb +75 -0
- data/lib/SDLRuby/event.rb +80 -0
- data/lib/SDLRuby/font.rb +227 -0
- data/lib/SDLRuby/hint.rb +36 -0
- data/lib/SDLRuby/image/image.rb +23 -0
- data/lib/SDLRuby/image/include/SDL_image.h.rb +61 -0
- data/lib/SDLRuby/image.rb +69 -0
- data/lib/SDLRuby/keyboard.rb +58 -0
- data/lib/SDLRuby/mixer/channel.rb +43 -0
- data/lib/SDLRuby/mixer/chunk.rb +49 -0
- data/lib/SDLRuby/mixer/controller.rb +44 -0
- data/lib/SDLRuby/mixer/include/SDL_mixer.h.rb +95 -0
- data/lib/SDLRuby/mixer/sdl_mixer.rb +60 -0
- data/lib/SDLRuby/mixer.rb +87 -0
- data/lib/SDLRuby/mouse.rb +52 -0
- data/lib/SDLRuby/music.rb +158 -0
- data/lib/SDLRuby/palette.rb +49 -0
- data/lib/SDLRuby/pixel_formatter.rb +67 -0
- data/lib/SDLRuby/rect.rb +11 -0
- data/lib/SDLRuby/renderer/accessor.rb +70 -0
- data/lib/SDLRuby/renderer/drawer.rb +107 -0
- data/lib/SDLRuby/renderer/renderer_info.rb +27 -0
- data/lib/SDLRuby/renderer.rb +101 -0
- data/lib/SDLRuby/rw_ops/rw_object.rb +128 -0
- data/lib/SDLRuby/rw_ops.rb +216 -0
- data/lib/SDLRuby/sdl/include/SDL.h.rb +33 -0
- data/lib/SDLRuby/sdl/include/SDL_audio.h.rb +49 -0
- data/lib/SDLRuby/sdl/include/SDL_blendmode.h.rb +6 -0
- data/lib/SDLRuby/sdl/include/SDL_clipboard.h.rb +10 -0
- data/lib/SDLRuby/sdl/include/SDL_config.h.rb +13 -0
- data/lib/SDLRuby/sdl/include/SDL_cpuinfo.h.rb +27 -0
- data/lib/SDLRuby/sdl/include/SDL_endian.h.rb +3 -0
- data/lib/SDLRuby/sdl/include/SDL_error.h.rb +9 -0
- data/lib/SDLRuby/sdl/include/SDL_events.h.rb +32 -0
- data/lib/SDLRuby/sdl/include/SDL_filesystem.h.rb +6 -0
- data/lib/SDLRuby/sdl/include/SDL_gamecontroller.h.rb +66 -0
- data/lib/SDLRuby/sdl/include/SDL_gesture.h.rb +12 -0
- data/lib/SDLRuby/sdl/include/SDL_guid.h.rb +7 -0
- data/lib/SDLRuby/sdl/include/SDL_hints.h.rb +14 -0
- data/lib/SDLRuby/sdl/include/SDL_joystick.h.rb +69 -0
- data/lib/SDLRuby/sdl/include/SDL_keyboard.h.rb +26 -0
- data/lib/SDLRuby/sdl/include/SDL_keycode.h.rb +7 -0
- data/lib/SDLRuby/sdl/include/SDL_locale.h.rb +6 -0
- data/lib/SDLRuby/sdl/include/SDL_main.h.rb +3 -0
- data/lib/SDLRuby/sdl/include/SDL_messagebox.h.rb +10 -0
- data/lib/SDLRuby/sdl/include/SDL_misc.h.rb +5 -0
- data/lib/SDLRuby/sdl/include/SDL_mouse.h.rb +26 -0
- data/lib/SDLRuby/sdl/include/SDL_pixels.h.rb +25 -0
- data/lib/SDLRuby/sdl/include/SDL_platform.h.rb +3 -0
- data/lib/SDLRuby/sdl/include/SDL_power.h.rb +6 -0
- data/lib/SDLRuby/sdl/include/SDL_rect.h.rb +17 -0
- data/lib/SDLRuby/sdl/include/SDL_render.h.rb +94 -0
- data/lib/SDLRuby/sdl/include/SDL_revision.h.rb +2 -0
- data/lib/SDLRuby/sdl/include/SDL_rwops.h.rb +34 -0
- data/lib/SDLRuby/sdl/include/SDL_scancode.h.rb +5 -0
- data/lib/SDLRuby/sdl/include/SDL_sensor.h.rb +25 -0
- data/lib/SDLRuby/sdl/include/SDL_shape.h.rb +13 -0
- data/lib/SDLRuby/sdl/include/SDL_stdinc.h.rb +24 -0
- data/lib/SDLRuby/sdl/include/SDL_surface.h.rb +37 -0
- data/lib/SDLRuby/sdl/include/SDL_system.h.rb +6 -0
- data/lib/SDLRuby/sdl/include/SDL_syswm.h.rb +16 -0
- data/lib/SDLRuby/sdl/include/SDL_timer.h.rb +13 -0
- data/lib/SDLRuby/sdl/include/SDL_touch.h.rb +15 -0
- data/lib/SDLRuby/sdl/include/SDL_types.h.rb +3 -0
- data/lib/SDLRuby/sdl/include/SDL_version.h.rb +6 -0
- data/lib/SDLRuby/sdl/include/SDL_video.h.rb +117 -0
- data/lib/SDLRuby/sdl/sdl.rb +55 -0
- data/lib/SDLRuby/sdl/sdl_audio.rb +75 -0
- data/lib/SDLRuby/sdl/sdl_blendmode.rb +10 -0
- data/lib/SDLRuby/sdl/sdl_error.rb +5 -0
- data/lib/SDLRuby/sdl/sdl_events.rb +470 -0
- data/lib/SDLRuby/sdl/sdl_hints.rb +9 -0
- data/lib/SDLRuby/sdl/sdl_keyboard.rb +12 -0
- data/lib/SDLRuby/sdl/sdl_locale.rb +8 -0
- data/lib/SDLRuby/sdl/sdl_message_box.rb +7 -0
- data/lib/SDLRuby/sdl/sdl_mouse.rb +32 -0
- data/lib/SDLRuby/sdl/sdl_palette.rb +12 -0
- data/lib/SDLRuby/sdl/sdl_pixels.rb +138 -0
- data/lib/SDLRuby/sdl/sdl_rect.rb +11 -0
- data/lib/SDLRuby/sdl/sdl_render.rb +35 -0
- data/lib/SDLRuby/sdl/sdl_rw_ops.rb +29 -0
- data/lib/SDLRuby/sdl/sdl_scancode.rb +255 -0
- data/lib/SDLRuby/sdl/sdl_surface.rb +27 -0
- data/lib/SDLRuby/sdl/sdl_version.rb +5 -0
- data/lib/SDLRuby/sdl/sdl_video.rb +104 -0
- data/lib/SDLRuby/sdl.rb +192 -0
- data/lib/SDLRuby/sdl_error.rb +8 -0
- data/lib/SDLRuby/surface/pixel_format.rb +51 -0
- data/lib/SDLRuby/surface/surface_renderer.rb +26 -0
- data/lib/SDLRuby/surface.rb +179 -0
- data/lib/SDLRuby/text_input.rb +38 -0
- data/lib/SDLRuby/texture.rb +93 -0
- data/lib/SDLRuby/ttf/include/SDL_ttf.h.rb +54 -0
- data/lib/SDLRuby/ttf/ttf.rb +41 -0
- data/lib/SDLRuby/ttf.rb +54 -0
- data/lib/SDLRuby/version.rb +5 -0
- data/lib/SDLRuby/window/accessor.rb +125 -0
- data/lib/SDLRuby/window/controller.rb +53 -0
- data/lib/SDLRuby/window/display_info.rb +48 -0
- data/lib/SDLRuby/window/flag.rb +42 -0
- data/lib/SDLRuby/window/hit_tester.rb +61 -0
- data/lib/SDLRuby/window/input.rb +68 -0
- data/lib/SDLRuby/window/shaper.rb +68 -0
- data/lib/SDLRuby/window/surfacer.rb +37 -0
- data/lib/SDLRuby/window/window_renderer.rb +31 -0
- data/lib/SDLRuby/window.rb +90 -0
- data/lib/SDLRuby.rb +16 -0
- data/sig/SDLRuby/event.rbs +104 -0
- data/sig/SDLRuby/pixel_formmater.rbs +24 -0
- data/sig/SDLRuby/rect.rbs +5 -0
- data/sig/SDLRuby/sdl.rbs +606 -0
- data/sig/SDLRuby.rbs +4 -0
- metadata +168 -0
@@ -0,0 +1,470 @@
|
|
1
|
+
require_relative 'sdl_keyboard'
|
2
|
+
|
3
|
+
module SDLRuby
|
4
|
+
module SDL
|
5
|
+
SDL_RELEASED = 0
|
6
|
+
SDL_PRESSED = 1
|
7
|
+
|
8
|
+
# SDL_EventType
|
9
|
+
#
|
10
|
+
SDL_FIRSTEVENT = 0
|
11
|
+
SDL_QUIT = 0x100
|
12
|
+
SDL_APP_TERMINATING = 0x101
|
13
|
+
SDL_APP_LOWMEMORY = 0x102
|
14
|
+
SDL_APP_WILLENTERBACKGROUND = 0x103
|
15
|
+
SDL_APP_DIDENTERBACKGROUND = 0x104
|
16
|
+
SDL_APP_WILLENTERFOREGROUND = 0x105
|
17
|
+
SDL_APP_DIDENTERFOREGROUND = 0x106
|
18
|
+
SDL_LOCALECHANGED = 0x107
|
19
|
+
SDL_DISPLAYEVENT = 0x150
|
20
|
+
SDL_WINDOWEVENT = 0x200
|
21
|
+
SDL_SYSWMEVENT = 0x201
|
22
|
+
SDL_KEYDOWN = 0x300
|
23
|
+
SDL_KEYUP = 0x301
|
24
|
+
SDL_TEXTEDITING = 0x302
|
25
|
+
SDL_TEXTINPUT = 0x303
|
26
|
+
SDL_KEYMAPCHANGED = 0x304
|
27
|
+
SDL_TEXTEDITING_EXT = 0x305
|
28
|
+
SDL_MOUSEMOTION = 0x400
|
29
|
+
SDL_MOUSEBUTTONDOWN = 0x401
|
30
|
+
SDL_MOUSEBUTTONUP = 0x402
|
31
|
+
SDL_MOUSEWHEEL = 0x403
|
32
|
+
SDL_JOYAXISMOTION = 0x600
|
33
|
+
SDL_JOYBALLMOTION = 0x601
|
34
|
+
SDL_JOYHATMOTION = 0x602
|
35
|
+
SDL_JOYBUTTONDOWN = 0x603
|
36
|
+
SDL_JOYBUTTONUP = 0x604
|
37
|
+
SDL_JOYDEVICEADDED = 0x605
|
38
|
+
SDL_JOYDEVICEREMOVED = 0x606
|
39
|
+
SDL_JOYBATTERYUPDATED = 0x607
|
40
|
+
SDL_CONTROLLERAXISMOTION = 0x650
|
41
|
+
SDL_CONTROLLERBUTTONDOWN = 0x651
|
42
|
+
SDL_CONTROLLERBUTTONUP = 0x652
|
43
|
+
SDL_CONTROLLERDEVICEADDED = 0x653
|
44
|
+
SDL_CONTROLLERDEVICEREMOVED = 0x654
|
45
|
+
SDL_CONTROLLERDEVICEREMAPPED = 0x655
|
46
|
+
SDL_CONTROLLERTOUCHPADDOWN = 0x656
|
47
|
+
SDL_CONTROLLERTOUCHPADMOTION = 0x657
|
48
|
+
SDL_CONTROLLERTOUCHPADUP = 0x658
|
49
|
+
SDL_CONTROLLERSENSORUPDATE = 0x659
|
50
|
+
SDL_FINGERDOWN = 0x700
|
51
|
+
SDL_FINGERUP = 0x701
|
52
|
+
SDL_FINGERMOTION = 0x702
|
53
|
+
SDL_DOLLARGESTURE = 0x800
|
54
|
+
SDL_DOLLARRECORD = 0x801
|
55
|
+
SDL_MULTIGESTURE = 0x802
|
56
|
+
SDL_CLIPBOARDUPDATE = 0x900
|
57
|
+
SDL_DROPFILE = 0x1000
|
58
|
+
SDL_DROPTEXT = 0x1001
|
59
|
+
SDL_DROPBEGIN = 0x1002
|
60
|
+
SDL_DROPCOMPLETE = 0x1003
|
61
|
+
SDL_AUDIODEVICEADDED = 0x1100
|
62
|
+
SDL_AUDIODEVICEREMOVED = 0x1101
|
63
|
+
SDL_SENSORUPDATE = 0x1200
|
64
|
+
SDL_RENDER_TARGETS_RESET = 0x2000
|
65
|
+
SDL_RENDER_DEVICE_RESET = 0x2001
|
66
|
+
SDL_POLLSENTINEL = 0x7F00
|
67
|
+
SDL_USEREVENT = 0x8000
|
68
|
+
SDL_LASTEVENT = 0xFFFF
|
69
|
+
|
70
|
+
SDL_CommonEvent = struct(["Uint32 type", "Uint32 timestamp"])
|
71
|
+
|
72
|
+
SDL_DisplayEvent = struct(
|
73
|
+
[
|
74
|
+
"Uint32 type",
|
75
|
+
"Uint32 timestamp",
|
76
|
+
"Uint32 display",
|
77
|
+
"Uint8 event",
|
78
|
+
"Uint8 padding1",
|
79
|
+
"Uint8 padding2",
|
80
|
+
"Uint8 padding3",
|
81
|
+
"Sint32 data1"
|
82
|
+
]
|
83
|
+
)
|
84
|
+
|
85
|
+
SDL_WindowEvent = struct(
|
86
|
+
[
|
87
|
+
"Uint32 type",
|
88
|
+
"Uint32 timestamp",
|
89
|
+
"Uint32 windowID",
|
90
|
+
"Uint8 event",
|
91
|
+
"Uint8 padding1",
|
92
|
+
"Uint8 padding2",
|
93
|
+
"Uint8 padding3",
|
94
|
+
"Sint32 data1",
|
95
|
+
"Sint32 data2"
|
96
|
+
]
|
97
|
+
)
|
98
|
+
|
99
|
+
SDL_KeyboardEvent = struct(
|
100
|
+
[
|
101
|
+
"Uint32 type",
|
102
|
+
"Uint32 timestamp",
|
103
|
+
"Uint32 windowID",
|
104
|
+
"Uint8 state",
|
105
|
+
"Uint8 repeat",
|
106
|
+
"Uint8 padding2",
|
107
|
+
"Uint8 padding3",
|
108
|
+
{ keysym: SDL_Keysym }
|
109
|
+
]
|
110
|
+
)
|
111
|
+
|
112
|
+
SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32
|
113
|
+
|
114
|
+
SDL_TextEditingEvent = struct(
|
115
|
+
[
|
116
|
+
"Uint32 type",
|
117
|
+
"Uint32 timestamp",
|
118
|
+
"Uint32 windowID",
|
119
|
+
"char text[#{SDL_TEXTEDITINGEVENT_TEXT_SIZE}]",
|
120
|
+
"Sint32 start",
|
121
|
+
"Sint32 length"
|
122
|
+
]
|
123
|
+
)
|
124
|
+
|
125
|
+
SDL_TextEditingExtEvent = struct(
|
126
|
+
[
|
127
|
+
"Uint32 type",
|
128
|
+
"Uint32 timestamp",
|
129
|
+
"Uint32 windowID",
|
130
|
+
# The editing text, which should be freed with SDL_free(),
|
131
|
+
# and will not be NULL.
|
132
|
+
"char* text",
|
133
|
+
"Sint32 start",
|
134
|
+
"Sint32 length"
|
135
|
+
]
|
136
|
+
)
|
137
|
+
|
138
|
+
SDL_TEXTINPUTEVENT_TEXT_SIZE = 32
|
139
|
+
|
140
|
+
SDL_TextInputEvent = struct(
|
141
|
+
[
|
142
|
+
"Uint32 type",
|
143
|
+
"Uint32 timestamp",
|
144
|
+
"Uint32 windowID",
|
145
|
+
"char text[#{SDL_TEXTINPUTEVENT_TEXT_SIZE}]"
|
146
|
+
]
|
147
|
+
)
|
148
|
+
|
149
|
+
SDL_MouseMotionEvent = struct(
|
150
|
+
[
|
151
|
+
"Uint32 type",
|
152
|
+
"Uint32 timestamp",
|
153
|
+
"Uint32 windowID",
|
154
|
+
"Uint32 which",
|
155
|
+
"Uint32 state",
|
156
|
+
"Sint32 x",
|
157
|
+
"Sint32 y",
|
158
|
+
"Sint32 xrel",
|
159
|
+
"Sint32 yrel"
|
160
|
+
]
|
161
|
+
)
|
162
|
+
|
163
|
+
SDL_MouseButtonEvent = struct(
|
164
|
+
[
|
165
|
+
"Uint32 type",
|
166
|
+
"Uint32 timestamp",
|
167
|
+
"Uint32 windowID",
|
168
|
+
"Uint32 which",
|
169
|
+
"Uint8 button",
|
170
|
+
"Uint8 state",
|
171
|
+
"Uint8 clicks",
|
172
|
+
"Uint8 padding1",
|
173
|
+
"Sint32 x",
|
174
|
+
"Sint32 y"
|
175
|
+
]
|
176
|
+
)
|
177
|
+
|
178
|
+
SDL_MouseWheelEvent = struct(
|
179
|
+
[
|
180
|
+
"Uint32 type",
|
181
|
+
"Uint32 timestamp",
|
182
|
+
"Uint32 windowID",
|
183
|
+
"Uint32 which",
|
184
|
+
"Sint32 x",
|
185
|
+
"Sint32 y",
|
186
|
+
"Uint32 direction",
|
187
|
+
"float preciseX",
|
188
|
+
"float preciseY",
|
189
|
+
"Sint32 mouseX",
|
190
|
+
"Sint32 mouseY"
|
191
|
+
]
|
192
|
+
)
|
193
|
+
|
194
|
+
SDL_JoyAxisEvent = struct(
|
195
|
+
[
|
196
|
+
"Uint32 type",
|
197
|
+
"Uint32 timestamp",
|
198
|
+
"SDL_JoystickID which",
|
199
|
+
"Uint8 axis",
|
200
|
+
"Uint8 padding1",
|
201
|
+
"Uint8 padding2",
|
202
|
+
"Uint8 padding3",
|
203
|
+
"Sint16 value",
|
204
|
+
"Uint16 padding4"
|
205
|
+
]
|
206
|
+
)
|
207
|
+
|
208
|
+
SDL_JoyBallEvent = struct(
|
209
|
+
[
|
210
|
+
"Uint32 type",
|
211
|
+
"Uint32 timestamp",
|
212
|
+
"SDL_JoystickID which",
|
213
|
+
"Uint8 ball",
|
214
|
+
"Uint8 padding1",
|
215
|
+
"Uint8 padding2",
|
216
|
+
"Uint8 padding3",
|
217
|
+
"Sint16 xrel",
|
218
|
+
"Sint16 yrel"
|
219
|
+
]
|
220
|
+
)
|
221
|
+
|
222
|
+
SDL_JoyHatEvent = struct(
|
223
|
+
[
|
224
|
+
"Uint32 type",
|
225
|
+
"Uint32 timestamp",
|
226
|
+
"SDL_JoystickID which",
|
227
|
+
"Uint8 hat",
|
228
|
+
"Uint8 value",
|
229
|
+
"Uint8 padding1",
|
230
|
+
"Uint8 padding2"
|
231
|
+
]
|
232
|
+
)
|
233
|
+
|
234
|
+
SDL_JoyButtonEvent = struct(
|
235
|
+
[
|
236
|
+
"Uint32 type",
|
237
|
+
"Uint32 timestamp",
|
238
|
+
"SDL_JoystickID which",
|
239
|
+
"Uint8 button",
|
240
|
+
"Uint8 state",
|
241
|
+
"Uint8 padding1",
|
242
|
+
"Uint8 padding2"
|
243
|
+
]
|
244
|
+
)
|
245
|
+
|
246
|
+
SDL_JoyDeviceEvent = struct(
|
247
|
+
[
|
248
|
+
"Uint32 type",
|
249
|
+
"Uint32 timestamp",
|
250
|
+
"Sint32 which"
|
251
|
+
]
|
252
|
+
)
|
253
|
+
|
254
|
+
SDL_JoyBatteryEvent = struct(
|
255
|
+
[
|
256
|
+
"Uint32 type",
|
257
|
+
"Uint32 timestamp",
|
258
|
+
"SDL_JoystickID which",
|
259
|
+
"SDL_JoystickPowerLevel level"
|
260
|
+
]
|
261
|
+
)
|
262
|
+
|
263
|
+
SDL_ControllerAxisEvent = struct(
|
264
|
+
[
|
265
|
+
"Uint32 type",
|
266
|
+
"Uint32 timestamp",
|
267
|
+
"SDL_JoystickID which",
|
268
|
+
"Uint8 axis",
|
269
|
+
"Uint8 padding1",
|
270
|
+
"Uint8 padding2",
|
271
|
+
"Uint8 padding3",
|
272
|
+
"Sint16 value",
|
273
|
+
"Uint16 padding4"
|
274
|
+
]
|
275
|
+
)
|
276
|
+
|
277
|
+
SDL_ControllerButtonEvent = struct(
|
278
|
+
[
|
279
|
+
"Uint32 type",
|
280
|
+
"Uint32 timestamp",
|
281
|
+
"SDL_JoystickID which",
|
282
|
+
"Uint8 button",
|
283
|
+
"Uint8 state",
|
284
|
+
"Uint8 padding1",
|
285
|
+
"Uint8 padding2"
|
286
|
+
]
|
287
|
+
)
|
288
|
+
|
289
|
+
SDL_ControllerDeviceEvent = struct(
|
290
|
+
[
|
291
|
+
"Uint32 type",
|
292
|
+
"Uint32 timestamp",
|
293
|
+
"Sint32 which"
|
294
|
+
]
|
295
|
+
)
|
296
|
+
|
297
|
+
SDL_ControllerTouchpadEvent = struct(
|
298
|
+
[
|
299
|
+
"Uint32 type",
|
300
|
+
"Uint32 timestamp",
|
301
|
+
"SDL_JoystickID which",
|
302
|
+
"Sint32 touchpad",
|
303
|
+
"Sint32 finger",
|
304
|
+
"float x",
|
305
|
+
"float y",
|
306
|
+
"float pressure"
|
307
|
+
]
|
308
|
+
)
|
309
|
+
|
310
|
+
SDL_ControllerSensorEvent = struct(
|
311
|
+
[
|
312
|
+
"Uint32 type",
|
313
|
+
"Uint32 timestamp",
|
314
|
+
"SDL_JoystickID which",
|
315
|
+
"Sint32 sensor",
|
316
|
+
"float data[3]",
|
317
|
+
"Uint64 timestamp_us"
|
318
|
+
]
|
319
|
+
)
|
320
|
+
|
321
|
+
SDL_AudioDeviceEvent = struct(
|
322
|
+
[
|
323
|
+
"Uint32 type",
|
324
|
+
"Uint32 timestamp",
|
325
|
+
"Uint32 which",
|
326
|
+
"Uint8 iscapture",
|
327
|
+
"Uint8 padding1",
|
328
|
+
"Uint8 padding2",
|
329
|
+
"Uint8 padding3"
|
330
|
+
]
|
331
|
+
)
|
332
|
+
|
333
|
+
SDL_TouchFingerEvent = struct(
|
334
|
+
[
|
335
|
+
"Uint32 type",
|
336
|
+
"Uint32 timestamp",
|
337
|
+
"SDL_TouchID touchId",
|
338
|
+
"SDL_FingerID fingerId",
|
339
|
+
"float x",
|
340
|
+
"float y",
|
341
|
+
"float dx",
|
342
|
+
"float dy",
|
343
|
+
"float pressure",
|
344
|
+
"Uint32 windowID"
|
345
|
+
]
|
346
|
+
)
|
347
|
+
|
348
|
+
SDL_MultiGestureEvent = struct(
|
349
|
+
[
|
350
|
+
"Uint32 type",
|
351
|
+
"Uint32 timestamp",
|
352
|
+
"SDL_TouchID touchId",
|
353
|
+
"float dTheta",
|
354
|
+
"float dDist",
|
355
|
+
"float x",
|
356
|
+
"float y",
|
357
|
+
"Uint16 numFingers",
|
358
|
+
"Uint16 padding"
|
359
|
+
]
|
360
|
+
)
|
361
|
+
|
362
|
+
SDL_DollarGestureEvent = struct(
|
363
|
+
[
|
364
|
+
"Uint32 type",
|
365
|
+
"Uint32 timestamp",
|
366
|
+
"SDL_TouchID touchId",
|
367
|
+
"SDL_GestureID gestureId",
|
368
|
+
"Uint32 numFingers",
|
369
|
+
"float error",
|
370
|
+
"float x",
|
371
|
+
"float y"
|
372
|
+
]
|
373
|
+
)
|
374
|
+
|
375
|
+
SDL_DropEvent = struct(
|
376
|
+
[
|
377
|
+
"Uint32 type",
|
378
|
+
"Uint32 timestamp",
|
379
|
+
# The file name, which should be freed with SDL_free(),
|
380
|
+
# is NULL on begin/complete.
|
381
|
+
"char *file",
|
382
|
+
"Uint32 windowID"
|
383
|
+
]
|
384
|
+
)
|
385
|
+
|
386
|
+
SDL_SensorEvent = struct(
|
387
|
+
[
|
388
|
+
"Uint32 type",
|
389
|
+
"Uint32 timestamp",
|
390
|
+
"Sint32 which",
|
391
|
+
"float data[6]",
|
392
|
+
"Uint64 timestamp_us"
|
393
|
+
]
|
394
|
+
)
|
395
|
+
|
396
|
+
SDL_QuitEvent = struct(["Uint32 type", "Uint32 timestamp"])
|
397
|
+
|
398
|
+
SDL_OSEvent = struct(["Uint32 type", "Uint32 timestamp"])
|
399
|
+
|
400
|
+
SDL_UserEvent = struct(
|
401
|
+
[
|
402
|
+
"Uint32 type",
|
403
|
+
"Uint32 timestamp",
|
404
|
+
"Uint32 windowID",
|
405
|
+
"Sint32 code",
|
406
|
+
"void *data1",
|
407
|
+
"void *data2"
|
408
|
+
]
|
409
|
+
)
|
410
|
+
|
411
|
+
SDL_SysWMEvent = struct(
|
412
|
+
[
|
413
|
+
"Uint32 type",
|
414
|
+
"Uint32 timestamp",
|
415
|
+
"SDL_SysWMmsg *msg"
|
416
|
+
]
|
417
|
+
)
|
418
|
+
|
419
|
+
SDL_Event = union(
|
420
|
+
[
|
421
|
+
"Uint32 type",
|
422
|
+
{ common: SDL_CommonEvent },
|
423
|
+
{ display: SDL_DisplayEvent},
|
424
|
+
{ window: SDL_WindowEvent },
|
425
|
+
{ key: SDL_KeyboardEvent },
|
426
|
+
{ edit: SDL_TextEditingEvent },
|
427
|
+
{ editExt: SDL_TextEditingExtEvent },
|
428
|
+
{ text: SDL_TextInputEvent },
|
429
|
+
{ motion: SDL_MouseMotionEvent },
|
430
|
+
{ button: SDL_MouseButtonEvent },
|
431
|
+
{ wheel: SDL_MouseWheelEvent },
|
432
|
+
{ jaxis: SDL_JoyAxisEvent },
|
433
|
+
{ jball: SDL_JoyBallEvent },
|
434
|
+
{ jhat: SDL_JoyHatEvent },
|
435
|
+
{ jbutton: SDL_JoyButtonEvent },
|
436
|
+
{ jdevice: SDL_JoyDeviceEvent },
|
437
|
+
{ jbattery: SDL_JoyBatteryEvent },
|
438
|
+
{ caxis: SDL_ControllerAxisEvent },
|
439
|
+
{ cbutton: SDL_ControllerButtonEvent },
|
440
|
+
{ cdevice: SDL_ControllerDeviceEvent },
|
441
|
+
{ ctouchpad: SDL_ControllerTouchpadEvent },
|
442
|
+
{ csensor: SDL_ControllerSensorEvent },
|
443
|
+
{ adevice: SDL_AudioDeviceEvent },
|
444
|
+
{ sensor: SDL_SensorEvent },
|
445
|
+
{ quit: SDL_QuitEvent },
|
446
|
+
{ user: SDL_UserEvent },
|
447
|
+
{ syswm: SDL_SysWMEvent },
|
448
|
+
{ tfinger: SDL_TouchFingerEvent },
|
449
|
+
{ mgesture: SDL_MultiGestureEvent },
|
450
|
+
{ dgesture: SDL_DollarGestureEvent },
|
451
|
+
{ drop: SDL_DropEvent },
|
452
|
+
"Uint8 padding[#{
|
453
|
+
size = Fiddle::SIZEOF_VOIDP
|
454
|
+
if size <= 8
|
455
|
+
56
|
456
|
+
elsif size == 16
|
457
|
+
64
|
458
|
+
else
|
459
|
+
3 * size
|
460
|
+
end
|
461
|
+
}]"
|
462
|
+
]
|
463
|
+
)
|
464
|
+
|
465
|
+
SDL_ADDEVENT = 0
|
466
|
+
SDL_PEEKEVENT = 1
|
467
|
+
SDL_GETEVENT = 2
|
468
|
+
typealias "SDL_eventaction", "int"
|
469
|
+
end
|
470
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module SDLRuby
|
2
|
+
module SDL
|
3
|
+
SDL_SYSTEM_CURSOR_ARROW = 0
|
4
|
+
SDL_SYSTEM_CURSOR_IBEAM = 1
|
5
|
+
SDL_SYSTEM_CURSOR_WAIT = 2
|
6
|
+
SDL_SYSTEM_CURSOR_CROSSHAIR = 3
|
7
|
+
SDL_SYSTEM_CURSOR_WAITARROW = 4
|
8
|
+
SDL_SYSTEM_CURSOR_SIZENWSE = 5
|
9
|
+
SDL_SYSTEM_CURSOR_SIZENESW = 6
|
10
|
+
SDL_SYSTEM_CURSOR_SIZEWE = 7
|
11
|
+
SDL_SYSTEM_CURSOR_SIZENS = 8
|
12
|
+
SDL_SYSTEM_CURSOR_SIZEALL = 9
|
13
|
+
SDL_SYSTEM_CURSOR_NO = 10
|
14
|
+
SDL_SYSTEM_CURSOR_HAND = 11
|
15
|
+
SDL_NUM_SYSTEM_CURSORS = 12
|
16
|
+
|
17
|
+
SDL_MOUSEWHEEL_NORMAL = 0
|
18
|
+
SDL_MOUSEWHEEL_FLIPPED = 1
|
19
|
+
|
20
|
+
SDL_BUTTON = -> (x) { 1 << (x - 1) }
|
21
|
+
SDL_BUTTON_LEFT = 1
|
22
|
+
SDL_BUTTON_MIDDLE = 2
|
23
|
+
SDL_BUTTON_RIGHT = 3
|
24
|
+
SDL_BUTTON_X1 = 4
|
25
|
+
SDL_BUTTON_X2 = 5
|
26
|
+
SDL_BUTTON_LMASK = SDL_BUTTON.(SDL_BUTTON_LEFT)
|
27
|
+
SDL_BUTTON_MMASK = SDL_BUTTON.(SDL_BUTTON_MIDDLE)
|
28
|
+
SDL_BUTTON_RMASK = SDL_BUTTON.(SDL_BUTTON_RIGHT)
|
29
|
+
SDL_BUTTON_X1MASK = SDL_BUTTON.(SDL_BUTTON_X1)
|
30
|
+
SDL_BUTTON_X2MASK = SDL_BUTTON.(SDL_BUTTON_X2)
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
module SDLRuby
|
2
|
+
module SDL
|
3
|
+
SDL_ALPHA_OPAQUE = 255
|
4
|
+
SDL_ALPHA_TRANSPARENT = 0
|
5
|
+
|
6
|
+
SDL_Color = struct ["Uint8 r", "Uint8 g", "Uint8 b", "Uint8 a"]
|
7
|
+
|
8
|
+
# SDL_PixelType
|
9
|
+
i1 = 1
|
10
|
+
i4 = 2
|
11
|
+
i8 = 3
|
12
|
+
p8 = 4
|
13
|
+
p16 = 5
|
14
|
+
p32 = 6
|
15
|
+
a_u8 = 7
|
16
|
+
|
17
|
+
# SDL_BitmapOrder
|
18
|
+
b_4321 = 1
|
19
|
+
b_1234 = 2
|
20
|
+
|
21
|
+
# SDL_PackedOrder
|
22
|
+
p_xrgb = 1
|
23
|
+
p_rgbx = 2
|
24
|
+
p_argb = 3
|
25
|
+
p_rgba = 4
|
26
|
+
p_xbgr = 5
|
27
|
+
p_bgrx = 6
|
28
|
+
p_abgr = 7
|
29
|
+
p_bgra = 8
|
30
|
+
|
31
|
+
# SDL_ArrayOrder
|
32
|
+
a_rgb = 1
|
33
|
+
a_bgr = 4
|
34
|
+
|
35
|
+
# SDL_PackedLayout
|
36
|
+
l_332 = 1
|
37
|
+
l_4444 = 2
|
38
|
+
l_1555 = 3
|
39
|
+
l_5551 = 4
|
40
|
+
l_565 = 5
|
41
|
+
l_8888 = 6
|
42
|
+
l_2101010 = 7
|
43
|
+
|
44
|
+
pixelformat = -> (type, order, layout, bits, bytes) {
|
45
|
+
1 << 28 | type << 24 | order << 20 | layout << 16 | bits << 8 | bytes << 0
|
46
|
+
}
|
47
|
+
|
48
|
+
SDL_PIXELFORMAT_UNKNOWN = 0
|
49
|
+
SDL_PIXELFORMAT_INDEX1LSB = pixelformat.(i1, b_4321, 0, 1, 0)
|
50
|
+
SDL_PIXELFORMAT_INDEX1MSB = pixelformat.(i1, b_1234, 0, 1, 0)
|
51
|
+
SDL_PIXELFORMAT_INDEX4LSB = pixelformat.(i4, b_4321, 0, 4, 0)
|
52
|
+
SDL_PIXELFORMAT_INDEX4MSB = pixelformat.(i4, b_1234, 0, 4, 0)
|
53
|
+
SDL_PIXELFORMAT_INDEX8 = pixelformat.(i8, 0, 0, 8, 1)
|
54
|
+
SDL_PIXELFORMAT_RGB332 = pixelformat.(p8, p_xrgb, l_332, 8, 1)
|
55
|
+
SDL_PIXELFORMAT_XRGB4444 = pixelformat.(p16, p_xrgb, l_4444, 12, 2)
|
56
|
+
SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444
|
57
|
+
SDL_PIXELFORMAT_XBGR4444 = pixelformat.(p16, p_xbgr, l_4444, 12, 2)
|
58
|
+
SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444
|
59
|
+
SDL_PIXELFORMAT_XRGB1555 = pixelformat.(p16, p_xrgb, l_1555, 15, 2)
|
60
|
+
SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555
|
61
|
+
SDL_PIXELFORMAT_XBGR1555 = pixelformat.(p16, p_xbgr, l_1555, 15, 2)
|
62
|
+
SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555
|
63
|
+
SDL_PIXELFORMAT_ARGB4444 = pixelformat.(p16, p_argb, l_4444, 16, 2)
|
64
|
+
SDL_PIXELFORMAT_RGBA4444 = pixelformat.(p16, p_rgba, l_4444, 16, 2)
|
65
|
+
SDL_PIXELFORMAT_ABGR4444 = pixelformat.(p16, p_abgr, l_4444, 16, 2)
|
66
|
+
SDL_PIXELFORMAT_BGRA4444 = pixelformat.(p16, p_bgra, l_4444, 16, 2)
|
67
|
+
SDL_PIXELFORMAT_ARGB1555 = pixelformat.(p16, p_argb, l_1555, 16, 2)
|
68
|
+
SDL_PIXELFORMAT_RGBA5551 = pixelformat.(p16, p_rgba, l_5551, 16, 2)
|
69
|
+
SDL_PIXELFORMAT_ABGR1555 = pixelformat.(p16, p_abgr, l_1555, 16, 2)
|
70
|
+
SDL_PIXELFORMAT_BGRA5551 = pixelformat.(p16, p_bgra, l_5551, 16, 2)
|
71
|
+
SDL_PIXELFORMAT_RGB565 = pixelformat.(p16, p_xrgb, l_565, 16, 2)
|
72
|
+
SDL_PIXELFORMAT_BGR565 = pixelformat.(p16, p_xbgr, l_565, 16, 2)
|
73
|
+
SDL_PIXELFORMAT_RGB24 = pixelformat.(a_u8, a_rgb, 0, 24, 3)
|
74
|
+
SDL_PIXELFORMAT_BGR24 = pixelformat.(a_u8, a_bgr, 0, 24, 3)
|
75
|
+
SDL_PIXELFORMAT_XRGB8888 = pixelformat.(p32, p_xrgb, l_8888, 24, 4)
|
76
|
+
SDL_PIXELFORMAT_RGB888 = SDL_PIXELFORMAT_XRGB8888
|
77
|
+
SDL_PIXELFORMAT_RGBX8888 = pixelformat.(p32, p_rgbx, l_8888, 24, 4)
|
78
|
+
SDL_PIXELFORMAT_XBGR8888 = pixelformat.(p32, p_xbgr, l_8888, 24, 4)
|
79
|
+
SDL_PIXELFORMAT_BGR888 = SDL_PIXELFORMAT_XBGR8888
|
80
|
+
SDL_PIXELFORMAT_BGRX8888 = pixelformat.(p32, p_bgrx, l_8888, 24, 4)
|
81
|
+
SDL_PIXELFORMAT_ARGB8888 = pixelformat.(p32, p_argb, l_8888, 32, 4)
|
82
|
+
SDL_PIXELFORMAT_RGBA8888 = pixelformat.(p32, p_rgba, l_8888, 32, 4)
|
83
|
+
SDL_PIXELFORMAT_ABGR8888 = pixelformat.(p32, p_abgr, l_8888, 32, 4)
|
84
|
+
SDL_PIXELFORMAT_BGRA8888 = pixelformat.(p32, p_bgra, l_8888, 32, 4)
|
85
|
+
SDL_PIXELFORMAT_ARGB2101010 = pixelformat.(p32, p_argb, l_2101010, 32, 4)
|
86
|
+
|
87
|
+
if "\x01\x02\x03\x04".unpack("I") == 0x1020304
|
88
|
+
# BIG ENDIAN
|
89
|
+
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888
|
90
|
+
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888
|
91
|
+
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888
|
92
|
+
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888
|
93
|
+
else
|
94
|
+
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888
|
95
|
+
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888
|
96
|
+
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888
|
97
|
+
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888
|
98
|
+
end
|
99
|
+
|
100
|
+
pixel_fourcc = -> (a, b, c, d) {
|
101
|
+
_a, _b, _c, _d = [a, b, c, d].map { |s| s.encode("ASCII").bytes.first }
|
102
|
+
_a << 0 | _b << 8 | _c << 16 | _d << 24
|
103
|
+
}
|
104
|
+
|
105
|
+
SDL_PIXELFORMAT_YV12 = pixel_fourcc.('Y', 'V', '1', '2')
|
106
|
+
SDL_PIXELFORMAT_IYUV = pixel_fourcc.('I', 'Y', 'U', 'V')
|
107
|
+
SDL_PIXELFORMAT_YUY2 = pixel_fourcc.('Y', 'U', 'Y', '2')
|
108
|
+
SDL_PIXELFORMAT_UYVY = pixel_fourcc.('U', 'Y', 'V', 'Y')
|
109
|
+
SDL_PIXELFORMAT_YVYU = pixel_fourcc.('Y', 'V', 'Y', 'U')
|
110
|
+
SDL_PIXELFORMAT_NV12 = pixel_fourcc.('N', 'V', '1', '2')
|
111
|
+
SDL_PIXELFORMAT_NV21 = pixel_fourcc.('N', 'V', '2', '1')
|
112
|
+
SDL_PIXELFORMAT_EXTERNAL_OES = pixel_fourcc.('O', 'E', 'S', ' ')
|
113
|
+
|
114
|
+
SDL_PixelFormat = struct(
|
115
|
+
[
|
116
|
+
"Uint32 format",
|
117
|
+
"SDL_Palette* palette",
|
118
|
+
"Uint8 BitsPerPixel",
|
119
|
+
"Uint8 BytesPerPixel",
|
120
|
+
"Uint8 padding[2]",
|
121
|
+
"Uint32 Rmask",
|
122
|
+
"Uint32 Gmask",
|
123
|
+
"Uint32 Bmask",
|
124
|
+
"Uint32 Amask",
|
125
|
+
"Uint8 Rloss",
|
126
|
+
"Uint8 Gloss",
|
127
|
+
"Uint8 Bloss",
|
128
|
+
"Uint8 Aloss",
|
129
|
+
"Uint8 Rshift",
|
130
|
+
"Uint8 Gshift",
|
131
|
+
"Uint8 Bshift",
|
132
|
+
"Uint8 Ashift",
|
133
|
+
"int refcount",
|
134
|
+
"SDL_PixelFormat* next"
|
135
|
+
]
|
136
|
+
)
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module SDLRuby
|
2
|
+
module SDL
|
3
|
+
SDL_Point = struct(["int x", "int y"])
|
4
|
+
|
5
|
+
SDL_FPoint = struct(["float x", "float y"])
|
6
|
+
|
7
|
+
SDL_Rect = struct(["int x", "int y", "int w", "int h"])
|
8
|
+
|
9
|
+
SDL_FRect = struct(["float x", "float y", "float w", "float h"])
|
10
|
+
end
|
11
|
+
end
|