sdl2-bindings 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +12 -0
  3. data/README.md +39 -26
  4. data/lib/sdl2.rb +54 -99
  5. data/lib/sdl2_audio.rb +59 -20
  6. data/lib/sdl2_blendmode.rb +28 -25
  7. data/lib/sdl2_clipboard.rb +9 -4
  8. data/lib/sdl2_cpuinfo.rb +28 -5
  9. data/lib/sdl2_error.rb +17 -10
  10. data/lib/sdl2_events.rb +150 -131
  11. data/lib/sdl2_filesystem.rb +8 -4
  12. data/lib/sdl2_framerate.rb +11 -4
  13. data/lib/sdl2_gamecontroller.rb +112 -57
  14. data/lib/sdl2_gesture.rb +10 -4
  15. data/lib/sdl2_gfxPrimitives.rb +65 -4
  16. data/lib/sdl2_haptic.rb +76 -44
  17. data/lib/sdl2_hidapi.rb +26 -5
  18. data/lib/sdl2_hints.rb +146 -137
  19. data/lib/sdl2_image.rb +54 -7
  20. data/lib/sdl2_imageFilter.rb +36 -4
  21. data/lib/sdl2_joystick.rb +93 -38
  22. data/lib/sdl2_keyboard.rb +23 -5
  23. data/lib/sdl2_keycode.rb +6 -4
  24. data/lib/sdl2_log.rb +48 -32
  25. data/lib/sdl2_main.rb +21 -14
  26. data/lib/sdl2_messagebox.rb +26 -22
  27. data/lib/sdl2_misc.rb +7 -4
  28. data/lib/sdl2_mixer.rb +86 -11
  29. data/lib/sdl2_mouse.rb +44 -25
  30. data/lib/sdl2_pixels.rb +115 -99
  31. data/lib/sdl2_platform.rb +7 -4
  32. data/lib/sdl2_power.rb +12 -9
  33. data/lib/sdl2_rect.rb +18 -11
  34. data/lib/sdl2_render.rb +107 -25
  35. data/lib/sdl2_rotozoom.rb +14 -4
  36. data/lib/sdl2_rwops.rb +58 -28
  37. data/lib/sdl2_scancode.rb +250 -248
  38. data/lib/sdl2_sensor.rb +27 -9
  39. data/lib/sdl2_shape.rb +17 -11
  40. data/lib/sdl2_stdinc.rb +135 -10
  41. data/lib/sdl2_surface.rb +56 -15
  42. data/lib/sdl2_syswm.rb +47 -44
  43. data/lib/sdl2_timer.rb +13 -4
  44. data/lib/sdl2_touch.rb +18 -11
  45. data/lib/sdl2_ttf.rb +180 -25
  46. data/lib/sdl2_version.rb +13 -8
  47. data/lib/sdl2_video.rb +204 -110
  48. data/lib/sdl2_vulkan.rb +12 -4
  49. metadata +17 -3
data/lib/sdl2_scancode.rb CHANGED
@@ -6,257 +6,257 @@
6
6
 
7
7
  require 'ffi'
8
8
 
9
- module SDL2
9
+ module SDL
10
10
  extend FFI::Library
11
11
  # Define/Macro
12
12
 
13
13
 
14
14
  # Enum
15
15
 
