sdl2-win93 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.dir-locals.el +2 -0
  3. data/.github/workflows/gempush.yml +29 -0
  4. data/.gitignore +14 -0
  5. data/COPYING.txt +165 -0
  6. data/Gemfile +4 -0
  7. data/Gemfile.lock +24 -0
  8. data/Makefile +4 -0
  9. data/README.md +36 -0
  10. data/Rakefile +51 -0
  11. data/doc/po/ja.po +10357 -0
  12. data/ext/sdl2_ext/clipboard.c +61 -0
  13. data/ext/sdl2_ext/color.c +103 -0
  14. data/ext/sdl2_ext/color.h +4 -0
  15. data/ext/sdl2_ext/event.c +1298 -0
  16. data/ext/sdl2_ext/extconf.rb +22 -0
  17. data/ext/sdl2_ext/filesystem.c +63 -0
  18. data/ext/sdl2_ext/gamecontroller.c +408 -0
  19. data/ext/sdl2_ext/gamecontroller.c.m4 +408 -0
  20. data/ext/sdl2_ext/gl.c +351 -0
  21. data/ext/sdl2_ext/gl.c.m4 +351 -0
  22. data/ext/sdl2_ext/hint.c +99 -0
  23. data/ext/sdl2_ext/joystick.c +339 -0
  24. data/ext/sdl2_ext/joystick.c.m4 +339 -0
  25. data/ext/sdl2_ext/key.c +1302 -0
  26. data/ext/sdl2_ext/key.c.m4 +833 -0
  27. data/ext/sdl2_ext/main.c +258 -0
  28. data/ext/sdl2_ext/messagebox.c +233 -0
  29. data/ext/sdl2_ext/mixer.c +1205 -0
  30. data/ext/sdl2_ext/mixer.c.m4 +1205 -0
  31. data/ext/sdl2_ext/mouse.c +286 -0
  32. data/ext/sdl2_ext/rubysdl2_internal.h +127 -0
  33. data/ext/sdl2_ext/timer.c +63 -0
  34. data/ext/sdl2_ext/ttf.c +376 -0
  35. data/ext/sdl2_ext/ttf.c.m4 +376 -0
  36. data/ext/sdl2_ext/video.c +4093 -0
  37. data/ext/sdl2_ext/video.c.m4 +3867 -0
  38. data/lib/sdl2.rb +3 -0
  39. data/lib/sdl2/event.rb +55 -0
  40. data/lib/sdl2/version.rb +8 -0
  41. data/sample/chunk_destroy.rb +16 -0
  42. data/sample/gfxprimitives.rb +54 -0
  43. data/sample/icon.bmp +0 -0
  44. data/sample/memory_test/m1.rb +28 -0
  45. data/sample/memory_test/m2.rb +18 -0
  46. data/sample/memory_test/m3.rb +12 -0
  47. data/sample/message_box.rb +33 -0
  48. data/sample/music_player.rb +137 -0
  49. data/sample/playwave.rb +19 -0
  50. data/sample/primitives.rb +32 -0
  51. data/sample/test_clipboard.rb +16 -0
  52. data/sample/test_controller.rb +62 -0
  53. data/sample/test_joystick.rb +53 -0
  54. data/sample/test_keyboard.rb +52 -0
  55. data/sample/test_mouse.rb +50 -0
  56. data/sample/test_surface.rb +13 -0
  57. data/sample/test_ttf.rb +82 -0
  58. data/sample/test_video.rb +59 -0
  59. data/sample/testgl.rb +175 -0
  60. data/sample/testsprite.rb +296 -0
  61. data/sample/testspriteminimal.rb +75 -0
  62. data/sample/timer.rb +11 -0
  63. data/sample/version.rb +12 -0
  64. data/sample/video_info.rb +64 -0
  65. data/sdl2-win93.gemspec +31 -0
  66. metadata +158 -0
