sdl2-bindings 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +83 -79
  3. data/LICENSE.txt +1 -1
  4. data/README.md +49 -49
  5. data/lib/sdl2.rb +170 -170
  6. data/lib/sdl2_audio.rb +219 -201
  7. data/lib/sdl2_blendmode.rb +69 -69
  8. data/lib/sdl2_clipboard.rb +51 -51
  9. data/lib/sdl2_cpuinfo.rb +106 -106
  10. data/lib/sdl2_error.rb +64 -64
  11. data/lib/sdl2_events.rb +530 -530
  12. data/lib/sdl2_filesystem.rb +48 -48
  13. data/lib/sdl2_framerate.rb +67 -67
  14. data/lib/sdl2_gamecontroller.rb +254 -254
  15. data/lib/sdl2_gesture.rb +55 -55
  16. data/lib/sdl2_gfxPrimitives.rb +222 -222
  17. data/lib/sdl2_haptic.rb +269 -269
  18. data/lib/sdl2_hints.rb +174 -174
  19. data/lib/sdl2_image.rb +185 -185
  20. data/lib/sdl2_imageFilter.rb +132 -132
  21. data/lib/sdl2_joystick.rb +230 -230
  22. data/lib/sdl2_keyboard.rb +99 -99
  23. data/lib/sdl2_keycode.rb +304 -304
  24. data/lib/sdl2_log.rb +115 -115
  25. data/lib/sdl2_main.rb +67 -67
  26. data/lib/sdl2_messagebox.rb +98 -98
  27. data/lib/sdl2_mixer.rb +317 -307
  28. data/lib/sdl2_mouse.rb +117 -117
  29. data/lib/sdl2_pixels.rb +224 -224
  30. data/lib/sdl2_platform.rb +45 -45
  31. data/lib/sdl2_power.rb +51 -51
  32. data/lib/sdl2_rect.rb +102 -102
  33. data/lib/sdl2_render.rb +290 -290
  34. data/lib/sdl2_rotozoom.rb +66 -66
  35. data/lib/sdl2_rwops.rb +208 -208
  36. data/lib/sdl2_scancode.rb +287 -287
  37. data/lib/sdl2_shape.rb +77 -77
  38. data/lib/sdl2_stdinc.rb +393 -393
  39. data/lib/sdl2_surface.rb +182 -182
  40. data/lib/sdl2_syswm.rb +154 -154
  41. data/lib/sdl2_timer.rb +62 -62
  42. data/lib/sdl2_touch.rb +73 -73
  43. data/lib/sdl2_ttf.rb +202 -190
  44. data/lib/sdl2_version.rb +62 -62
  45. data/lib/sdl2_video.rb +411 -411
  46. data/lib/sdl2_vulkan.rb +64 -64
  47. metadata +6 -6