16
- SDL_SCANCODE_UNKNOWN = 0
17
- SDL_SCANCODE_A = 4
18
- SDL_SCANCODE_B = 5
19
- SDL_SCANCODE_C = 6
20
- SDL_SCANCODE_D = 7
21
- SDL_SCANCODE_E = 8
22
- SDL_SCANCODE_F = 9
23
- SDL_SCANCODE_G = 10
24
- SDL_SCANCODE_H = 11
25
- SDL_SCANCODE_I = 12
26
- SDL_SCANCODE_J = 13
27
- SDL_SCANCODE_K = 14
28
- SDL_SCANCODE_L = 15
29
- SDL_SCANCODE_M = 16
30
- SDL_SCANCODE_N = 17
31
- SDL_SCANCODE_O = 18
32
- SDL_SCANCODE_P = 19
33
- SDL_SCANCODE_Q = 20
34
- SDL_SCANCODE_R = 21
35
- SDL_SCANCODE_S = 22
36
- SDL_SCANCODE_T = 23
37
- SDL_SCANCODE_U = 24
38
- SDL_SCANCODE_V = 25
39
- SDL_SCANCODE_W = 26
40
- SDL_SCANCODE_X = 27
41
- SDL_SCANCODE_Y = 28
42
- SDL_SCANCODE_Z = 29
43
- SDL_SCANCODE_1 = 30
44
- SDL_SCANCODE_2 = 31
45
- SDL_SCANCODE_3 = 32
46
- SDL_SCANCODE_4 = 33
47
- SDL_SCANCODE_5 = 34
48
- SDL_SCANCODE_6 = 35
49
- SDL_SCANCODE_7 = 36
50
- SDL_SCANCODE_8 = 37
51
- SDL_SCANCODE_9 = 38
52
- SDL_SCANCODE_0 = 39
53
- SDL_SCANCODE_RETURN = 40
54
- SDL_SCANCODE_ESCAPE = 41
55
- SDL_SCANCODE_BACKSPACE = 42
56
- SDL_SCANCODE_TAB = 43
57
- SDL_SCANCODE_SPACE = 44
58
- SDL_SCANCODE_MINUS = 45
59
- SDL_SCANCODE_EQUALS = 46
60
- SDL_SCANCODE_LEFTBRACKET = 47
61
- SDL_SCANCODE_RIGHTBRACKET = 48
62
- SDL_SCANCODE_BACKSLASH = 49
63
- SDL_SCANCODE_NONUSHASH = 50
64
- SDL_SCANCODE_SEMICOLON = 51
65
- SDL_SCANCODE_APOSTROPHE = 52
66
- SDL_SCANCODE_GRAVE = 53
67
- SDL_SCANCODE_COMMA = 54
68
- SDL_SCANCODE_PERIOD = 55
69
- SDL_SCANCODE_SLASH = 56
70
- SDL_SCANCODE_CAPSLOCK = 57
71
- SDL_SCANCODE_F1 = 58
72
- SDL_SCANCODE_F2 = 59
73
- SDL_SCANCODE_F3 = 60
74
- SDL_SCANCODE_F4 = 61
75
- SDL_SCANCODE_F5 = 62
76
- SDL_SCANCODE_F6 = 63
77
- SDL_SCANCODE_F7 = 64
78
- SDL_SCANCODE_F8 = 65
79
- SDL_SCANCODE_F9 = 66
80
- SDL_SCANCODE_F10 = 67
81
- SDL_SCANCODE_F11 = 68
82
- SDL_SCANCODE_F12 = 69
83
- SDL_SCANCODE_PRINTSCREEN = 70
84
- SDL_SCANCODE_SCROLLLOCK = 71
85
- SDL_SCANCODE_PAUSE = 72
86
- SDL_SCANCODE_INSERT = 73
87
- SDL_SCANCODE_HOME = 74
88
- SDL_SCANCODE_PAGEUP = 75
89
- SDL_SCANCODE_DELETE = 76
90
- SDL_SCANCODE_END = 77
91
- SDL_SCANCODE_PAGEDOWN = 78
92
- SDL_SCANCODE_RIGHT = 79
93
- SDL_SCANCODE_LEFT = 80
94
- SDL_SCANCODE_DOWN = 81
95
- SDL_SCANCODE_UP = 82
96
- SDL_SCANCODE_NUMLOCKCLEAR = 83
97
- SDL_SCANCODE_KP_DIVIDE = 84
98
- SDL_SCANCODE_KP_MULTIPLY = 85
99
- SDL_SCANCODE_KP_MINUS = 86
100
- SDL_SCANCODE_KP_PLUS = 87
101
- SDL_SCANCODE_KP_ENTER = 88
102
- SDL_SCANCODE_KP_1 = 89
103
- SDL_SCANCODE_KP_2 = 90
104
- SDL_SCANCODE_KP_3 = 91
105
- SDL_SCANCODE_KP_4 = 92
106
- SDL_SCANCODE_KP_5 = 93
107
- SDL_SCANCODE_KP_6 = 94
108
- SDL_SCANCODE_KP_7 = 95
109
- SDL_SCANCODE_KP_8 = 96
110
- SDL_SCANCODE_KP_9 = 97
111
- SDL_SCANCODE_KP_0 = 98
112
- SDL_SCANCODE_KP_PERIOD = 99
113
- SDL_SCANCODE_NONUSBACKSLASH = 100
114
- SDL_SCANCODE_APPLICATION = 101
115
- SDL_SCANCODE_POWER = 102
116
- SDL_SCANCODE_KP_EQUALS = 103
117
- SDL_SCANCODE_F13 = 104
118
- SDL_SCANCODE_F14 = 105
119
- SDL_SCANCODE_F15 = 106
120
- SDL_SCANCODE_F16 = 107
121
- SDL_SCANCODE_F17 = 108
122
- SDL_SCANCODE_F18 = 109
123
- SDL_SCANCODE_F19 = 110
124
- SDL_SCANCODE_F20 = 111
125
- SDL_SCANCODE_F21 = 112
126
- SDL_SCANCODE_F22 = 113
127
- SDL_SCANCODE_F23 = 114
128
- SDL_SCANCODE_F24 = 115
129
- SDL_SCANCODE_EXECUTE = 116
130
- SDL_SCANCODE_HELP = 117
131
- SDL_SCANCODE_MENU = 118
132
- SDL_SCANCODE_SELECT = 119
133
- SDL_SCANCODE_STOP = 120
134
- SDL_SCANCODE_AGAIN = 121
135
- SDL_SCANCODE_UNDO = 122
136
- SDL_SCANCODE_CUT = 123
137
- SDL_SCANCODE_COPY = 124
138
- SDL_SCANCODE_PASTE = 125
139
- SDL_SCANCODE_FIND = 126
140
- SDL_SCANCODE_MUTE = 127
141
- SDL_SCANCODE_VOLUMEUP = 128
142
- SDL_SCANCODE_VOLUMEDOWN = 129
143
- SDL_SCANCODE_KP_COMMA = 133
144
- SDL_SCANCODE_KP_EQUALSAS400 = 134
145
- SDL_SCANCODE_INTERNATIONAL1 = 135
146
- SDL_SCANCODE_INTERNATIONAL2 = 136
147
- SDL_SCANCODE_INTERNATIONAL3 = 137
148
- SDL_SCANCODE_INTERNATIONAL4 = 138
149
- SDL_SCANCODE_INTERNATIONAL5 = 139
150
- SDL_SCANCODE_INTERNATIONAL6 = 140
151
- SDL_SCANCODE_INTERNATIONAL7 = 141
152
- SDL_SCANCODE_INTERNATIONAL8 = 142
153
- SDL_SCANCODE_INTERNATIONAL9 = 143
154
- SDL_SCANCODE_LANG1 = 144
155
- SDL_SCANCODE_LANG2 = 145
156
- SDL_SCANCODE_LANG3 = 146
157
- SDL_SCANCODE_LANG4 = 147
158
- SDL_SCANCODE_LANG5 = 148
159
- SDL_SCANCODE_LANG6 = 149
160
- SDL_SCANCODE_LANG7 = 150
161
- SDL_SCANCODE_LANG8 = 151
162
- SDL_SCANCODE_LANG9 = 152
163
- SDL_SCANCODE_ALTERASE = 153
164
- SDL_SCANCODE_SYSREQ = 154
165
- SDL_SCANCODE_CANCEL = 155
166
- SDL_SCANCODE_CLEAR = 156
167
- SDL_SCANCODE_PRIOR = 157
168
- SDL_SCANCODE_RETURN2 = 158
169
- SDL_SCANCODE_SEPARATOR = 159
170
- SDL_SCANCODE_OUT = 160
171
- SDL_SCANCODE_OPER = 161
172
- SDL_SCANCODE_CLEARAGAIN = 162
173
- SDL_SCANCODE_CRSEL = 163
174
- SDL_SCANCODE_EXSEL = 164
175
- SDL_SCANCODE_KP_00 = 176
176
- SDL_SCANCODE_KP_000 = 177
177
- SDL_SCANCODE_THOUSANDSSEPARATOR = 178
178
- SDL_SCANCODE_DECIMALSEPARATOR = 179
179
- SDL_SCANCODE_CURRENCYUNIT = 180
180
- SDL_SCANCODE_CURRENCYSUBUNIT = 181
181
- SDL_SCANCODE_KP_LEFTPAREN = 182
182
- SDL_SCANCODE_KP_RIGHTPAREN = 183
183
- SDL_SCANCODE_KP_LEFTBRACE = 184
184
- SDL_SCANCODE_KP_RIGHTBRACE = 185
185
- SDL_SCANCODE_KP_TAB = 186
186
- SDL_SCANCODE_KP_BACKSPACE = 187
187
- SDL_SCANCODE_KP_A = 188
188
- SDL_SCANCODE_KP_B = 189
189
- SDL_SCANCODE_KP_C = 190
190
- SDL_SCANCODE_KP_D = 191
191
- SDL_SCANCODE_KP_E = 192
192
- SDL_SCANCODE_KP_F = 193
193
- SDL_SCANCODE_KP_XOR = 194
194
- SDL_SCANCODE_KP_POWER = 195
195
- SDL_SCANCODE_KP_PERCENT = 196
196
- SDL_SCANCODE_KP_LESS = 197
197
- SDL_SCANCODE_KP_GREATER = 198
198
- SDL_SCANCODE_KP_AMPERSAND = 199
199
- SDL_SCANCODE_KP_DBLAMPERSAND = 200
200
- SDL_SCANCODE_KP_VERTICALBAR = 201
201
- SDL_SCANCODE_KP_DBLVERTICALBAR = 202
202
- SDL_SCANCODE_KP_COLON = 203
203
- SDL_SCANCODE_KP_HASH = 204
204
- SDL_SCANCODE_KP_SPACE = 205
205
- SDL_SCANCODE_KP_AT = 206
206
- SDL_SCANCODE_KP_EXCLAM = 207
207
- SDL_SCANCODE_KP_MEMSTORE = 208
208
- SDL_SCANCODE_KP_MEMRECALL = 209
209
- SDL_SCANCODE_KP_MEMCLEAR = 210
210
- SDL_SCANCODE_KP_MEMADD = 211
211
- SDL_SCANCODE_KP_MEMSUBTRACT = 212
212
- SDL_SCANCODE_KP_MEMMULTIPLY = 213
213
- SDL_SCANCODE_KP_MEMDIVIDE = 214
214
- SDL_SCANCODE_KP_PLUSMINUS = 215
215
- SDL_SCANCODE_KP_CLEAR = 216
216
- SDL_SCANCODE_KP_CLEARENTRY = 217
217
- SDL_SCANCODE_KP_BINARY = 218
218
- SDL_SCANCODE_KP_OCTAL = 219
219
- SDL_SCANCODE_KP_DECIMAL = 220
220
- SDL_SCANCODE_KP_HEXADECIMAL = 221
221
- SDL_SCANCODE_LCTRL = 224
222
- SDL_SCANCODE_LSHIFT = 225
223
- SDL_SCANCODE_LALT = 226
224
- SDL_SCANCODE_LGUI = 227
225
- SDL_SCANCODE_RCTRL = 228
226
- SDL_SCANCODE_RSHIFT = 229
227
- SDL_SCANCODE_RALT = 230
228
- SDL_SCANCODE_RGUI = 231
229
- SDL_SCANCODE_MODE = 257
230
- SDL_SCANCODE_AUDIONEXT = 258
231
- SDL_SCANCODE_AUDIOPREV = 259
232
- SDL_SCANCODE_AUDIOSTOP = 260
233
- SDL_SCANCODE_AUDIOPLAY = 261
234
- SDL_SCANCODE_AUDIOMUTE = 262
235
- SDL_SCANCODE_MEDIASELECT = 263
236
- SDL_SCANCODE_WWW = 264
237
- SDL_SCANCODE_MAIL = 265
238
- SDL_SCANCODE_CALCULATOR = 266
239
- SDL_SCANCODE_COMPUTER = 267
240
- SDL_SCANCODE_AC_SEARCH = 268
241
- SDL_SCANCODE_AC_HOME = 269
242
- SDL_SCANCODE_AC_BACK = 270
243
- SDL_SCANCODE_AC_FORWARD = 271
244
- SDL_SCANCODE_AC_STOP = 272
245
- SDL_SCANCODE_AC_REFRESH = 273
246
- SDL_SCANCODE_AC_BOOKMARKS = 274
247
- SDL_SCANCODE_BRIGHTNESSDOWN = 275
248
- SDL_SCANCODE_BRIGHTNESSUP = 276
249
- SDL_SCANCODE_DISPLAYSWITCH = 277
250
- SDL_SCANCODE_KBDILLUMTOGGLE = 278
251
- SDL_SCANCODE_KBDILLUMDOWN = 279
252
- SDL_SCANCODE_KBDILLUMUP = 280
253
- SDL_SCANCODE_EJECT = 281
254
- SDL_SCANCODE_SLEEP = 282
255
- SDL_SCANCODE_APP1 = 283
256
- SDL_SCANCODE_APP2 = 284
257
- SDL_SCANCODE_AUDIOREWIND = 285
258
- SDL_SCANCODE_AUDIOFASTFORWARD = 286
259
- SDL_NUM_SCANCODES = 512
16
+ SCANCODE_UNKNOWN = 0
17
+ SCANCODE_A = 4
18
+ SCANCODE_B = 5
19
+ SCANCODE_C = 6
20
+ SCANCODE_D = 7
21
+ SCANCODE_E = 8
22
+ SCANCODE_F = 9
23
+ SCANCODE_G = 10
24
+ SCANCODE_H = 11
25
+ SCANCODE_I = 12
26
+ SCANCODE_J = 13
27
+ SCANCODE_K = 14
28
+ SCANCODE_L = 15
29
+ SCANCODE_M = 16
30
+ SCANCODE_N = 17
31
+ SCANCODE_O = 18
32
+ SCANCODE_P = 19
33
+ SCANCODE_Q = 20
34
+ SCANCODE_R = 21
35
+ SCANCODE_S = 22
36
+ SCANCODE_T = 23
37
+ SCANCODE_U = 24
38
+ SCANCODE_V = 25
39
+ SCANCODE_W = 26
40
+ SCANCODE_X = 27
41
+ SCANCODE_Y = 28
42
+ SCANCODE_Z = 29
43
+ SCANCODE_1 = 30
44
+ SCANCODE_2 = 31
45
+ SCANCODE_3 = 32
46
+ SCANCODE_4 = 33
47
+ SCANCODE_5 = 34
48
+ SCANCODE_6 = 35
49
+ SCANCODE_7 = 36
50
+ SCANCODE_8 = 37
51
+ SCANCODE_9 = 38
52
+ SCANCODE_0 = 39
53
+ SCANCODE_RETURN = 40
54
+ SCANCODE_ESCAPE = 41
55
+ SCANCODE_BACKSPACE = 42
56
+ SCANCODE_TAB = 43
57
+ SCANCODE_SPACE = 44
58
+ SCANCODE_MINUS = 45
59
+ SCANCODE_EQUALS = 46
60
+ SCANCODE_LEFTBRACKET = 47
61
+ SCANCODE_RIGHTBRACKET = 48
62
+ SCANCODE_BACKSLASH = 49
63
+ SCANCODE_NONUSHASH = 50
64
+ SCANCODE_SEMICOLON = 51
65
+ SCANCODE_APOSTROPHE = 52
66
+ SCANCODE_GRAVE = 53
67
+ SCANCODE_COMMA = 54
68
+ SCANCODE_PERIOD = 55
69
+ SCANCODE_SLASH = 56
70
+ SCANCODE_CAPSLOCK = 57
71
+ SCANCODE_F1 = 58
72
+ SCANCODE_F2 = 59
73
+ SCANCODE_F3 = 60
74
+ SCANCODE_F4 = 61
75
+ SCANCODE_F5 = 62
76
+ SCANCODE_F6 = 63
77
+ SCANCODE_F7 = 64
78
+ SCANCODE_F8 = 65
79
+ SCANCODE_F9 = 66
80
+ SCANCODE_F10 = 67
81
+ SCANCODE_F11 = 68
82
+ SCANCODE_F12 = 69
83
+ SCANCODE_PRINTSCREEN = 70
84
+ SCANCODE_SCROLLLOCK = 71
85
+ SCANCODE_PAUSE = 72
86
+ SCANCODE_INSERT = 73
87
+ SCANCODE_HOME = 74
88
+ SCANCODE_PAGEUP = 75
89
+ SCANCODE_DELETE = 76
90
+ SCANCODE_END = 77
91
+ SCANCODE_PAGEDOWN = 78
92
+ SCANCODE_RIGHT = 79
93
+ SCANCODE_LEFT = 80
94
+ SCANCODE_DOWN = 81
95
+ SCANCODE_UP = 82
96
+ SCANCODE_NUMLOCKCLEAR = 83
97
+ SCANCODE_KP_DIVIDE = 84
98
+ SCANCODE_KP_MULTIPLY = 85
99
+ SCANCODE_KP_MINUS = 86
100
+ SCANCODE_KP_PLUS = 87
101
+ SCANCODE_KP_ENTER = 88
102
+ SCANCODE_KP_1 = 89
103
+ SCANCODE_KP_2 = 90
104
+ SCANCODE_KP_3 = 91
105
+ SCANCODE_KP_4 = 92
106
+ SCANCODE_KP_5 = 93
107
+ SCANCODE_KP_6 = 94
108
+ SCANCODE_KP_7 = 95
109
+ SCANCODE_KP_8 = 96
110
+ SCANCODE_KP_9 = 97
111
+ SCANCODE_KP_0 = 98
112
+ SCANCODE_KP_PERIOD = 99
113
+ SCANCODE_NONUSBACKSLASH = 100
114
+ SCANCODE_APPLICATION = 101
115
+ SCANCODE_POWER = 102
116
+ SCANCODE_KP_EQUALS = 103
117
+ SCANCODE_F13 = 104
118
+ SCANCODE_F14 = 105
119
+ SCANCODE_F15 = 106
120
+ SCANCODE_F16 = 107
121
+ SCANCODE_F17 = 108
122
+ SCANCODE_F18 = 109
123
+ SCANCODE_F19 = 110
124
+ SCANCODE_F20 = 111
125
+ SCANCODE_F21 = 112
126
+ SCANCODE_F22 = 113
127
+ SCANCODE_F23 = 114
128
+ SCANCODE_F24 = 115
129
+ SCANCODE_EXECUTE = 116
130
+ SCANCODE_HELP = 117
131
+ SCANCODE_MENU = 118
132
+ SCANCODE_SELECT = 119
133
+ SCANCODE_STOP = 120
134
+ SCANCODE_AGAIN = 121
135
+ SCANCODE_UNDO = 122
136
+ SCANCODE_CUT = 123
137
+ SCANCODE_COPY = 124
138
+ SCANCODE_PASTE = 125
139
+ SCANCODE_FIND = 126
140
+ SCANCODE_MUTE = 127
141
+ SCANCODE_VOLUMEUP = 128
142
+ SCANCODE_VOLUMEDOWN = 129
143
+ SCANCODE_KP_COMMA = 133
144
+ SCANCODE_KP_EQUALSAS400 = 134
145
+ SCANCODE_INTERNATIONAL1 = 135
146
+ SCANCODE_INTERNATIONAL2 = 136
147
+ SCANCODE_INTERNATIONAL3 = 137
148
+ SCANCODE_INTERNATIONAL4 = 138
149
+ SCANCODE_INTERNATIONAL5 = 139
150
+ SCANCODE_INTERNATIONAL6 = 140
151
+ SCANCODE_INTERNATIONAL7 = 141
152
+ SCANCODE_INTERNATIONAL8 = 142
153
+ SCANCODE_INTERNATIONAL9 = 143
154
+ SCANCODE_LANG1 = 144
155
+ SCANCODE_LANG2 = 145
156
+ SCANCODE_LANG3 = 146
157
+ SCANCODE_LANG4 = 147
158
+ SCANCODE_LANG5 = 148
159
+ SCANCODE_LANG6 = 149
160
+ SCANCODE_LANG7 = 150
161
+ SCANCODE_LANG8 = 151
162
+ SCANCODE_LANG9 = 152
163
+ SCANCODE_ALTERASE = 153
164
+ SCANCODE_SYSREQ = 154
165
+ SCANCODE_CANCEL = 155
166
+ SCANCODE_CLEAR = 156
167
+ SCANCODE_PRIOR = 157
168
+ SCANCODE_RETURN2 = 158
169
+ SCANCODE_SEPARATOR = 159
170
+ SCANCODE_OUT = 160
171
+ SCANCODE_OPER = 161
172
+ SCANCODE_CLEARAGAIN = 162
173
+ SCANCODE_CRSEL = 163
174
+ SCANCODE_EXSEL = 164
175
+ SCANCODE_KP_00 = 176
176
+ SCANCODE_KP_000 = 177
177
+ SCANCODE_THOUSANDSSEPARATOR = 178
178
+ SCANCODE_DECIMALSEPARATOR = 179
179
+ SCANCODE_CURRENCYUNIT = 180
180
+ SCANCODE_CURRENCYSUBUNIT = 181
181
+ SCANCODE_KP_LEFTPAREN = 182
182
+ SCANCODE_KP_RIGHTPAREN = 183
183
+ SCANCODE_KP_LEFTBRACE = 184
184
+ SCANCODE_KP_RIGHTBRACE = 185
185
+ SCANCODE_KP_TAB = 186
186
+ SCANCODE_KP_BACKSPACE = 187
187
+ SCANCODE_KP_A = 188
188
+ SCANCODE_KP_B = 189
189
+ SCANCODE_KP_C = 190
190
+ SCANCODE_KP_D = 191
191
+ SCANCODE_KP_E = 192
192
+ SCANCODE_KP_F = 193
193
+ SCANCODE_KP_XOR = 194
194
+ SCANCODE_KP_POWER = 195
195
+ SCANCODE_KP_PERCENT = 196
196
+ SCANCODE_KP_LESS = 197
197
+ SCANCODE_KP_GREATER = 198
198
+ SCANCODE_KP_AMPERSAND = 199
199
+ SCANCODE_KP_DBLAMPERSAND = 200
200
+ SCANCODE_KP_VERTICALBAR = 201
201
+ SCANCODE_KP_DBLVERTICALBAR = 202
202
+ SCANCODE_KP_COLON = 203
203
+ SCANCODE_KP_HASH = 204
204
+ SCANCODE_KP_SPACE = 205
205
+ SCANCODE_KP_AT = 206
206
+ SCANCODE_KP_EXCLAM = 207
207
+ SCANCODE_KP_MEMSTORE = 208
208
+ SCANCODE_KP_MEMRECALL = 209
209
+ SCANCODE_KP_MEMCLEAR = 210
210
+ SCANCODE_KP_MEMADD = 211
211
+ SCANCODE_KP_MEMSUBTRACT = 212
212
+ SCANCODE_KP_MEMMULTIPLY = 213
213
+ SCANCODE_KP_MEMDIVIDE = 214
214
+ SCANCODE_KP_PLUSMINUS = 215
215
+ SCANCODE_KP_CLEAR = 216
216
+ SCANCODE_KP_CLEARENTRY = 217
217
+ SCANCODE_KP_BINARY = 218
218
+ SCANCODE_KP_OCTAL = 219
219
+ SCANCODE_KP_DECIMAL = 220
220
+ SCANCODE_KP_HEXADECIMAL = 221
221
+ SCANCODE_LCTRL = 224
222
+ SCANCODE_LSHIFT = 225
223
+ SCANCODE_LALT = 226
224
+ SCANCODE_LGUI = 227
225
+ SCANCODE_RCTRL = 228
226
+ SCANCODE_RSHIFT = 229
227
+ SCANCODE_RALT = 230
228
+ SCANCODE_RGUI = 231
229
+ SCANCODE_MODE = 257
230
+ SCANCODE_AUDIONEXT = 258
231
+ SCANCODE_AUDIOPREV = 259
232
+ SCANCODE_AUDIOSTOP = 260
233
+ SCANCODE_AUDIOPLAY = 261
234
+ SCANCODE_AUDIOMUTE = 262
235
+ SCANCODE_MEDIASELECT = 263
236
+ SCANCODE_WWW = 264
237
+ SCANCODE_MAIL = 265
238
+ SCANCODE_CALCULATOR = 266
239
+ SCANCODE_COMPUTER = 267
240
+ SCANCODE_AC_SEARCH = 268
241
+ SCANCODE_AC_HOME = 269
242
+ SCANCODE_AC_BACK = 270
243
+ SCANCODE_AC_FORWARD = 271
244
+ SCANCODE_AC_STOP = 272
245
+ SCANCODE_AC_REFRESH = 273
246
+ SCANCODE_AC_BOOKMARKS = 274
247
+ SCANCODE_BRIGHTNESSDOWN = 275
248
+ SCANCODE_BRIGHTNESSUP = 276
249
+ SCANCODE_DISPLAYSWITCH = 277
250
+ SCANCODE_KBDILLUMTOGGLE = 278
251
+ SCANCODE_KBDILLUMDOWN = 279
252
+ SCANCODE_KBDILLUMUP = 280
253
+ SCANCODE_EJECT = 281
254
+ SCANCODE_SLEEP = 282
255
+ SCANCODE_APP1 = 283
256
+ SCANCODE_APP2 = 284
257
+ SCANCODE_AUDIOREWIND = 285
258
+ SCANCODE_AUDIOFASTFORWARD = 286
259
+ NUM_SCANCODES = 512
260
260
 