@@ -0,0 +1,22 @@
1
+ require 'mkmf'
2
+
3
+ pkg_config "sdl2"
4
+ pkg_config "SDL2_mixer"
5
+ pkg_config "SDL2_ttf"
6
+ pkg_config "SDL2_image"
7
+ pkg_config "SDL2_gfx"
8
+
9
+ have_header "SDL_image.h"
10
+ have_header "SDL_mixer.h"
11
+ have_header "SDL_ttf.h"
12
+ have_header("SDL_filesystem.h")
13
+ have_header "SDL2_gfxPrimitives.h"
14
+
15
+ have_const("MIX_INIT_MODPLUG", "SDL_mixer.h")
16
+ have_const("MIX_INIT_FLUIDSYNTH", "SDL_mixer.h")
17
+ have_const("MIX_INIT_MID", "SDL_mixer.h")
18
+ have_const("SDL_RENDERER_PRESENTVSYNC", "SDL_render.h")
19
+ have_const("SDL_WINDOW_ALLOW_HIGHDPI", "SDL_video.h")
20
+ have_const("SDL_WINDOW_MOUSE_CAPTURE", "SDL_video.h")
21
+
22
+ create_makefile('sdl2_ext')
@@ -0,0 +1,63 @@
1
+ #ifdef HAVE_SDL_FILESYSTEM_H
2
+ #include "rubysdl2_internal.h"
3
+ #include <SDL_filesystem.h>
4
+
5
+ /*
6
+ * Get the directory where the application was run from.
7
+ *
8
+ * In almost all cases, using this method, you will get the directory where ruby executable is in.
9
+ * Probably what you hope is $0 or __FILE__.
10
+ *
11
+ * @return [String] an absolute path in UTF-8 encoding to the application data directory
12
+ * @raise [SDL2::Error] raised if your platform doesn't implement this functionality.
13
+ * @note This method is available since SDL 2.0.1.
14
+ */
15
+ static VALUE SDL2_s_base_path(VALUE self)
16
+ {
17
+ char* path = SDL_GetBasePath();
18
+ VALUE str;
19
+ if (!path)
20
+ SDL_ERROR();
21
+ str = utf8str_new_cstr(path);
22
+ SDL_free(path);
23
+ return str;
24
+ }
25
+
26
+ /*
27
+ * @overload preference_path(org, app)
28
+ * Get the "pref dir". You can use the directory to write personal files such as
29
+ * preferences and save games.
30
+ *
31
+ * The directory is unique per user and per application.
32
+ *
33
+ * @param org [String] the name of your organization
34
+ * @param app [String] the name of your application
35
+ * @return [String] a UTF-8 string of the user directory in platform-depnedent notation.
36
+ *
37
+ * @raise [SDL2::Error] raised if your platform doesn't implement this functionality.
38
+ * @note This method is available since SDL 2.0.1.
39
+ *
40
+ * @example
41
+ * SDL2.preference_path("foo", "bar") # => "/home/ohai/.local/share/foo/bar/" (on Linux)
42
+ */
43
+ static VALUE SDL2_s_preference_path(VALUE self, VALUE org, VALUE app)
44
+ {
45
+ char* path = SDL_GetPrefPath(StringValueCStr(org), StringValueCStr(app));
46
+ VALUE str;
47
+ if (!path)
48
+ SDL_ERROR();
49
+ str = utf8str_new_cstr(path);
50
+ SDL_free(path);
51
+ return str;
52
+ }
53
+
54
+ void rubysdl2_init_filesystem(void)
55
+ {
56
+ rb_define_module_function(mSDL2, "base_path", SDL2_s_base_path, 0);
57
+ rb_define_module_function(mSDL2, "preference_path", SDL2_s_preference_path, 2);
58
+ }
59
+ #else
60
+ void rubysdl2_init_filesystem(void)
61
+ {
62
+ }
63
+ #endif
@@ -0,0 +1,408 @@
1
+ /* -*- mode: C -*- */
2
+ #include "rubysdl2_internal.h"
3
+ #include <SDL_gamecontroller.h>
4
+
5
+ static VALUE cGameController;
6
+ static VALUE mAxis;
7
+ static VALUE mButton;
8
+
9
+ typedef struct GameController {
10
+ SDL_GameController* controller;
11
+ } GameController;
12
+
13
+ static void GameController_free(GameController* g)
14
+ {
15
+ if (rubysdl2_is_active() && g->controller)
16
+ SDL_GameControllerClose(g->controller);
17
+ free(g);
18
+ }
19
+
20
+ /*
21
+ * Document-class: SDL2::GameController
22
+ *
23
+ * This class represents a "Game Controller".
24
+ *
25
+ * In SDL2, there is a gamecontroller framework to
26
+ * hide the details of joystick types. This framework
27
+ * is built on the existing joystick API.
28
+ *
29
+ * The framework consists of two parts:
30
+ *
31
+ * * Mapping joysticks to game controllers
32
+ * * Aquire input from game controllers
33
+ *
34
+ * Mapping information is a string, and described as:
35
+ *
36
+ * GUID,name,mapping
37
+ *
38
+ * GUID is a unique ID of a type of joystick and
39
+ * given by {Joystick#GUID}. name is the human readable
40
+ * string for the device, and mappings are contorller mappings
41
+ * to joystick ones.
42
+ *
43
+ * This mappings abstract the details of joysticks, for exmaple,
44
+ * the number of buttons, the number of axes, and the position
45
+ * of these buttons a on pad.
46
+ * You can use unified interface
47
+ * with this framework theoretically.
48
+ * Howerver, we need to prepare the
49
+ * database of many joysticks that users will use. A database
50
+ * is available at https://github.com/gabomdq/SDL_GameControllerDB,
51
+ * but perhaps this is not sufficient for your usage.
52
+ * In fact, Steam prepares its own database for Steam games,
53
+ * so if you will create a game for Steam, this framework is
54
+ * useful. Otherwise, it is a better way to use joystick API
55
+ * directly.
56
+ *
57
+ * @!method destroy?
58
+ * Return true if the gamecontroller is already closed.
59
+ */
60
+
61
+ static VALUE GameController_new(SDL_GameController* controller)
62
+ {
63
+ GameController* g = ALLOC(GameController);
64
+ g->controller = controller;
65
+ return Data_Wrap_Struct(cGameController, 0, GameController_free, g);
66
+ }
67
+
68
+ DEFINE_WRAPPER(SDL_GameController, GameController, controller, cGameController,
69
+ "SDL2::GameController");
70
+
71
+
72
+ /*
73
+ * @overload add_mapping(string)
74
+ *
75
+ * Add suuport for controolers that SDL is unaware of or to cause an
76
+ * existing controller to have a different binding.
77
+ *
78
+ * "GUID,name,mapping", where GUID is
79
+ * the string value from SDL_JoystickGetGUIDString(), name is the human
80
+ * readable string for the device and mappings are controller mappings to
81
+ * joystick ones. Under Windows there is a reserved GUID of "xinput" that
82
+ * covers all XInput devices. The mapping format for joystick is:
83
+ *
84
+ * * bX: a joystick button, index X
85
+ * * hX.Y: hat X with value Y
86
+ * * aX: axis X of the joystick
87
+ *
88
+ * Buttons can be used as a controller axes and vice versa.
89
+ *
90
+ * This string shows an example of a valid mapping for a controller:
91
+ * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"
92
+ *
93
+ * @param string [String] mapping string
94
+ * @return [Integer] 1 if a new mapping, 0 if an existing mapping is updated.
95
+ */
96
+ static VALUE GameController_s_add_mapping(VALUE self, VALUE string)
97
+ {
98
+ int ret = HANDLE_ERROR(SDL_GameControllerAddMapping(StringValueCStr(string)));
99
+ return INT2NUM(ret);
100
+ }
101
+
102
+ /*
103
+ * @overload axis_name_of(axis)
104
+ *
105
+ * Get a string representing **axis**.
106
+ *
107
+ * @param axis [Integer] axis constant in {Axis}
108
+ * @return [String]
109
+ */
110
+ static VALUE GameController_s_axis_name_of(VALUE self, VALUE axis)
111
+ {
112
+ const char* name = SDL_GameControllerGetStringForAxis(NUM2INT(axis));
113
+ if (!name) {
114
+ SDL_SetError("Unknown axis %d", NUM2INT(axis));
115
+ SDL_ERROR();
116
+ }
117
+ return utf8str_new_cstr(name);
118
+ }
119
+
120
+ /*
121
+ * @overload button_name_of(button)
122
+ *
123
+ * Get a string representing **button**.
124
+ *
125
+ * @param button [Integer] button constant in {Button}
126
+ * @return [String]
127
+ */
128
+ static VALUE GameController_s_button_name_of(VALUE self, VALUE button)
129
+ {
130
+ const char* name = SDL_GameControllerGetStringForButton(NUM2INT(button));
131
+ if (!name) {
132
+ SDL_SetError("Unknown axis %d", NUM2INT(button));
133
+ SDL_ERROR();
134
+ }
135
+ return utf8str_new_cstr(name);
136
+ }
137
+
138
+ /*
139
+ * @overload axis_from_name(name)
140
+ *
141
+ * Get a integer representation of the axis
142
+ * whose string representation is **name**.
143
+ *
144
+ * The return value is the value of one of the constants in {Axis}
145
+ *
146
+ * @param name [String] a string representing an axis
147
+ * @return [Integer]
148
+ */
149
+ static VALUE GameController_s_axis_from_name(VALUE self, VALUE name)
150
+ {
151
+ int axis = SDL_GameControllerGetAxisFromString(StringValueCStr(name));
152
+ if (axis < 0) {
153
+ SDL_SetError("Unknown axis name \"%s\"", StringValueCStr(name));
154
+ SDL_ERROR();
155
+ }
156
+ return INT2FIX(axis);
157
+ }
158
+
159
+ /*
160
+ * @overload button_from_name(name)
161
+ *
162
+ * Get a integer representation of the button
163
+ * whose string representation is **name**.
164
+ *
165
+ * The return value is the value of one of the constants in {Button}
166
+ *
167
+ * @param name [String] a string representing a button
168
+ * @return [Integer]
169
+ */
170
+ static VALUE GameController_s_button_from_name(VALUE self, VALUE name)
171
+ {
172
+ int button = SDL_GameControllerGetButtonFromString(StringValueCStr(name));
173
+ if (button < 0) {
174
+ SDL_SetError("Unknown button name \"%s\"", StringValueCStr(name));
175
+ SDL_ERROR();
176
+ }
177
+ return INT2FIX(button);
178
+ }
179
+
180
+ /*
181
+ * Get the implementation dependent name for the game controllers
182
+ * connected to the machine.
183
+ *
184
+ * The number of elements of returning array is same as
185
+ * {Joystick.num_connected_joysticks}.
186
+ *
187
+ * @return [Array<String,nil>]
188
+ */
189
+ static VALUE GameController_s_device_names(VALUE self)
190
+ {
191
+ int num_joysticks = SDL_NumJoysticks();
192
+ int i;
193
+ VALUE device_names = rb_ary_new2(num_joysticks);
194
+ for (i=0; i<num_joysticks; ++i) {
195
+ const char* name = SDL_GameControllerNameForIndex(i);
196
+ if (name)
197
+ rb_ary_push(device_names, utf8str_new_cstr(name));
198
+ else
199
+ rb_ary_push(device_names, Qnil);
200
+ }
201
+ return device_names;
202
+ }
203
+
204
+ /*
205
+ * @overload mapping_for(guid_string)
206
+ * Get the game controller mapping string for a given GUID.
207
+ *
208
+ * @param guid_string [String] GUID string
209
+ *
210
+ * @return [String]
211
+ */
212
+ static VALUE GameController_s_mapping_for(VALUE self, VALUE guid_string)
213
+ {
214
+ SDL_JoystickGUID guid = SDL_JoystickGetGUIDFromString(StringValueCStr(guid_string));
215
+ return utf8str_new_cstr(SDL_GameControllerMappingForGUID(guid));
216
+ }
217
+
218
+ /*
219
+ * @overload open(index)
220
+ * Open a game controller and return the opened GameController object.
221
+ *
222
+ * @param index [Integer] device index, up to the return value of {Joystick.num_connected_joysticks}.
223
+ * @return [SDL2::GameController]
224
+ *
225
+ * @raise [SDL2::Error] raised when device open is failed.
226
+ * For exmaple, **index** is out of range.
227
+ */
228
+ static VALUE GameController_s_open(VALUE self, VALUE index)
229
+ {
230
+ SDL_GameController* controller = SDL_GameControllerOpen(NUM2INT(index));
231
+ if (!controller)
232
+ SDL_ERROR();
233
+ return GameController_new(controller);
234
+ }
235
+
236
+ /*
237
+ * Get the name of an opened game controller.
238
+ *
239
+ * @return [String]
240
+ */
241
+ static VALUE GameController_name(VALUE self)
242
+ {
243
+ const char* name = SDL_GameControllerName(Get_SDL_GameController(self));
244
+ if (!name)
245
+ SDL_ERROR();
246
+
247
+ return utf8str_new_cstr(name);
248
+ }
249
+
250
+ /*
251
+ * Return true if **self** is opened and attached.
252
+ */
253
+ static VALUE GameController_attached_p(VALUE self)
254
+ {
255
+ return INT2BOOL(SDL_GameControllerGetAttached(Get_SDL_GameController(self)));
256
+ }
257
+
258
+ /*
259
+ * Close the game controller.
260
+ *
261
+ * @return nil
262
+ */
263
+ static VALUE GameController_destroy(VALUE self)
264
+ {
265
+ GameController* g = Get_GameController(self);
266
+ if (g->controller)
267
+ SDL_GameControllerClose(g->controller);
268
+ g->controller = NULL;
269
+ return Qnil;
270
+ }
271
+
272
+ /*
273
+ * Get the mapping string of **self**.
274
+ *
275
+ * @return [String]
276
+ * @see .add_mapping
277
+ * @see .mapping_for
278
+ */
279
+ static VALUE GameController_mapping(VALUE self)
280
+ {
281
+ return utf8str_new_cstr(SDL_GameControllerMapping(Get_SDL_GameController(self)));
282
+ }
283
+
284
+ /*
285
+ * @overload axis(axis)
286
+ * Get the state of an axis control.
287
+ *
288
+ * The state is an integer from -32768 to 32767.
289
+ * The state of trigger never returns negative value (from 0 to 32767).
290
+ *
291
+ * @param axis [Integer] the index of an axis, one of the constants in {Axis}
292
+ * @return [Integer]
293
+ */
294
+ static VALUE GameController_axis(VALUE self, VALUE axis)
295
+ {
296
+ return INT2FIX(SDL_GameControllerGetAxis(Get_SDL_GameController(self),
297
+ NUM2INT(axis)));
298
+ }
299
+
300
+ /*
301
+ * @overload button_pressed?(button)
302
+ * Return true if a button is pressed.
303
+ *
304
+ * @param button [Integer] the index of a button, one of the constants in {Button}
305
+ */
306
+ static VALUE GameController_button_pressed_p(VALUE self, VALUE button)
307
+ {
308
+ return INT2BOOL(SDL_GameControllerGetButton(Get_SDL_GameController(self),
309
+ NUM2INT(button)));
310
+ }
311
+
312
+ /*
313
+ * Document-module: SDL2::GameController::Axis
314
+ *
315
+ * This module provides constants of gamecontroller's axis indices used by
316
+ * {SDL2::GameController} class.
317
+ */
318
+
319
+ /*
320
+ * Document-module: SDL2::GameController::Button
321
+ *
322
+ * This module provides constants of gamecontroller's button indices used by
323
+ * {SDL2::GameController} class.
324
+ */
325
+ void rubysdl2_init_gamecontorller(void)
326
+ {
327
+ cGameController = rb_define_class_under(mSDL2, "GameController", rb_cObject);
328
+
329
+ rb_define_singleton_method(cGameController, "add_mapping",
330
+ GameController_s_add_mapping, 1);
331
+ rb_define_singleton_method(cGameController, "device_names",
332
+ GameController_s_device_names, 0);
333
+ rb_define_singleton_method(cGameController, "axis_name_of",
334
+ GameController_s_axis_name_of, 1);
335
+ rb_define_singleton_method(cGameController, "button_name_of",
336
+ GameController_s_button_name_of, 1);
337
+ rb_define_singleton_method(cGameController, "mapping_for",
338
+ GameController_s_mapping_for, 1);
339
+ rb_define_singleton_method(cGameController, "button_from_name",
340
+ GameController_s_button_from_name, 1);
341
+ rb_define_singleton_method(cGameController, "axis_from_name",
342
+ GameController_s_axis_from_name, 1);
343
+ rb_define_singleton_method(cGameController, "open", GameController_s_open, 1);
344
+ rb_define_method(cGameController, "destroy?", GameController_destroy_p, 0);
345
+ rb_define_method(cGameController, "destroy", GameController_destroy, 0);
346
+ rb_define_method(cGameController, "name", GameController_name, 0);
347
+ rb_define_method(cGameController, "attached?", GameController_attached_p, 0);
348
+ rb_define_method(cGameController, "mapping", GameController_mapping, 0);
349
+ rb_define_method(cGameController, "axis", GameController_axis, 1);
350
+ rb_define_method(cGameController, "button_pressed?", GameController_button_pressed_p, 1);
351
+
352
+ mAxis = rb_define_module_under(cGameController, "Axis");
353
+ mButton = rb_define_module_under(cGameController, "Button");
354
+
355
+ /* */
356
+ /* Invalid axis index */
357
+ rb_define_const(mAxis, "INVALID", INT2NUM(SDL_CONTROLLER_AXIS_INVALID));
358
+ /* Left X axis */
359
+ rb_define_const(mAxis, "LEFTX", INT2NUM(SDL_CONTROLLER_AXIS_LEFTX));
360
+ /* Left Y axis */
361
+ rb_define_const(mAxis, "LEFTY", INT2NUM(SDL_CONTROLLER_AXIS_LEFTY));
362
+ /* Right X axis */
363
+ rb_define_const(mAxis, "RIGHTX", INT2NUM(SDL_CONTROLLER_AXIS_RIGHTX));
364
+ /* Right Y axis */
365
+ rb_define_const(mAxis, "RIGHTY", INT2NUM(SDL_CONTROLLER_AXIS_RIGHTY));
366
+ /* Left trigger axis */
367
+ rb_define_const(mAxis, "TRIGGERLEFT", INT2NUM(SDL_CONTROLLER_AXIS_TRIGGERLEFT));
368
+ /* Right trigger axis */
369
+ rb_define_const(mAxis, "TRIGGERRIGHT", INT2NUM(SDL_CONTROLLER_AXIS_TRIGGERRIGHT));
370
+ /* The max of an axis index */
371
+ rb_define_const(mAxis, "MAX", INT2NUM(SDL_CONTROLLER_AXIS_MAX));
372
+
373
+ /* */
374
+ /* Invalid button index */
375
+ rb_define_const(mButton, "INVALID", INT2NUM(SDL_CONTROLLER_BUTTON_INVALID));
376
+ /* Button A */
377
+ rb_define_const(mButton, "A", INT2NUM(SDL_CONTROLLER_BUTTON_A));
378
+ /* Button B */
379
+ rb_define_const(mButton, "B", INT2NUM(SDL_CONTROLLER_BUTTON_B));
380
+ /* Button X */
381
+ rb_define_const(mButton, "X", INT2NUM(SDL_CONTROLLER_BUTTON_X));
382
+ /* Button Y */
383
+ rb_define_const(mButton, "Y", INT2NUM(SDL_CONTROLLER_BUTTON_Y));
384
+ /* Back Button */
385
+ rb_define_const(mButton, "BACK", INT2NUM(SDL_CONTROLLER_BUTTON_BACK));
386
+ /* Guide Button */
387
+ rb_define_const(mButton, "GUIDE", INT2NUM(SDL_CONTROLLER_BUTTON_GUIDE));
388
+ /* Start Button */
389
+ rb_define_const(mButton, "START", INT2NUM(SDL_CONTROLLER_BUTTON_START));
390
+ /* Left stick Button */
391
+ rb_define_const(mButton, "LEFTSTICK", INT2NUM(SDL_CONTROLLER_BUTTON_LEFTSTICK));
392
+ /* Right stick Button */
393
+ rb_define_const(mButton, "RIGHTSTICK", INT2NUM(SDL_CONTROLLER_BUTTON_RIGHTSTICK));
394
+ /* Left shoulder Button */
395
+ rb_define_const(mButton, "LEFTSHOULDER", INT2NUM(SDL_CONTROLLER_BUTTON_LEFTSHOULDER));
396
+ /* Right shoulder Button */
397
+ rb_define_const(mButton, "RIGHTSHOULDER", INT2NUM(SDL_CONTROLLER_BUTTON_RIGHTSHOULDER));
398
+ /* D-pad UP Button */
399
+ rb_define_const(mButton, "DPAD_UP", INT2NUM(SDL_CONTROLLER_BUTTON_DPAD_UP));
400
+ /* D-pad DOWN Button */
401
+ rb_define_const(mButton, "DPAD_DOWN", INT2NUM(SDL_CONTROLLER_BUTTON_DPAD_DOWN));
402
+ /* D-pad LEFT Button */
403
+ rb_define_const(mButton, "DPAD_LEFT", INT2NUM(SDL_CONTROLLER_BUTTON_DPAD_LEFT));
404
+ /* D-pad RIGHT Button */
405
+ rb_define_const(mButton, "DPAD_RIGHT", INT2NUM(SDL_CONTROLLER_BUTTON_DPAD_RIGHT));
406
+ /* The max of a button index */
407
+ rb_define_const(mButton, "MAX", INT2NUM(SDL_CONTROLLER_BUTTON_MAX));
408
+ }