data/lib/sdl2_keyboard.rb CHANGED
@@ -1,99 +1,99 @@
1
- # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/sdl2-bindings
4
- #
5
- # [NOTICE] This is an automatically generated file.
6
-
7
- require 'ffi'
8
-
9
- module SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
-
14
- # Enum
15
-
16
-
17
- # Typedef
18
-
19
-
20
- # Struct
21
-
22
- class SDL_Keysym < FFI::Struct
23
- layout(
24
- :scancode, :int,
25
- :sym, :int,
26
- :mod, :ushort,
27
- :unused, :uint,
28
- )
29
- end
30
-
31
-
32
- # Function
33
-
34
- def self.setup_keyboard_symbols()
35
- symbols = [
36
- :SDL_GetKeyboardFocus,
37
- :SDL_GetKeyboardState,
38
- :SDL_GetModState,
39
- :SDL_SetModState,
40
- :SDL_GetKeyFromScancode,
41
- :SDL_GetScancodeFromKey,
42
- :SDL_GetScancodeName,
43
- :SDL_GetScancodeFromName,
44
- :SDL_GetKeyName,
45
- :SDL_GetKeyFromName,
46
- :SDL_StartTextInput,
47
- :SDL_IsTextInputActive,
48
- :SDL_StopTextInput,
49
- :SDL_SetTextInputRect,
50
- :SDL_HasScreenKeyboardSupport,
51
- :SDL_IsScreenKeyboardShown,
52
- ]
53
- args = {
54
- :SDL_GetKeyboardFocus => [],
55
- :SDL_GetKeyboardState => [:pointer],
56
- :SDL_GetModState => [],
57
- :SDL_SetModState => [:int],
58
- :SDL_GetKeyFromScancode => [:int],
59
- :SDL_GetScancodeFromKey => [:int],
60
- :SDL_GetScancodeName => [:int],
61
- :SDL_GetScancodeFromName => [:pointer],
62
- :SDL_GetKeyName => [:int],
63
- :SDL_GetKeyFromName => [:pointer],
64
- :SDL_StartTextInput => [],
65
- :SDL_IsTextInputActive => [],
66
- :SDL_StopTextInput => [],
67
- :SDL_SetTextInputRect => [:pointer],
68
- :SDL_HasScreenKeyboardSupport => [],
69
- :SDL_IsScreenKeyboardShown => [:pointer],
70
- }
71
- retvals = {
72
- :SDL_GetKeyboardFocus => :pointer,
73
- :SDL_GetKeyboardState => :pointer,
74
- :SDL_GetModState => :int,
75
- :SDL_SetModState => :void,
76
- :SDL_GetKeyFromScancode => :int,
77
- :SDL_GetScancodeFromKey => :int,
78
- :SDL_GetScancodeName => :pointer,
79
- :SDL_GetScancodeFromName => :int,
80
- :SDL_GetKeyName => :pointer,
81
- :SDL_GetKeyFromName => :int,
82
- :SDL_StartTextInput => :void,
83
- :SDL_IsTextInputActive => :int,
84
- :SDL_StopTextInput => :void,
85
- :SDL_SetTextInputRect => :void,
86
- :SDL_HasScreenKeyboardSupport => :int,
87
- :SDL_IsScreenKeyboardShown => :int,
88
- }
89
- symbols.each do |sym|
90
- begin
91
- attach_function sym, args[sym], retvals[sym]
92
- rescue FFI::NotFoundError => error
93
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
94
- end
95
- end
96
- end
97
-
98
- end
99
-
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL2
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+ class SDL_Keysym < FFI::Struct
23
+ layout(
24
+ :scancode, :int,
25
+ :sym, :int,
26
+ :mod, :ushort,
27
+ :unused, :uint,
28
+ )
29
+ end
30
+
31
+
32
+ # Function
33
+
34
+ def self.setup_keyboard_symbols()
35
+ symbols = [
36
+ :SDL_GetKeyboardFocus,
37
+ :SDL_GetKeyboardState,
38
+ :SDL_GetModState,
39
+ :SDL_SetModState,
40
+ :SDL_GetKeyFromScancode,
41
+ :SDL_GetScancodeFromKey,
42
+ :SDL_GetScancodeName,
43
+ :SDL_GetScancodeFromName,
44
+ :SDL_GetKeyName,
45
+ :SDL_GetKeyFromName,
46
+ :SDL_StartTextInput,
47
+ :SDL_IsTextInputActive,
48
+ :SDL_StopTextInput,
49
+ :SDL_SetTextInputRect,
50
+ :SDL_HasScreenKeyboardSupport,
51
+ :SDL_IsScreenKeyboardShown,
52
+ ]
53
+ args = {
54
+ :SDL_GetKeyboardFocus => [],
55
+ :SDL_GetKeyboardState => [:pointer],
56
+ :SDL_GetModState => [],
57
+ :SDL_SetModState => [:int],
58
+ :SDL_GetKeyFromScancode => [:int],
59
+ :SDL_GetScancodeFromKey => [:int],
60
+ :SDL_GetScancodeName => [:int],
61
+ :SDL_GetScancodeFromName => [:pointer],
62
+ :SDL_GetKeyName => [:int],
63
+ :SDL_GetKeyFromName => [:pointer],
64
+ :SDL_StartTextInput => [],
65
+ :SDL_IsTextInputActive => [],
66
+ :SDL_StopTextInput => [],
67
+ :SDL_SetTextInputRect => [:pointer],
68
+ :SDL_HasScreenKeyboardSupport => [],
69
+ :SDL_IsScreenKeyboardShown => [:pointer],
70
+ }
71
+ retvals = {
72
+ :SDL_GetKeyboardFocus => :pointer,
73
+ :SDL_GetKeyboardState => :pointer,
74
+ :SDL_GetModState => :int,
75
+ :SDL_SetModState => :void,
76
+ :SDL_GetKeyFromScancode => :int,
77
+ :SDL_GetScancodeFromKey => :int,
78
+ :SDL_GetScancodeName => :pointer,
79
+ :SDL_GetScancodeFromName => :int,
80
+ :SDL_GetKeyName => :pointer,
81
+ :SDL_GetKeyFromName => :int,
82
+ :SDL_StartTextInput => :void,
83
+ :SDL_IsTextInputActive => :int,
84
+ :SDL_StopTextInput => :void,
85
+ :SDL_SetTextInputRect => :void,
86
+ :SDL_HasScreenKeyboardSupport => :int,
87
+ :SDL_IsScreenKeyboardShown => :int,
88
+ }
89
+ symbols.each do |sym|
90
+ begin
91
+ attach_function sym, args[sym], retvals[sym]
92
+ rescue FFI::NotFoundError => error
93
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
94
+ end
95
+ end
96
+ end
97
+
98
+ end
99
+
data/lib/sdl2_keycode.rb CHANGED
@@ -1,304 +1,304 @@
1
- # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/sdl2-bindings
4
- #
5
- # [NOTICE] This is an automatically generated file.
6
-
7
- require 'ffi'
8
-
9
- module SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
-
14
- # Enum
15
-
16
- SDLK_UNKNOWN = 0
17
- SDLK_RETURN = 13
18
- SDLK_ESCAPE = 27
19
- SDLK_BACKSPACE = 8
20
- SDLK_TAB = 9
21
- SDLK_SPACE = 32
22
- SDLK_EXCLAIM = 33
23
- SDLK_QUOTEDBL = 34
24
- SDLK_HASH = 35
25
- SDLK_PERCENT = 37
26
- SDLK_DOLLAR = 36
27
- SDLK_AMPERSAND = 38
28
- SDLK_QUOTE = 39
29
- SDLK_LEFTPAREN = 40
30
- SDLK_RIGHTPAREN = 41
31
- SDLK_ASTERISK = 42
32
- SDLK_PLUS = 43
33
- SDLK_COMMA = 44
34
- SDLK_MINUS = 45
35
- SDLK_PERIOD = 46
36
- SDLK_SLASH = 47
37
- SDLK_0 = 48
38
- SDLK_1 = 49
39
- SDLK_2 = 50
40
- SDLK_3 = 51
41
- SDLK_4 = 52
42
- SDLK_5 = 53
43
- SDLK_6 = 54
44
- SDLK_7 = 55
45
- SDLK_8 = 56
46
- SDLK_9 = 57
47
- SDLK_COLON = 58
48
- SDLK_SEMICOLON = 59
49
- SDLK_LESS = 60
50
- SDLK_EQUALS = 61
51
- SDLK_GREATER = 62
52
- SDLK_QUESTION = 63
53
- SDLK_AT = 64
54
- SDLK_LEFTBRACKET = 91
55
- SDLK_BACKSLASH = 92
56
- SDLK_RIGHTBRACKET = 93
57
- SDLK_CARET = 94
58
- SDLK_UNDERSCORE = 95
59
- SDLK_BACKQUOTE = 96
60
- SDLK_a = 97
61
- SDLK_b = 98
62
- SDLK_c = 99
63
- SDLK_d = 100
64
- SDLK_e = 101
65
- SDLK_f = 102
66
- SDLK_g = 103
67
- SDLK_h = 104
68
- SDLK_i = 105
69
- SDLK_j = 106
70
- SDLK_k = 107
71
- SDLK_l = 108
72
- SDLK_m = 109
73
- SDLK_n = 110
74
- SDLK_o = 111
75
- SDLK_p = 112
76
- SDLK_q = 113
77
- SDLK_r = 114
78
- SDLK_s = 115
79
- SDLK_t = 116
80
- SDLK_u = 117
81
- SDLK_v = 118
82
- SDLK_w = 119
83
- SDLK_x = 120
84
- SDLK_y = 121
85
- SDLK_z = 122
86
- SDLK_CAPSLOCK = 1073741881
87
- SDLK_F1 = 1073741882
88
- SDLK_F2 = 1073741883
89
- SDLK_F3 = 1073741884
90
- SDLK_F4 = 1073741885
91
- SDLK_F5 = 1073741886
92
- SDLK_F6 = 1073741887
93
- SDLK_F7 = 1073741888
94
- SDLK_F8 = 1073741889
95
- SDLK_F9 = 1073741890
96
- SDLK_F10 = 1073741891
97
- SDLK_F11 = 1073741892
98
- SDLK_F12 = 1073741893
99
- SDLK_PRINTSCREEN = 1073741894
100
- SDLK_SCROLLLOCK = 1073741895
101
- SDLK_PAUSE = 1073741896
102
- SDLK_INSERT = 1073741897
103
- SDLK_HOME = 1073741898
104
- SDLK_PAGEUP = 1073741899
105
- SDLK_DELETE = 127
106
- SDLK_END = 1073741901
107
- SDLK_PAGEDOWN = 1073741902
108
- SDLK_RIGHT = 1073741903
109
- SDLK_LEFT = 1073741904
110
- SDLK_DOWN = 1073741905
111
- SDLK_UP = 1073741906
112
- SDLK_NUMLOCKCLEAR = 1073741907
113
- SDLK_KP_DIVIDE = 1073741908
114
- SDLK_KP_MULTIPLY = 1073741909
115
- SDLK_KP_MINUS = 1073741910
116
- SDLK_KP_PLUS = 1073741911
117
- SDLK_KP_ENTER = 1073741912
118
- SDLK_KP_1 = 1073741913
119
- SDLK_KP_2 = 1073741914
120
- SDLK_KP_3 = 1073741915
121
- SDLK_KP_4 = 1073741916
122
- SDLK_KP_5 = 1073741917
123
- SDLK_KP_6 = 1073741918
124
- SDLK_KP_7 = 1073741919
125
- SDLK_KP_8 = 1073741920
126
- SDLK_KP_9 = 1073741921
127
- SDLK_KP_0 = 1073741922
128
- SDLK_KP_PERIOD = 1073741923
129
- SDLK_APPLICATION = 1073741925
130
- SDLK_POWER = 1073741926
131
- SDLK_KP_EQUALS = 1073741927
132
- SDLK_F13 = 1073741928
133
- SDLK_F14 = 1073741929
134
- SDLK_F15 = 1073741930
135
- SDLK_F16 = 1073741931
136
- SDLK_F17 = 1073741932
137
- SDLK_F18 = 1073741933
138
- SDLK_F19 = 1073741934
139
- SDLK_F20 = 1073741935
140
- SDLK_F21 = 1073741936
141
- SDLK_F22 = 1073741937
142
- SDLK_F23 = 1073741938
143
- SDLK_F24 = 1073741939
144
- SDLK_EXECUTE = 1073741940
145
- SDLK_HELP = 1073741941
146
- SDLK_MENU = 1073741942
147
- SDLK_SELECT = 1073741943
148
- SDLK_STOP = 1073741944
149
- SDLK_AGAIN = 1073741945
150
- SDLK_UNDO = 1073741946
151
- SDLK_CUT = 1073741947
152
- SDLK_COPY = 1073741948
153
- SDLK_PASTE = 1073741949
154
- SDLK_FIND = 1073741950
155
- SDLK_MUTE = 1073741951
156
- SDLK_VOLUMEUP = 1073741952
157
- SDLK_VOLUMEDOWN = 1073741953
158
- SDLK_KP_COMMA = 1073741957
159
- SDLK_KP_EQUALSAS400 = 1073741958
160
- SDLK_ALTERASE = 1073741977
161
- SDLK_SYSREQ = 1073741978
162
- SDLK_CANCEL = 1073741979
163
- SDLK_CLEAR = 1073741980
164
- SDLK_PRIOR = 1073741981
165
- SDLK_RETURN2 = 1073741982
166
- SDLK_SEPARATOR = 1073741983
167
- SDLK_OUT = 1073741984
168
- SDLK_OPER = 1073741985
169
- SDLK_CLEARAGAIN = 1073741986
170
- SDLK_CRSEL = 1073741987
171
- SDLK_EXSEL = 1073741988
172
- SDLK_KP_00 = 1073742000
173
- SDLK_KP_000 = 1073742001
174
- SDLK_THOUSANDSSEPARATOR = 1073742002
175
- SDLK_DECIMALSEPARATOR = 1073742003
176
- SDLK_CURRENCYUNIT = 1073742004
177
- SDLK_CURRENCYSUBUNIT = 1073742005
178
- SDLK_KP_LEFTPAREN = 1073742006
179
- SDLK_KP_RIGHTPAREN = 1073742007
180
- SDLK_KP_LEFTBRACE = 1073742008
181
- SDLK_KP_RIGHTBRACE = 1073742009
182
- SDLK_KP_TAB = 1073742010
183
- SDLK_KP_BACKSPACE = 1073742011
184
- SDLK_KP_A = 1073742012
185
- SDLK_KP_B = 1073742013
186
- SDLK_KP_C = 1073742014
187
- SDLK_KP_D = 1073742015
188
- SDLK_KP_E = 1073742016
189
- SDLK_KP_F = 1073742017
190
- SDLK_KP_XOR = 1073742018
191
- SDLK_KP_POWER = 1073742019
192
- SDLK_KP_PERCENT = 1073742020
193
- SDLK_KP_LESS = 1073742021
194
- SDLK_KP_GREATER = 1073742022
195
- SDLK_KP_AMPERSAND = 1073742023
196
- SDLK_KP_DBLAMPERSAND = 1073742024
197
- SDLK_KP_VERTICALBAR = 1073742025
198
- SDLK_KP_DBLVERTICALBAR = 1073742026
199
- SDLK_KP_COLON = 1073742027
200
- SDLK_KP_HASH = 1073742028
201
- SDLK_KP_SPACE = 1073742029
202
- SDLK_KP_AT = 1073742030
203
- SDLK_KP_EXCLAM = 1073742031
204
- SDLK_KP_MEMSTORE = 1073742032
205
- SDLK_KP_MEMRECALL = 1073742033
206
- SDLK_KP_MEMCLEAR = 1073742034
207
- SDLK_KP_MEMADD = 1073742035
208
- SDLK_KP_MEMSUBTRACT = 1073742036
209
- SDLK_KP_MEMMULTIPLY = 1073742037
210
- SDLK_KP_MEMDIVIDE = 1073742038
211
- SDLK_KP_PLUSMINUS = 1073742039
212
- SDLK_KP_CLEAR = 1073742040
213
- SDLK_KP_CLEARENTRY = 1073742041
214
- SDLK_KP_BINARY = 1073742042
215
- SDLK_KP_OCTAL = 1073742043
216
- SDLK_KP_DECIMAL = 1073742044
217
- SDLK_KP_HEXADECIMAL = 1073742045
218
- SDLK_LCTRL = 1073742048
219
- SDLK_LSHIFT = 1073742049
220
- SDLK_LALT = 1073742050
221
- SDLK_LGUI = 1073742051
222
- SDLK_RCTRL = 1073742052
223
- SDLK_RSHIFT = 1073742053
224
- SDLK_RALT = 1073742054
225
- SDLK_RGUI = 1073742055
226
- SDLK_MODE = 1073742081
227
- SDLK_AUDIONEXT = 1073742082
228
- SDLK_AUDIOPREV = 1073742083
229
- SDLK_AUDIOSTOP = 1073742084
230
- SDLK_AUDIOPLAY = 1073742085
231
- SDLK_AUDIOMUTE = 1073742086
232
- SDLK_MEDIASELECT = 1073742087
233
- SDLK_WWW = 1073742088
234
- SDLK_MAIL = 1073742089
235
- SDLK_CALCULATOR = 1073742090
236
- SDLK_COMPUTER = 1073742091
237
- SDLK_AC_SEARCH = 1073742092
238
- SDLK_AC_HOME = 1073742093
239
- SDLK_AC_BACK = 1073742094
240
- SDLK_AC_FORWARD = 1073742095
241
- SDLK_AC_STOP = 1073742096
242
- SDLK_AC_REFRESH = 1073742097
243
- SDLK_AC_BOOKMARKS = 1073742098
244
- SDLK_BRIGHTNESSDOWN = 1073742099
245
- SDLK_BRIGHTNESSUP = 1073742100
246
- SDLK_DISPLAYSWITCH = 1073742101
247
- SDLK_KBDILLUMTOGGLE = 1073742102
248
- SDLK_KBDILLUMDOWN = 1073742103
249
- SDLK_KBDILLUMUP = 1073742104
250
- SDLK_EJECT = 1073742105
251
- SDLK_SLEEP = 1073742106
252
- SDLK_APP1 = 1073742107
253
- SDLK_APP2 = 1073742108
254
- SDLK_AUDIOREWIND = 1073742109
255
- SDLK_AUDIOFASTFORWARD = 1073742110
256
- KMOD_NONE = 0
257
- KMOD_LSHIFT = 1
258
- KMOD_RSHIFT = 2
259
- KMOD_LCTRL = 64
260
- KMOD_RCTRL = 128
261
- KMOD_LALT = 256
262
- KMOD_RALT = 512
263
- KMOD_LGUI = 1024
264
- KMOD_RGUI = 2048
265
- KMOD_NUM = 4096
266
- KMOD_CAPS = 8192
267
- KMOD_MODE = 16384
268
- KMOD_RESERVED = 32768
269
- KMOD_CTRL = 192
270
- KMOD_SHIFT = 3
271
- KMOD_ALT = 768
272
- KMOD_GUI = 3072
273
-
274
- # Typedef
275
-
276
- typedef :int, :SDL_Keycode
277
- typedef :int, :SDL_KeyCode
278
- typedef :int, :SDL_Keymod
279
-
280
- # Struct
281
-
282
-
283
- # Function
284
-
285
- def self.setup_keycode_symbols()
286
- symbols = [
287
- ]
288
- args = {
289
- }
290
- retvals = {
291
- }
292
- symbols.each do |sym|
293
- begin
294
- attach_function sym, args[sym], retvals[sym]
295
- rescue FFI::NotFoundError => error
296
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
297
- end
298
- end
299
- end
300
-
301
- end
302
-
303
- # TODO #define KMOD_CTRL, #define KMOD_SHIFT, #define KMOD_ALT and #define KMOD_GUI
304
-
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL2
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+ SDLK_UNKNOWN = 0
17
+ SDLK_RETURN = 13
18
+ SDLK_ESCAPE = 27
19
+ SDLK_BACKSPACE = 8
20
+ SDLK_TAB = 9
21
+ SDLK_SPACE = 32
22
+ SDLK_EXCLAIM = 33
23
+ SDLK_QUOTEDBL = 34
24
+ SDLK_HASH = 35
25
+ SDLK_PERCENT = 37
26
+ SDLK_DOLLAR = 36
27
+ SDLK_AMPERSAND = 38
28
+ SDLK_QUOTE = 39
29
+ SDLK_LEFTPAREN = 40
30
+ SDLK_RIGHTPAREN = 41
31
+ SDLK_ASTERISK = 42
32
+ SDLK_PLUS = 43
33
+ SDLK_COMMA = 44
34
+ SDLK_MINUS = 45
35
+ SDLK_PERIOD = 46
36
+ SDLK_SLASH = 47
37
+ SDLK_0 = 48
38
+ SDLK_1 = 49
39
+ SDLK_2 = 50
40
+ SDLK_3 = 51
41
+ SDLK_4 = 52
42
+ SDLK_5 = 53
43
+ SDLK_6 = 54
44
+ SDLK_7 = 55
45
+ SDLK_8 = 56
46
+ SDLK_9 = 57
47
+ SDLK_COLON = 58
48
+ SDLK_SEMICOLON = 59
49
+ SDLK_LESS = 60
50
+ SDLK_EQUALS = 61
51
+ SDLK_GREATER = 62
52
+ SDLK_QUESTION = 63
53
+ SDLK_AT = 64
54
+ SDLK_LEFTBRACKET = 91
55
+ SDLK_BACKSLASH = 92
56
+ SDLK_RIGHTBRACKET = 93
57
+ SDLK_CARET = 94
58
+ SDLK_UNDERSCORE = 95
59
+ SDLK_BACKQUOTE = 96
60
+ SDLK_a = 97
61
+ SDLK_b = 98
62
+ SDLK_c = 99
63
+ SDLK_d = 100
64
+ SDLK_e = 101
65
+ SDLK_f = 102
66
+ SDLK_g = 103
67
+ SDLK_h = 104
68
+ SDLK_i = 105
69
+ SDLK_j = 106
70
+ SDLK_k = 107
71
+ SDLK_l = 108
72
+ SDLK_m = 109
73
+ SDLK_n = 110
74
+ SDLK_o = 111
75
+ SDLK_p = 112
76
+ SDLK_q = 113
77
+ SDLK_r = 114
78
+ SDLK_s = 115
79
+ SDLK_t = 116
80
+ SDLK_u = 117
81
+ SDLK_v = 118
82
+ SDLK_w = 119
83
+ SDLK_x = 120
84
+ SDLK_y = 121
85
+ SDLK_z = 122
86
+ SDLK_CAPSLOCK = 1073741881
87
+ SDLK_F1 = 1073741882
88
+ SDLK_F2 = 1073741883
89
+ SDLK_F3 = 1073741884
90
+ SDLK_F4 = 1073741885
91
+ SDLK_F5 = 1073741886
92
+ SDLK_F6 = 1073741887
93
+ SDLK_F7 = 1073741888
94
+ SDLK_F8 = 1073741889
95
+ SDLK_F9 = 1073741890
96
+ SDLK_F10 = 1073741891
97
+ SDLK_F11 = 1073741892
98
+ SDLK_F12 = 1073741893
99
+ SDLK_PRINTSCREEN = 1073741894
100
+ SDLK_SCROLLLOCK = 1073741895
101
+ SDLK_PAUSE = 1073741896
102
+ SDLK_INSERT = 1073741897
103
+ SDLK_HOME = 1073741898
104
+ SDLK_PAGEUP = 1073741899
105
+ SDLK_DELETE = 127
106
+ SDLK_END = 1073741901
107
+ SDLK_PAGEDOWN = 1073741902
108
+ SDLK_RIGHT = 1073741903
109
+ SDLK_LEFT = 1073741904
110
+ SDLK_DOWN = 1073741905
111
+ SDLK_UP = 1073741906
112
+ SDLK_NUMLOCKCLEAR = 1073741907
113
+ SDLK_KP_DIVIDE = 1073741908
114
+ SDLK_KP_MULTIPLY = 1073741909
115
+ SDLK_KP_MINUS = 1073741910
116
+ SDLK_KP_PLUS = 1073741911
117
+ SDLK_KP_ENTER = 1073741912
118
+ SDLK_KP_1 = 1073741913
119
+ SDLK_KP_2 = 1073741914
120
+ SDLK_KP_3 = 1073741915
121
+ SDLK_KP_4 = 1073741916
122
+ SDLK_KP_5 = 1073741917
123
+ SDLK_KP_6 = 1073741918
124
+ SDLK_KP_7 = 1073741919
125
+ SDLK_KP_8 = 1073741920
126
+ SDLK_KP_9 = 1073741921
127
+ SDLK_KP_0 = 1073741922
128
+ SDLK_KP_PERIOD = 1073741923
129
+ SDLK_APPLICATION = 1073741925
130
+ SDLK_POWER = 1073741926
131
+ SDLK_KP_EQUALS = 1073741927
132
+ SDLK_F13 = 1073741928
133
+ SDLK_F14 = 1073741929
134
+ SDLK_F15 = 1073741930
135
+ SDLK_F16 = 1073741931
136
+ SDLK_F17 = 1073741932
137
+ SDLK_F18 = 1073741933
138
+ SDLK_F19 = 1073741934
139
+ SDLK_F20 = 1073741935
140
+ SDLK_F21 = 1073741936
141
+ SDLK_F22 = 1073741937
142
+ SDLK_F23 = 1073741938
143
+ SDLK_F24 = 1073741939
144
+ SDLK_EXECUTE = 1073741940
145
+ SDLK_HELP = 1073741941
146
+ SDLK_MENU = 1073741942
147
+ SDLK_SELECT = 1073741943
148
+ SDLK_STOP = 1073741944
149
+ SDLK_AGAIN = 1073741945
150
+ SDLK_UNDO = 1073741946
151
+ SDLK_CUT = 1073741947
152
+ SDLK_COPY = 1073741948
153
+ SDLK_PASTE = 1073741949
154
+ SDLK_FIND = 1073741950
155
+ SDLK_MUTE = 1073741951
156
+ SDLK_VOLUMEUP = 1073741952
157
+ SDLK_VOLUMEDOWN = 1073741953
158
+ SDLK_KP_COMMA = 1073741957
159
+ SDLK_KP_EQUALSAS400 = 1073741958
160
+ SDLK_ALTERASE = 1073741977
161
+ SDLK_SYSREQ = 1073741978
162
+ SDLK_CANCEL = 1073741979
163
+ SDLK_CLEAR = 1073741980
164
+ SDLK_PRIOR = 1073741981
165
+ SDLK_RETURN2 = 1073741982
166
+ SDLK_SEPARATOR = 1073741983
167
+ SDLK_OUT = 1073741984
168
+ SDLK_OPER = 1073741985
169
+ SDLK_CLEARAGAIN = 1073741986
170
+ SDLK_CRSEL = 1073741987
171
+ SDLK_EXSEL = 1073741988
172
+ SDLK_KP_00 = 1073742000
173
+ SDLK_KP_000 = 1073742001
174
+ SDLK_THOUSANDSSEPARATOR = 1073742002
175
+ SDLK_DECIMALSEPARATOR = 1073742003
176
+ SDLK_CURRENCYUNIT = 1073742004
177
+ SDLK_CURRENCYSUBUNIT = 1073742005
178
+ SDLK_KP_LEFTPAREN = 1073742006
179
+ SDLK_KP_RIGHTPAREN = 1073742007
180
+ SDLK_KP_LEFTBRACE = 1073742008
181
+ SDLK_KP_RIGHTBRACE = 1073742009
182
+ SDLK_KP_TAB = 1073742010
183
+ SDLK_KP_BACKSPACE = 1073742011
184
+ SDLK_KP_A = 1073742012
185
+ SDLK_KP_B = 1073742013
186
+ SDLK_KP_C = 1073742014
187
+ SDLK_KP_D = 1073742015
188
+ SDLK_KP_E = 1073742016
189
+ SDLK_KP_F = 1073742017
190
+ SDLK_KP_XOR = 1073742018
191
+ SDLK_KP_POWER = 1073742019
192
+ SDLK_KP_PERCENT = 1073742020
193
+ SDLK_KP_LESS = 1073742021
194
+ SDLK_KP_GREATER = 1073742022
195
+ SDLK_KP_AMPERSAND = 1073742023
196
+ SDLK_KP_DBLAMPERSAND = 1073742024
197
+ SDLK_KP_VERTICALBAR = 1073742025
198
+ SDLK_KP_DBLVERTICALBAR = 1073742026
199
+ SDLK_KP_COLON = 1073742027
200
+ SDLK_KP_HASH = 1073742028
201
+ SDLK_KP_SPACE = 1073742029
202
+ SDLK_KP_AT = 1073742030
203
+ SDLK_KP_EXCLAM = 1073742031
204
+ SDLK_KP_MEMSTORE = 1073742032
205
+ SDLK_KP_MEMRECALL = 1073742033
206
+ SDLK_KP_MEMCLEAR = 1073742034
207
+ SDLK_KP_MEMADD = 1073742035
208
+ SDLK_KP_MEMSUBTRACT = 1073742036
209
+ SDLK_KP_MEMMULTIPLY = 1073742037
210
+ SDLK_KP_MEMDIVIDE = 1073742038
211
+ SDLK_KP_PLUSMINUS = 1073742039
212
+ SDLK_KP_CLEAR = 1073742040
213
+ SDLK_KP_CLEARENTRY = 1073742041
214
+ SDLK_KP_BINARY = 1073742042
215
+ SDLK_KP_OCTAL = 1073742043
216
+ SDLK_KP_DECIMAL = 1073742044
217
+ SDLK_KP_HEXADECIMAL = 1073742045
218
+ SDLK_LCTRL = 1073742048
219
+ SDLK_LSHIFT = 1073742049
220
+ SDLK_LALT = 1073742050
221
+ SDLK_LGUI = 1073742051
222
+ SDLK_RCTRL = 1073742052
223
+ SDLK_RSHIFT = 1073742053
224
+ SDLK_RALT = 1073742054
225
+ SDLK_RGUI = 1073742055
226
+ SDLK_MODE = 1073742081
227
+ SDLK_AUDIONEXT = 1073742082
228
+ SDLK_AUDIOPREV = 1073742083
229
+ SDLK_AUDIOSTOP = 1073742084
230
+ SDLK_AUDIOPLAY = 1073742085
231
+ SDLK_AUDIOMUTE = 1073742086
232
+ SDLK_MEDIASELECT = 1073742087
233
+ SDLK_WWW = 1073742088
234
+ SDLK_MAIL = 1073742089
235
+ SDLK_CALCULATOR = 1073742090
236
+ SDLK_COMPUTER = 1073742091
237
+ SDLK_AC_SEARCH = 1073742092
238
+ SDLK_AC_HOME = 1073742093
239
+ SDLK_AC_BACK = 1073742094
240
+ SDLK_AC_FORWARD = 1073742095
241
+ SDLK_AC_STOP = 1073742096
242
+ SDLK_AC_REFRESH = 1073742097
243
+ SDLK_AC_BOOKMARKS = 1073742098
244
+ SDLK_BRIGHTNESSDOWN = 1073742099
245
+ SDLK_BRIGHTNESSUP = 1073742100
246
+ SDLK_DISPLAYSWITCH = 1073742101
247
+ SDLK_KBDILLUMTOGGLE = 1073742102
248
+ SDLK_KBDILLUMDOWN = 1073742103
249
+ SDLK_KBDILLUMUP = 1073742104
250
+ SDLK_EJECT = 1073742105
251
+ SDLK_SLEEP = 1073742106
252
+ SDLK_APP1 = 1073742107
253
+ SDLK_APP2 = 1073742108
254
+ SDLK_AUDIOREWIND = 1073742109
255
+ SDLK_AUDIOFASTFORWARD = 1073742110
256
+ KMOD_NONE = 0
257
+ KMOD_LSHIFT = 1
258
+ KMOD_RSHIFT = 2
259
+ KMOD_LCTRL = 64
260
+ KMOD_RCTRL = 128
261
+ KMOD_LALT = 256
262
+ KMOD_RALT = 512
263
+ KMOD_LGUI = 1024
264
+ KMOD_RGUI = 2048
265
+ KMOD_NUM = 4096
266
+ KMOD_CAPS = 8192
267
+ KMOD_MODE = 16384
268
+ KMOD_RESERVED = 32768
269
+ KMOD_CTRL = 192
270
+ KMOD_SHIFT = 3
271
+ KMOD_ALT = 768
272
+ KMOD_GUI = 3072
273
+
274
+ # Typedef
275
+
276
+ typedef :int, :SDL_Keycode
277
+ typedef :int, :SDL_KeyCode
278
+ typedef :int, :SDL_Keymod
279
+
280
+ # Struct
281
+
282
+
283
+ # Function
284
+
285
+ def self.setup_keycode_symbols()
286
+ symbols = [
287
+ ]
288
+ args = {
289
+ }
290
+ retvals = {
291
+ }
292
+ symbols.each do |sym|
293
+ begin
294
+ attach_function sym, args[sym], retvals[sym]
295
+ rescue FFI::NotFoundError => error
296
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
297
+ end
298
+ end
299
+ end
300
+
301
+ end
302
+
303
+ # TODO #define KMOD_CTRL, #define KMOD_SHIFT, #define KMOD_ALT and #define KMOD_GUI
304
+