261
261
  # Typedef
262
262
 
@@ -267,18 +267,20 @@ module SDL2
267
267
 
268
268
  # Function
269
269
 
270
- def self.setup_scancode_symbols()
270
+ def self.setup_scancode_symbols(output_error = false)
271
271
  symbols = [
272
272
  ]
273
+ apis = {
274
+ }
273
275
  args = {
274
276
  }
275
277
  retvals = {
276
278
  }
277
279
  symbols.each do |sym|
278
280
  begin
279
- attach_function sym, args[sym], retvals[sym]
281
+ attach_function apis[sym], sym, args[sym], retvals[sym]
280
282
  rescue FFI::NotFoundError => error
281
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
283
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
282
284
  end
283
285
  end
284
286
  end
data/lib/sdl2_sensor.rb CHANGED
@@ -6,18 +6,18 @@
6
6
 
7
7
  require 'ffi'
8
8
 
9
- module SDL2
9
+ module SDL
10
10
  extend FFI::Library
11
11
  # Define/Macro
12
12
 
13
- SDL_STANDARD_GRAVITY = 9.80665
13
+ STANDARD_GRAVITY = 9.80665
14
14
 
15
15
  # Enum
16
16
 
17
- SDL_SENSOR_INVALID = -1
18
- SDL_SENSOR_UNKNOWN = 0
19
- SDL_SENSOR_ACCEL = 1
20
- SDL_SENSOR_GYRO = 2
17
+ SENSOR_INVALID = -1
18
+ SENSOR_UNKNOWN = 0
19
+ SENSOR_ACCEL = 1
20
+ SENSOR_GYRO = 2
21
21
 
22
22
  # Typedef
23
23
 
@@ -29,7 +29,7 @@ module SDL2
29
29
 
30
30
  # Function
31
31
 
32
- def self.setup_sensor_symbols()
32
+ def self.setup_sensor_symbols(output_error = false)
33
33
  symbols = [
34
34
  :SDL_LockSensors,
35
35
  :SDL_UnlockSensors,
@@ -48,6 +48,24 @@ module SDL2
48
48
  :SDL_SensorClose,
49
49
  :SDL_SensorUpdate,
50
50
  ]
51
+ apis = {
52
+ :SDL_LockSensors => :LockSensors,
53
+ :SDL_UnlockSensors => :UnlockSensors,
54
+ :SDL_NumSensors => :NumSensors,
55
+ :SDL_SensorGetDeviceName => :SensorGetDeviceName,
56
+ :SDL_SensorGetDeviceType => :SensorGetDeviceType,
57
+ :SDL_SensorGetDeviceNonPortableType => :SensorGetDeviceNonPortableType,
58
+ :SDL_SensorGetDeviceInstanceID => :SensorGetDeviceInstanceID,
59
+ :SDL_SensorOpen => :SensorOpen,
60
+ :SDL_SensorFromInstanceID => :SensorFromInstanceID,
61
+ :SDL_SensorGetName => :SensorGetName,
62
+ :SDL_SensorGetType => :SensorGetType,
63
+ :SDL_SensorGetNonPortableType => :SensorGetNonPortableType,
64
+ :SDL_SensorGetInstanceID => :SensorGetInstanceID,
65
+ :SDL_SensorGetData => :SensorGetData,
66
+ :SDL_SensorClose => :SensorClose,
67
+ :SDL_SensorUpdate => :SensorUpdate,
68
+ }
51
69
  args = {
52
70
  :SDL_LockSensors => [],
53
71
  :SDL_UnlockSensors => [],
@@ -86,9 +104,9 @@ module SDL2
86
104
  }
87
105
  symbols.each do |sym|
88
106
  begin
89
- attach_function sym, args[sym], retvals[sym]
107
+ attach_function apis[sym], sym, args[sym], retvals[sym]
90
108
  rescue FFI::NotFoundError => error
91
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
109
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
92
110
  end
93
111
  end
94
112
  end
data/lib/sdl2_shape.rb CHANGED
@@ -7,13 +7,13 @@
7
7
  require 'ffi'
8
8
  require_relative 'sdl2_pixels'
9
9
 
10
- module SDL2
10
+ module SDL
11
11
  extend FFI::Library
12
12
  # Define/Macro
13
13
 
14
- SDL_NONSHAPEABLE_WINDOW = -1
15
- SDL_INVALID_SHAPE_ARGUMENT = -2
16
- SDL_WINDOW_LACKS_SHAPE = -3
14
+ NONSHAPEABLE_WINDOW = -1
15
+ INVALID_SHAPE_ARGUMENT = -2
16
+ WINDOW_LACKS_SHAPE = -3
17
17
 
18
18
  # Enum
19
19
 
@@ -28,30 +28,36 @@ module SDL2
28
28
 
29
29
  # Struct
30
30
 
31
- class SDL_WindowShapeParams < FFI::Union
31
+ class WindowShapeParams < FFI::Union
32
32
  layout(
33
33
  :binarizationCutoff, :uchar,
34
- :colorKey, SDL_Color,
34
+ :colorKey, Color,
35
35
  )
36
36
  end
37
37
 
38
- class SDL_WindowShapeMode < FFI::Struct
38
+ class WindowShapeMode < FFI::Struct
39
39
  layout(
40
40
  :mode, :int,
41
- :parameters, SDL_WindowShapeParams,
41
+ :parameters, WindowShapeParams,
42
42
  )
43
43
  end
44
44
 
45
45
 
46
46
  # Function
47
47
 
48
- def self.setup_shape_symbols()
48
+ def self.setup_shape_symbols(output_error = false)
49
49
  symbols = [
50
50
  :SDL_CreateShapedWindow,
51
51
  :SDL_IsShapedWindow,
52
52
  :SDL_SetWindowShape,
53
53
  :SDL_GetShapedWindowMode,
54
54
  ]
55
+ apis = {
56
+ :SDL_CreateShapedWindow => :CreateShapedWindow,
57
+ :SDL_IsShapedWindow => :IsShapedWindow,
58
+ :SDL_SetWindowShape => :SetWindowShape,
59
+ :SDL_GetShapedWindowMode => :GetShapedWindowMode,
60
+ }
55
61
  args = {
56
62
  :SDL_CreateShapedWindow => [:pointer, :uint, :uint, :uint, :uint, :uint],
57
63
  :SDL_IsShapedWindow => [:pointer],
@@ -66,9 +72,9 @@ module SDL2
66
72
  }
67
73
  symbols.each do |sym|
68
74
  begin
69
- attach_function sym, args[sym], retvals[sym]
75
+ attach_function apis[sym], sym, args[sym], retvals[sym]
70
76
  rescue FFI::NotFoundError => error
71
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
77
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
72
78
  end
73
79
  end
74
80
  end