rgss 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.clang-format +6 -0
  3. data/.gitignore +167 -0
  4. data/.yardopts +6 -0
  5. data/CHANGELOG.md +4 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/Rakefile +9 -0
  9. data/ext/rgss/cglm-v0.7.9.tar.gz +0 -0
  10. data/ext/rgss/color.c +599 -0
  11. data/ext/rgss/entity.c +373 -0
  12. data/ext/rgss/extconf.rb +53 -0
  13. data/ext/rgss/font.c +135 -0
  14. data/ext/rgss/game.c +469 -0
  15. data/ext/rgss/game.h +99 -0
  16. data/ext/rgss/gl.c +3217 -0
  17. data/ext/rgss/glad.c +1140 -0
  18. data/ext/rgss/glad.h +2129 -0
  19. data/ext/rgss/glfw.c +1453 -0
  20. data/ext/rgss/graphics.c +324 -0
  21. data/ext/rgss/image.c +274 -0
  22. data/ext/rgss/input.c +745 -0
  23. data/ext/rgss/khrplatform.h +290 -0
  24. data/ext/rgss/mat4.c +279 -0
  25. data/ext/rgss/pax_global_header +1 -0
  26. data/ext/rgss/point.c +253 -0
  27. data/ext/rgss/rect.c +449 -0
  28. data/ext/rgss/rgss.c +56 -0
  29. data/ext/rgss/rgss.h +241 -0
  30. data/ext/rgss/stb_image.h +7762 -0
  31. data/ext/rgss/stb_image_write.h +1690 -0
  32. data/ext/rgss/stb_rect_pack.h +628 -0
  33. data/ext/rgss/stb_truetype.h +5011 -0
  34. data/ext/rgss/utf8.h +1652 -0
  35. data/ext/rgss/uthash.h +1133 -0
  36. data/ext/rgss/vec.c +114 -0
  37. data/ext/rgss/vec.h +192 -0
  38. data/ext/rgss/vec2.c +489 -0
  39. data/ext/rgss/vec3.c +751 -0
  40. data/ext/rgss/vec4.c +681 -0
  41. data/lib/rgss.rb +140 -0
  42. data/lib/rgss/batch.rb +57 -0
  43. data/lib/rgss/blend.rb +47 -0
  44. data/lib/rgss/game_object.rb +28 -0
  45. data/lib/rgss/plane.rb +95 -0
  46. data/lib/rgss/renderable.rb +158 -0
  47. data/lib/rgss/rgss.so +0 -0
  48. data/lib/rgss/shader.rb +94 -0
  49. data/lib/rgss/shaders/sprite-frag.glsl +40 -0
  50. data/lib/rgss/shaders/sprite-vert.glsl +17 -0
  51. data/lib/rgss/sprite.rb +139 -0
  52. data/lib/rgss/stubs/color.rb +318 -0
  53. data/lib/rgss/stubs/gl.rb +1999 -0
  54. data/lib/rgss/stubs/glfw.rb +626 -0
  55. data/lib/rgss/stubs/rect.rb +324 -0
  56. data/lib/rgss/stubs/rpg.rb +267 -0
  57. data/lib/rgss/stubs/tone.rb +65 -0
  58. data/lib/rgss/texture.rb +132 -0
  59. data/lib/rgss/tilemap.rb +116 -0
  60. data/lib/rgss/version.rb +3 -0
  61. data/lib/rgss/viewport.rb +67 -0
  62. data/rgss.gemspec +44 -0
  63. data/test.png +0 -0
  64. metadata +178 -0
@@ -0,0 +1,1453 @@
1
+ #include "rgss.h"
2
+ #include "uthash.h"
3
+ #include <GLFW/glfw3.h>
4
+
5
+ VALUE rb_mGLFW;
6
+ VALUE rb_cWindow;
7
+ VALUE rb_cMonitor;
8
+ VALUE rb_cCursor;
9
+
10
+ VALUE rb_cVideoMode;
11
+ VALUE rb_cGammaRamp;
12
+ VALUE rb_cGamepadState;
13
+
14
+ typedef struct
15
+ {
16
+ GLFWwindow *pointer;
17
+ VALUE value;
18
+ UT_hash_handle hh;
19
+ } RGSS_HANDLE;
20
+
21
+ RGSS_HANDLE *handles;
22
+
23
+ static VALUE rb_glfwCreateCursor(VALUE glfw, VALUE image, VALUE x, VALUE y)
24
+ {
25
+ GLFWimage *img = RTEST(image) ? DATA_PTR(image) : NULL;
26
+ GLFWcursor *cursor = glfwCreateCursor(img, NUM2INT(x), NUM2INT(y));
27
+ return cursor ? Data_Wrap_Struct(rb_cCursor, NULL, RUBY_NEVER_FREE, cursor) : Qnil;
28
+ }
29
+
30
+ static VALUE rb_glfwCreateStandardCursor(VALUE glfw, VALUE shape)
31
+ {
32
+ GLFWcursor *cursor = glfwCreateStandardCursor(NUM2INT(shape));
33
+ return cursor ? Data_Wrap_Struct(rb_cCursor, NULL, RUBY_NEVER_FREE, cursor) : Qnil;
34
+ }
35
+
36
+ static VALUE rb_glfwCreateWindow(int argc, VALUE *argv, VALUE glfw)
37
+ {
38
+ VALUE width, height, title, monitor, share;
39
+ rb_scan_args(argc, argv, "23", &width, &height, &title, &monitor, &share);
40
+
41
+ const char *str = RTEST(title) ? StringValueCStr(title) : "";
42
+ GLFWmonitor *m = RTEST(monitor) ? DATA_PTR(monitor) : NULL;
43
+ GLFWwindow *s = RTEST(share) ? DATA_PTR(share) : NULL;
44
+
45
+ GLFWwindow *window = glfwCreateWindow(NUM2INT(width), NUM2INT(height), str, m, s);
46
+ if (window == NULL)
47
+ return Qnil;
48
+
49
+ RGSS_HANDLE *handle = xmalloc(sizeof(RGSS_HANDLE));
50
+ handle->pointer = window;
51
+ handle->value = Data_Wrap_Struct(rb_cWindow, NULL, RUBY_NEVER_FREE, window);
52
+
53
+ HASH_ADD(hh, handles, pointer, sizeof(GLFWwindow *), handle);
54
+ return handle->value;
55
+ }
56
+
57
+ static VALUE rb_glfwDefaultWindowHints(VALUE glfw)
58
+ {
59
+ glfwDefaultWindowHints();
60
+ return Qnil;
61
+ }
62
+
63
+ static VALUE rb_glfwDestroyCursor(VALUE glfw, VALUE cursor)
64
+ {
65
+ if (RTEST(cursor))
66
+ glfwDestroyCursor(DATA_PTR(cursor));
67
+ return Qnil;
68
+ }
69
+
70
+ static VALUE rb_glfwDestroyWindow(VALUE glfw, VALUE window)
71
+ {
72
+ if (RTEST(window))
73
+ glfwDestroyWindow(DATA_PTR(window));
74
+ return Qnil;
75
+ }
76
+
77
+ static VALUE rb_glfwExtensionSupported(VALUE glfw, VALUE extension)
78
+ {
79
+ if (RTEST(extension))
80
+ return RB_BOOL(glfwExtensionSupported(StringValueCStr(extension)));
81
+ return Qfalse;
82
+ }
83
+
84
+ static VALUE rb_glfwFocusWindow(VALUE glfw, VALUE window)
85
+ {
86
+ glfwFocusWindow(DATA_PTR(window));
87
+ return Qnil;
88
+ }
89
+
90
+ static VALUE rb_glfwGetClipboardString(VALUE glfw)
91
+ {
92
+ const char *text = glfwGetClipboardString(NULL);
93
+ return text ? rb_str_new_cstr(text) : Qnil;
94
+ }
95
+
96
+ static VALUE rb_glfwGetCurrentContext(VALUE glfw)
97
+ {
98
+ GLFWwindow *window = glfwGetCurrentContext();
99
+ if (window == NULL)
100
+ return Qnil;
101
+
102
+ RGSS_HANDLE *handle;
103
+ HASH_FIND(hh, handles, &window, sizeof(GLFWwindow *), handle);
104
+
105
+ if (handle)
106
+ return handle->value;
107
+
108
+ handle = xmalloc(sizeof(RGSS_HANDLE));
109
+ handle->pointer = window;
110
+ handle->value = Data_Wrap_Struct(rb_cWindow, NULL, RUBY_NEVER_FREE, window);
111
+
112
+ HASH_ADD(hh, handles, pointer, sizeof(GLFWwindow *), handle);
113
+ return handle->value;
114
+ }
115
+
116
+ static VALUE rb_glfwGetCursorPos(VALUE glfw, VALUE window)
117
+ {
118
+ double x, y;
119
+ glfwGetCursorPos(DATA_PTR(window), &x, &y);
120
+ return RGSS_Point_New((int)round(x), (int)round(y));
121
+ }
122
+
123
+ static VALUE rb_glfwGetError(VALUE glfw)
124
+ {
125
+ const char *message;
126
+ int code = glfwGetError(&message);
127
+
128
+ VALUE str = message ? rb_str_new_cstr(message) : Qnil;
129
+ return rb_ary_new_from_args(2, INT2NUM(code), str);
130
+ }
131
+
132
+ static VALUE rb_glfwGetFramebufferSize(VALUE glfw, VALUE window)
133
+ {
134
+ int x, y;
135
+ glfwGetFramebufferSize(DATA_PTR(window), &x, &y);
136
+ return RGSS_Size_New(x, y);
137
+ }
138
+
139
+ static VALUE rb_glfwGetGamepadName(VALUE glfw, VALUE jid)
140
+ {
141
+ const char *name = glfwGetGamepadName(NUM2INT(jid));
142
+ return name ? rb_str_new_cstr(name) : Qnil;
143
+ }
144
+
145
+ static VALUE rb_glfwGetGamepadState(VALUE glfw, VALUE jid, VALUE state)
146
+ {
147
+ return RB_BOOL(glfwGetGamepadState(NUM2INT(jid), DATA_PTR(state)));
148
+ }
149
+
150
+ static VALUE rb_glfwGetGammaRamp(VALUE glfw, VALUE monitor)
151
+ {
152
+ const GLFWgammaramp *ramp = glfwGetGammaRamp(DATA_PTR(monitor));
153
+ return ramp ? Data_Wrap_Struct(rb_cGammaRamp, NULL, RUBY_NEVER_FREE, (GLFWgammaramp*) ramp) : Qnil;
154
+ }
155
+
156
+ static VALUE rb_glfwGetInputMode(VALUE glfw, VALUE window, VALUE mode)
157
+ {
158
+ return INT2NUM(glfwGetInputMode(DATA_PTR(window), NUM2INT(mode)));
159
+ }
160
+
161
+ static VALUE rb_glfwGetJoystickAxes(VALUE glfw, VALUE jid)
162
+ {
163
+ int count;
164
+ const float *axes = glfwGetJoystickAxes(NUM2INT(jid), &count);
165
+
166
+ VALUE ary = rb_ary_new_capa(count);
167
+ for (int i = 0; i < count; i++)
168
+ rb_ary_store(ary, i, DBL2NUM(axes[i]));
169
+ return ary;
170
+ }
171
+
172
+ static VALUE rb_glfwGetJoystickButtons(VALUE glfw, VALUE jid)
173
+ {
174
+ int count;
175
+ const unsigned char *buttons = glfwGetJoystickButtons(NUM2INT(jid), &count);
176
+
177
+ VALUE ary = rb_ary_new_capa(count);
178
+ for (int i = 0; i < count; i++)
179
+ rb_ary_store(ary, i, UINT2NUM(buttons[i]));
180
+ return ary;
181
+ }
182
+
183
+ static VALUE rb_glfwGetJoystickGUID(VALUE glfw, VALUE jid)
184
+ {
185
+ const char *guid = glfwGetJoystickGUID(NUM2INT(jid));
186
+ return guid ? rb_str_new_cstr(guid) : Qnil;
187
+ }
188
+
189
+ static VALUE rb_glfwGetJoystickHats(VALUE glfw, VALUE jid)
190
+ {
191
+ int count;
192
+ const unsigned char *hats = glfwGetJoystickHats(NUM2INT(jid), &count);
193
+
194
+ VALUE ary = rb_ary_new_capa(count);
195
+ for (int i = 0; i < count; i++)
196
+ rb_ary_store(ary, i, UINT2NUM(hats[i]));
197
+ return ary;
198
+ }
199
+
200
+ static VALUE rb_glfwGetJoystickName(VALUE glfw, VALUE jid)
201
+ {
202
+ const char *name = glfwGetJoystickName(NUM2INT(jid));
203
+ return name ? rb_str_new_cstr(name) : Qnil;
204
+ }
205
+
206
+ static VALUE rb_glfwGetKey(VALUE glfw, VALUE window, VALUE key)
207
+ {
208
+ return INT2NUM(glfwGetKey(DATA_PTR(window), NUM2INT(key)));
209
+ }
210
+
211
+ static VALUE rb_glfwGetKeyName(VALUE glfw, VALUE key, VALUE scancode)
212
+ {
213
+ const char *name = glfwGetKeyName(NUM2INT(key), NUM2INT(scancode));
214
+ return name ? rb_str_new_cstr(name) : Qnil;
215
+ }
216
+
217
+ static VALUE rb_glfwGetKeyScancode(VALUE glfw, VALUE key)
218
+ {
219
+ return INT2NUM(glfwGetKeyScancode(NUM2INT(key)));
220
+ }
221
+
222
+ static VALUE rb_glfwGetMonitorContentScale(VALUE glfw, VALUE monitor)
223
+ {
224
+ float x, y;
225
+ glfwGetMonitorContentScale(DATA_PTR(monitor), &x, &y);
226
+ return rb_ary_new_from_args(2, DBL2NUM(x), DBL2NUM(y));
227
+ }
228
+
229
+ static VALUE rb_glfwGetMonitorName(VALUE glfw, VALUE monitor)
230
+ {
231
+ const char *name = glfwGetMonitorName(DATA_PTR(monitor));
232
+ return name ? rb_str_new_cstr(name) : Qnil;
233
+ }
234
+
235
+ static VALUE rb_glfwGetMonitorPhysicalSize(VALUE glfw, VALUE monitor)
236
+ {
237
+ int x, y;
238
+ glfwGetMonitorPhysicalSize(DATA_PTR(monitor), &x, &y);
239
+ return RGSS_Size_New(x, y);
240
+ }
241
+
242
+ static VALUE rb_glfwGetMonitorPos(VALUE glfw, VALUE monitor)
243
+ {
244
+ int x, y;
245
+ glfwGetMonitorPos(DATA_PTR(monitor), &x, &y);
246
+ return RGSS_Point_New(x, y);
247
+ }
248
+
249
+ static VALUE rb_glfwGetMonitorWorkarea(VALUE glfw, VALUE monitor)
250
+ {
251
+ int x, y, w, h;
252
+ glfwGetMonitorWorkarea(DATA_PTR(monitor), &x, &y, &w, &h);
253
+ return RGSS_Rect_New(x, y, w, h);
254
+ }
255
+
256
+ static VALUE rb_glfwGetMonitors(VALUE glfw)
257
+ {
258
+ int count;
259
+ GLFWmonitor **monitors = glfwGetMonitors(&count);
260
+
261
+ VALUE ary = rb_ary_new_capa(count);
262
+ for (int i = 0; i < count; i++)
263
+ rb_ary_store(ary, i, Data_Wrap_Struct(rb_cMonitor, NULL, RUBY_DEFAULT_FREE, monitors[i]));
264
+
265
+ return ary;
266
+ }
267
+
268
+ static VALUE rb_glfwGetMouseButton(VALUE glfw, VALUE window, VALUE button)
269
+ {
270
+ return INT2NUM(glfwGetMouseButton(DATA_PTR(window), NUM2INT(button)));
271
+ }
272
+
273
+ static VALUE rb_glfwGetPrimaryMonitor(VALUE glfw)
274
+ {
275
+ GLFWmonitor *monitor = glfwGetPrimaryMonitor();
276
+ return monitor ? Data_Wrap_Struct(rb_cMonitor, NULL, RUBY_NEVER_FREE, monitor) : Qnil;
277
+ }
278
+
279
+ static VALUE rb_glfwGetProcAddress(VALUE glfw, VALUE function)
280
+ {
281
+ void *proc = glfwGetProcAddress(StringValueCStr(function));
282
+ return proc ? PTR2NUM(proc) : Qnil;
283
+ }
284
+
285
+ static VALUE rb_glfwGetRequiredInstanceExtensions(VALUE glfw)
286
+ {
287
+ uint32_t count;
288
+ const char **extensions = glfwGetRequiredInstanceExtensions(&count);
289
+
290
+ VALUE ary = rb_ary_new_capa(count);
291
+ for (uint32_t i = 0; i < count; i++)
292
+ rb_ary_store(ary, i, rb_str_new_cstr(extensions[i]));
293
+
294
+ return ary;
295
+ }
296
+
297
+ static VALUE rb_glfwGetTime(VALUE glfw)
298
+ {
299
+ return DBL2NUM(glfwGetTime());
300
+ }
301
+
302
+ static VALUE rb_glfwGetTimerFrequency(VALUE glfw)
303
+ {
304
+ return ULL2NUM(glfwGetTimerFrequency());
305
+ }
306
+
307
+ static VALUE rb_glfwGetTimerValue(VALUE glfw)
308
+ {
309
+ return ULL2NUM(glfwGetTimerValue());
310
+ }
311
+
312
+ static VALUE rb_glfwGetVersion(VALUE glfw)
313
+ {
314
+ int major, minor, revision;
315
+ glfwGetVersion(&major, &minor, &revision);
316
+ return rb_sprintf("%d.%d.%d", major, minor, revision);
317
+ }
318
+
319
+ static VALUE rb_glfwGetVersionString(VALUE glfw)
320
+ {
321
+ const char *str = glfwGetVersionString();
322
+ return str ? rb_str_new_cstr(str) : Qnil;
323
+ }
324
+
325
+ static VALUE rb_glfwGetVideoMode(VALUE glfw, VALUE monitor)
326
+ {
327
+ const GLFWvidmode *mode = glfwGetVideoMode(DATA_PTR(monitor));
328
+ if (mode == NULL)
329
+ return Qnil;
330
+
331
+ GLFWvidmode *result = ALLOC(GLFWvidmode);
332
+ memcpy(result, mode, sizeof(GLFWvidmode));
333
+ return Data_Wrap_Struct(rb_cVideoMode, NULL, RUBY_DEFAULT_FREE, result);
334
+ }
335
+
336
+ static VALUE rb_glfwGetVideoModes(VALUE glfw, VALUE monitor)
337
+ {
338
+ int count;
339
+ const GLFWvidmode *modes = glfwGetVideoModes(DATA_PTR(monitor), &count);
340
+
341
+ VALUE ary = rb_ary_new_capa(count);
342
+ for (int i = 0; i < count; i++)
343
+ {
344
+ GLFWvidmode *mode = ALLOC(GLFWvidmode);
345
+ memcpy(mode, &modes[i], sizeof(GLFWvidmode));
346
+ rb_ary_store(ary, i, Data_Wrap_Struct(rb_cMonitor, NULL, RUBY_DEFAULT_FREE, mode));
347
+ }
348
+ return ary;
349
+ }
350
+
351
+ static VALUE rb_glfwGetWindowAttrib(VALUE glfw, VALUE window, VALUE attrib)
352
+ {
353
+ return INT2NUM(glfwGetWindowAttrib(DATA_PTR(window), NUM2INT(attrib)));
354
+ }
355
+
356
+ static VALUE rb_glfwGetWindowContentScale(VALUE glfw, VALUE window)
357
+ {
358
+ float x, y;
359
+ glfwGetWindowContentScale(DATA_PTR(window), &x, &y);
360
+ return rb_ary_new_from_args(2, DBL2NUM(x), DBL2NUM(y));
361
+ // TODO: vec2
362
+ }
363
+
364
+ static VALUE rb_glfwGetWindowFrameSize(VALUE glfw, VALUE window)
365
+ {
366
+ int l, t, r, b;
367
+ glfwGetWindowFrameSize(DATA_PTR(window), &l, &t, &r, &b);
368
+ return rb_ary_new_from_args(4, INT2NUM(l), INT2NUM(t), INT2NUM(r), INT2NUM(b));
369
+ }
370
+
371
+ static VALUE rb_glfwGetWindowMonitor(VALUE glfw, VALUE window)
372
+ {
373
+ GLFWmonitor *monitor = glfwGetWindowMonitor(DATA_PTR(window));
374
+ return monitor ? Data_Wrap_Struct(rb_cMonitor, NULL, RUBY_NEVER_FREE, monitor) : Qnil;
375
+ }
376
+
377
+ static VALUE rb_glfwGetWindowOpacity(VALUE glfw, VALUE window)
378
+ {
379
+ return DBL2NUM(glfwGetWindowOpacity(DATA_PTR(window)));
380
+ }
381
+
382
+ static VALUE rb_glfwGetWindowPos(VALUE glfw, VALUE window)
383
+ {
384
+ int x, y;
385
+ glfwGetWindowPos(DATA_PTR(window), &x, &y);
386
+ return RGSS_Point_New(x, y);
387
+ }
388
+
389
+ static VALUE rb_glfwGetWindowSize(VALUE glfw, VALUE window)
390
+ {
391
+ int x, y;
392
+ glfwGetWindowSize(DATA_PTR(window), &x, &y);
393
+ return RGSS_Size_New(x, y);
394
+ }
395
+
396
+ static VALUE rb_glfwHideWindow(VALUE glfw, VALUE window)
397
+ {
398
+ glfwHideWindow(DATA_PTR(window));
399
+ return Qnil;
400
+ }
401
+
402
+ static VALUE rb_glfwIconifyWindow(VALUE glfw, VALUE window)
403
+ {
404
+ glfwIconifyWindow(DATA_PTR(window));
405
+ return Qnil;
406
+ }
407
+
408
+ static VALUE rb_glfwInit(VALUE glfw)
409
+ {
410
+ return RB_BOOL(glfwInit());
411
+ }
412
+
413
+ static VALUE rb_glfwInitHint(VALUE glfw, VALUE hint, VALUE value)
414
+ {
415
+ glfwInitHint(NUM2INT(hint), NUM2INT(value));
416
+ return Qnil;
417
+ }
418
+
419
+ static VALUE rb_glfwJoystickIsGamepad(VALUE glfw, VALUE jid)
420
+ {
421
+ return RB_BOOL(glfwJoystickIsGamepad(NUM2INT(jid)));
422
+ }
423
+
424
+ static VALUE rb_glfwJoystickPresent(VALUE glfw, VALUE jid)
425
+ {
426
+ return glfwJoystickPresent(NUM2INT(jid));
427
+ }
428
+
429
+ static VALUE rb_glfwMakeContextCurrent(VALUE glfw, VALUE window)
430
+ {
431
+ glfwMakeContextCurrent(DATA_PTR(window));
432
+ return Qnil;
433
+ }
434
+
435
+ static VALUE rb_glfwMaximizeWindow(VALUE glfw, VALUE window)
436
+ {
437
+ glfwMaximizeWindow(DATA_PTR(window));
438
+ return Qnil;
439
+ }
440
+
441
+ static VALUE rb_glfwPollEvents(VALUE glfw)
442
+ {
443
+ glfwPollEvents();
444
+ return Qnil;
445
+ }
446
+
447
+ static VALUE rb_glfwPostEmptyEvent(VALUE glfw)
448
+ {
449
+ glfwPostEmptyEvent();
450
+ return Qnil;
451
+ }
452
+
453
+ static VALUE rb_glfwRawMouseMotionSupported(VALUE glfw)
454
+ {
455
+ return RB_BOOL(glfwRawMouseMotionSupported());
456
+ }
457
+
458
+ static VALUE rb_glfwRequestWindowAttention(VALUE glfw, VALUE window)
459
+ {
460
+ glfwRequestWindowAttention(DATA_PTR(window));
461
+ return Qnil;
462
+ }
463
+
464
+ static VALUE rb_glfwRestoreWindow(VALUE glfw, VALUE window)
465
+ {
466
+ glfwRestoreWindow(DATA_PTR(window));
467
+ return Qnil;
468
+ }
469
+
470
+ static VALUE rb_glfwSetClipboardString(VALUE glfw, VALUE text)
471
+ {
472
+ glfwSetClipboardString(NULL, RTEST(text) ? StringValueCStr(text) : NULL);
473
+ return text;
474
+ }
475
+
476
+ static VALUE rb_glfwSetCursor(VALUE glfw, VALUE window, VALUE cursor)
477
+ {
478
+ glfwSetCursor(DATA_PTR(window), RTEST(cursor) ? DATA_PTR(cursor) : NULL);
479
+ return cursor;
480
+ }
481
+
482
+ static VALUE rb_glfwSetCursorPos(VALUE glfw, VALUE window, VALUE point)
483
+ {
484
+ int *vec = DATA_PTR(point);
485
+ glfwSetCursorPos(DATA_PTR(window), (double)vec[0], (double)vec[1]);
486
+ return Qnil;
487
+ }
488
+
489
+ static VALUE rb_glfwSetGamma(VALUE glfw, VALUE monitor, VALUE gamma)
490
+ {
491
+ glfwSetGamma(DATA_PTR(monitor), NUM2FLT(gamma));
492
+ return Qnil;
493
+ }
494
+
495
+ static VALUE rb_glfwSetGammaRamp(VALUE glfw, VALUE monitor, VALUE ramp)
496
+ {
497
+ glfwSetGammaRamp(DATA_PTR(monitor), DATA_PTR(ramp));
498
+ return Qnil;
499
+ }
500
+
501
+ static VALUE rb_glfwSetInputMode(VALUE glfw, VALUE window, VALUE mode, VALUE value)
502
+ {
503
+ glfwSetInputMode(DATA_PTR(window), NUM2INT(mode), NUM2INT(value));
504
+ return Qnil;
505
+ }
506
+
507
+ static VALUE rb_glfwSetTime(VALUE glfw, VALUE time)
508
+ {
509
+ glfwSetTime(NUM2DBL(time));
510
+ return time;
511
+ }
512
+
513
+ static VALUE rb_glfwSetWindowAspectRatio(VALUE glfw, VALUE window, VALUE numerator, VALUE denominator)
514
+ {
515
+ glfwSetWindowAspectRatio(DATA_PTR(window), NUM2INT(numerator), NUM2INT(denominator));
516
+ return Qnil;
517
+ }
518
+
519
+ static VALUE rb_glfwSetWindowAttrib(VALUE glfw, VALUE window, VALUE attrib, VALUE value)
520
+ {
521
+ glfwSetWindowAttrib(DATA_PTR(window), NUM2INT(attrib), NUM2INT(value));
522
+ return Qnil;
523
+ }
524
+
525
+ static VALUE rb_glfwSetWindowIcon(VALUE glfw, VALUE window, VALUE images)
526
+ {
527
+ GLFWimage *img = NULL;
528
+ GLFWwindow *handle = DATA_PTR(window);
529
+ int count;
530
+ if (RB_TYPE_P(images, T_ARRAY))
531
+ {
532
+ count = rb_array_len(images);
533
+ GLFWimage array[count];
534
+
535
+ for (int i = 0; i < count; i++)
536
+ {
537
+ img = DATA_PTR(rb_ary_entry(images, i));
538
+ array[i] = *img;
539
+ }
540
+ glfwSetWindowIcon(handle, count, array);
541
+ }
542
+ else
543
+ {
544
+ if (RTEST(images))
545
+ {
546
+ count = 1;
547
+ img = DATA_PTR(images);
548
+ }
549
+ glfwSetWindowIcon(handle, count, img);
550
+ }
551
+ return Qnil;
552
+ }
553
+
554
+ static VALUE rb_glfwSetWindowMonitor(VALUE glfw, VALUE window, VALUE monitor, VALUE x, VALUE y, VALUE w, VALUE h,
555
+ VALUE rate)
556
+ {
557
+ GLFWmonitor *ptr = RTEST(monitor) ? DATA_PTR(monitor) : NULL;
558
+ glfwSetWindowMonitor(DATA_PTR(window), ptr, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), NUM2INT(rate));
559
+ return Qnil;
560
+ }
561
+
562
+ static VALUE rb_glfwSetWindowOpacity(VALUE glfw, VALUE window, VALUE opacity)
563
+ {
564
+ glfwSetWindowOpacity(DATA_PTR(window), NUM2FLT(opacity));
565
+ return opacity;
566
+ }
567
+
568
+ static VALUE rb_glfwSetWindowPos(VALUE glfw, VALUE window, VALUE point)
569
+ {
570
+ int *vec = DATA_PTR(point);
571
+ glfwSetWindowPos(DATA_PTR(window), vec[0], vec[1]);
572
+ return point;
573
+ }
574
+
575
+ static VALUE rb_glfwSetWindowShouldClose(VALUE glfw, VALUE window, VALUE close)
576
+ {
577
+ glfwSetWindowShouldClose(DATA_PTR(window), NUM2INT(close));
578
+ return Qnil;
579
+ }
580
+
581
+ static VALUE rb_glfwSetWindowSize(VALUE glfw, VALUE window, VALUE size)
582
+ {
583
+ int *vec = DATA_PTR(size);
584
+ glfwSetWindowSize(DATA_PTR(window), vec[0], vec[1]);
585
+ return size;
586
+ }
587
+
588
+ static VALUE rb_glfwSetWindowSizeLimits(VALUE glfw, VALUE window, VALUE min_x, VALUE min_y, VALUE max_x, VALUE max_y)
589
+ {
590
+ glfwSetWindowSizeLimits(DATA_PTR(window), NUM2INT(min_x), NUM2INT(min_y), NUM2INT(max_x), NUM2INT(max_y));
591
+ return Qnil;
592
+ }
593
+
594
+ static VALUE rb_glfwSetWindowTitle(VALUE glfw, VALUE window, VALUE title)
595
+ {
596
+ const char *str = RTEST(title) ? StringValueCStr(title) : "";
597
+ glfwSetWindowTitle(DATA_PTR(window), str);
598
+ return title;
599
+ }
600
+
601
+ static VALUE rb_glfwShowWindow(VALUE glfw, VALUE window)
602
+ {
603
+ glfwShowWindow(DATA_PTR(window));
604
+ return Qnil;
605
+ }
606
+
607
+ static VALUE rb_glfwSwapBuffers(VALUE glfw, VALUE window)
608
+ {
609
+ glfwSwapBuffers(DATA_PTR(window));
610
+ return Qnil;
611
+ }
612
+
613
+ static VALUE rb_glfwSwapInterval(VALUE glfw, VALUE interval)
614
+ {
615
+ glfwSwapInterval(NUM2INT(interval));
616
+ return Qnil;
617
+ }
618
+
619
+ static VALUE rb_glfwTerminate(VALUE glfw)
620
+ {
621
+ glfwTerminate();
622
+ return Qnil;
623
+ }
624
+
625
+ static VALUE rb_glfwUpdateGamepadMappings(VALUE glfw, VALUE mappings)
626
+ {
627
+ if (!RTEST(mappings))
628
+ return INT2NUM(0);
629
+
630
+ const char *str = StringValueCStr(mappings);
631
+ return INT2NUM(glfwUpdateGamepadMappings(str));
632
+ }
633
+
634
+ static VALUE rb_glfwVulkanSupported(VALUE glfw)
635
+ {
636
+ return RB_BOOL(glfwVulkanSupported());
637
+ }
638
+
639
+ static VALUE rb_glfwWaitEvents(VALUE glfw)
640
+ {
641
+ glfwWaitEvents();
642
+ return Qnil;
643
+ }
644
+
645
+ static VALUE rb_glfwWaitEventsTimeout(VALUE glfw, VALUE timeout)
646
+ {
647
+ glfwWaitEventsTimeout(NUM2DBL(timeout));
648
+ return Qnil;
649
+ }
650
+
651
+ static VALUE rb_glfwWindowHint(VALUE glfw, VALUE hint, VALUE value)
652
+ {
653
+ glfwWindowHint(NUM2INT(hint), NUM2INT(value));
654
+ return Qnil;
655
+ }
656
+
657
+ static VALUE rb_glfwWindowHintString(VALUE glfw, VALUE hint, VALUE value)
658
+ {
659
+ glfwWindowHintString(NUM2INT(hint), StringValueCStr(value));
660
+ return Qnil;
661
+ }
662
+
663
+ static VALUE rb_glfwWindowShouldClose(VALUE glfw, VALUE window)
664
+ {
665
+ return RB_BOOL(glfwWindowShouldClose(DATA_PTR(window)));
666
+ }
667
+
668
+ #define GLFW_BLOCK_CALLBACK(ivar, func) \
669
+ static VALUE rb_##func(VALUE glfw, VALUE window) \
670
+ { \
671
+ VALUE proc, current = rb_iv_get(window, ivar); \
672
+ if (rb_block_given_p()) \
673
+ { \
674
+ func(DATA_PTR(window), rb_cb_##func); \
675
+ proc = rb_block_proc(); \
676
+ } \
677
+ else \
678
+ { \
679
+ func(DATA_PTR(window), NULL); \
680
+ proc = Qnil; \
681
+ } \
682
+ rb_iv_set(window, ivar, proc); \
683
+ return current; \
684
+ }
685
+
686
+ #define UNWRAP_PROC(handle, proc, ivar) \
687
+ RGSS_HANDLE *handle; \
688
+ HASH_FIND(hh, handles, &window, sizeof(GLFWwindow *), handle); \
689
+ if (handle == NULL) \
690
+ return; \
691
+ VALUE proc = rb_iv_get(handle->value, ivar)
692
+
693
+ #define CB_WINDOW_POS "@proc_window_position"
694
+ #define CB_WINDOW_SIZE "@proc_size"
695
+ #define CB_CURSOR_POS "@proc_cursor_pos"
696
+ #define CB_FRAMEBUFFER_SIZE "@proc_framebuffer_size"
697
+ #define CB_DROP "@proc_drop"
698
+ #define CB_SCROLL "@proc_scroll"
699
+ #define CB_FOCUS "@proc_focus"
700
+ #define CB_MINIMIZE "@proc_minimize"
701
+ #define CB_MAXIMIZE "@proc_maximize"
702
+ #define CB_CLOSE "@proc_close"
703
+ #define CB_REFRESH "@proc_refresh"
704
+ #define CB_SCALE "@proc_scale"
705
+ #define CB_KEY "@proc_key"
706
+ #define CB_MBTN "@proc_mbtn"
707
+ #define CB_ENTER "@proc_enter"
708
+ #define CB_CHAR "@proc_char"
709
+ #define CB_ERROR "@proc_error"
710
+ #define CB_JOYSTICK "@proc_joystick"
711
+ #define CB_MONITOR "@proc_monitor"
712
+
713
+ static void rb_cb_glfwSetWindowPosCallback(GLFWwindow *window, int x, int y)
714
+ {
715
+ UNWRAP_PROC(handle, proc, CB_WINDOW_POS);
716
+ rb_proc_call(proc, rb_ary_new_from_args(3, handle->value, INT2NUM(x), INT2NUM(y)));
717
+ }
718
+
719
+ static void rb_cb_glfwSetWindowSizeCallback(GLFWwindow *window, int x, int y)
720
+ {
721
+ UNWRAP_PROC(handle, proc, CB_WINDOW_SIZE);
722
+ rb_proc_call(proc, rb_ary_new_from_args(3, handle->value, INT2NUM(x), INT2NUM(y)));
723
+ }
724
+
725
+ static void rb_cb_glfwSetCursorPosCallback(GLFWwindow *window, double x, double y)
726
+ {
727
+ UNWRAP_PROC(handle, proc, CB_CURSOR_POS);
728
+ rb_proc_call(proc, rb_ary_new_from_args(3, handle->value, INT2NUM((int)round(x)), INT2NUM((int)round(y))));
729
+ }
730
+
731
+ static void rb_cb_glfwSetFramebufferSizeCallback(GLFWwindow *window, int x, int y)
732
+ {
733
+ UNWRAP_PROC(handle, proc, CB_FRAMEBUFFER_SIZE);
734
+ rb_proc_call(proc, rb_ary_new_from_args(3, handle->value, INT2NUM(x), INT2NUM(y)));
735
+ }
736
+
737
+ static void rb_cb_glfwSetDropCallback(GLFWwindow *window, int count, const char **paths)
738
+ {
739
+ UNWRAP_PROC(handle, proc, CB_DROP);
740
+ VALUE path;
741
+ VALUE ary = rb_ary_new_capa(count);
742
+
743
+ for (int i = 0; i < count; i++)
744
+ {
745
+ path = rb_str_new_cstr(paths[i]);
746
+ rb_ary_store(ary, i, path);
747
+ }
748
+ rb_proc_call(proc, rb_ary_new_from_args(3, handle->value, INT2NUM(count), ary));
749
+ }
750
+
751
+ static void rb_cb_glfwSetScrollCallback(GLFWwindow *window, double x, double y)
752
+ {
753
+ UNWRAP_PROC(handle, proc, CB_SCROLL);
754
+ rb_proc_call(proc, rb_ary_new_from_args(3, handle->value, DBL2NUM(x), DBL2NUM(y)));
755
+ }
756
+
757
+ static void rb_cb_glfwSetWindowFocusCallback(GLFWwindow *window, int value)
758
+ {
759
+ UNWRAP_PROC(handle, proc, CB_FOCUS);
760
+ rb_proc_call(proc, rb_ary_new_from_args(2, handle->value, RB_BOOL(value)));
761
+ }
762
+
763
+ static void rb_cb_glfwSetWindowIconifyCallback(GLFWwindow *window, int value)
764
+ {
765
+ UNWRAP_PROC(handle, proc, CB_MINIMIZE);
766
+ rb_proc_call(proc, rb_ary_new_from_args(2, handle->value, RB_BOOL(value)));
767
+ }
768
+
769
+ static void rb_cb_glfwSetWindowMaximizeCallback(GLFWwindow *window, int value)
770
+ {
771
+ UNWRAP_PROC(handle, proc, CB_MAXIMIZE);
772
+ rb_proc_call(proc, rb_ary_new_from_args(2, handle->value, RB_BOOL(value)));
773
+ }
774
+
775
+ static void rb_cb_glfwSetWindowCloseCallback(GLFWwindow *window)
776
+ {
777
+ UNWRAP_PROC(handle, proc, CB_CLOSE);
778
+ rb_proc_call(proc, rb_ary_new_from_args(1, handle->value));
779
+ }
780
+
781
+ static void rb_cb_glfwSetWindowRefreshCallback(GLFWwindow *window)
782
+ {
783
+ UNWRAP_PROC(handle, proc, CB_REFRESH);
784
+ rb_proc_call(proc, rb_ary_new_from_args(1, handle->value));
785
+ }
786
+
787
+ static void rb_cb_glfwSetWindowContentScaleCallback(GLFWwindow *window, float x, float y)
788
+ {
789
+ UNWRAP_PROC(handle, proc, CB_SCALE);
790
+ rb_proc_call(proc, rb_ary_new_from_args(3, handle->value, DBL2NUM(x), DBL2NUM(y)));
791
+ }
792
+
793
+ static void rb_cb_glfwSetKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
794
+ {
795
+ UNWRAP_PROC(handle, proc, CB_KEY);
796
+ rb_proc_call(proc, rb_ary_new_from_args(5, handle->value, INT2NUM(key), INT2NUM(scancode), INT2NUM(action), INT2NUM(mods)));
797
+ }
798
+
799
+ static void rb_cb_glfwSetMouseButtonCallback(GLFWwindow *window, int key, int action, int mods)
800
+ {
801
+ UNWRAP_PROC(handle, proc, CB_MBTN);
802
+ rb_proc_call(proc, rb_ary_new_from_args(4, handle->value, INT2NUM(key), INT2NUM(action), INT2NUM(mods)));
803
+ }
804
+
805
+ static void rb_cb_glfwSetCharCallback(GLFWwindow *window, unsigned int codepoint)
806
+ {
807
+ UNWRAP_PROC(handle, proc, CB_CHAR);
808
+ rb_proc_call(proc, rb_ary_new_from_args(2, handle->value, UINT2NUM(codepoint)));
809
+ }
810
+
811
+ static void rb_cb_glfwSetCursorEnterCallback(GLFWwindow *window, int value)
812
+ {
813
+ UNWRAP_PROC(handle, proc, CB_ENTER);
814
+ rb_proc_call(proc, rb_ary_new_from_args(2, handle->value, RB_BOOL(value)));
815
+ }
816
+
817
+ GLFW_BLOCK_CALLBACK(CB_WINDOW_POS, glfwSetWindowPosCallback)
818
+ GLFW_BLOCK_CALLBACK(CB_WINDOW_SIZE, glfwSetWindowSizeCallback)
819
+ GLFW_BLOCK_CALLBACK(CB_CURSOR_POS, glfwSetCursorPosCallback)
820
+ GLFW_BLOCK_CALLBACK(CB_FRAMEBUFFER_SIZE, glfwSetFramebufferSizeCallback)
821
+ GLFW_BLOCK_CALLBACK(CB_DROP, glfwSetDropCallback)
822
+ GLFW_BLOCK_CALLBACK(CB_SCROLL, glfwSetScrollCallback)
823
+ GLFW_BLOCK_CALLBACK(CB_FOCUS, glfwSetWindowFocusCallback)
824
+ GLFW_BLOCK_CALLBACK(CB_MINIMIZE, glfwSetWindowIconifyCallback)
825
+ GLFW_BLOCK_CALLBACK(CB_MAXIMIZE, glfwSetWindowMaximizeCallback)
826
+ GLFW_BLOCK_CALLBACK(CB_CLOSE, glfwSetWindowCloseCallback)
827
+ GLFW_BLOCK_CALLBACK(CB_REFRESH, glfwSetWindowRefreshCallback)
828
+ GLFW_BLOCK_CALLBACK(CB_SCALE, glfwSetWindowContentScaleCallback)
829
+ GLFW_BLOCK_CALLBACK(CB_KEY, glfwSetKeyCallback)
830
+ GLFW_BLOCK_CALLBACK(CB_MBTN, glfwSetMouseButtonCallback)
831
+ GLFW_BLOCK_CALLBACK(CB_ENTER, glfwSetCursorEnterCallback)
832
+ GLFW_BLOCK_CALLBACK(CB_CHAR, glfwSetCharCallback)
833
+
834
+ static void rb_cb_glfwSetErrorCallback(int code, const char *message)
835
+ {
836
+ VALUE proc = rb_iv_get(rb_mGLFW, CB_ERROR);
837
+ VALUE str = message ? rb_str_new_cstr(message) : Qnil;
838
+ rb_proc_call(proc, rb_ary_new_from_args(2, INT2NUM(code), str));
839
+ }
840
+
841
+ static VALUE rb_glfwSetErrorCallback(VALUE glfw)
842
+ {
843
+ VALUE proc, current = rb_iv_get(glfw, CB_ERROR);
844
+ if (rb_block_given_p())
845
+ {
846
+ proc = rb_block_proc();
847
+ glfwSetErrorCallback(rb_cb_glfwSetErrorCallback);
848
+ }
849
+ else
850
+ {
851
+ proc = Qnil;
852
+ glfwSetErrorCallback(NULL);
853
+ }
854
+ rb_iv_set(glfw, CB_ERROR, proc);
855
+ return current;
856
+ }
857
+
858
+ static void rb_cb_glfwSetJoystickCallback(int jid, int event)
859
+ {
860
+ VALUE proc = rb_iv_get(rb_mGLFW, CB_JOYSTICK);
861
+ rb_proc_call(proc, rb_ary_new_from_args(2, INT2NUM(jid), INT2NUM(event)));
862
+ }
863
+
864
+ static VALUE rb_glfwSetJoystickCallback(VALUE glfw)
865
+ {
866
+ VALUE proc, current = rb_iv_get(glfw, CB_JOYSTICK);
867
+ if (rb_block_given_p())
868
+ {
869
+ proc = rb_block_proc();
870
+ glfwSetJoystickCallback(rb_cb_glfwSetJoystickCallback);
871
+ }
872
+ else
873
+ {
874
+ proc = Qnil;
875
+ glfwSetJoystickCallback(NULL);
876
+ }
877
+ rb_iv_set(glfw, CB_JOYSTICK, proc);
878
+ return current;
879
+ }
880
+
881
+ static void rb_cb_glfwSetMonitorCallback(GLFWmonitor *monitor, int event)
882
+ {
883
+ VALUE proc = rb_iv_get(rb_mGLFW, CB_MONITOR);
884
+ VALUE m = Data_Wrap_Struct(rb_cMonitor, NULL, RUBY_NEVER_FREE, monitor);
885
+ rb_proc_call(proc, rb_ary_new_from_args(2, m, INT2NUM(event)));
886
+ }
887
+
888
+ static VALUE rb_glfwSetMonitorCallback(VALUE glfw)
889
+ {
890
+ VALUE proc, current = rb_iv_get(glfw, CB_MONITOR);
891
+ if (rb_block_given_p())
892
+ {
893
+ proc = rb_block_proc();
894
+ glfwSetMonitorCallback(rb_cb_glfwSetMonitorCallback);
895
+ }
896
+ else
897
+ {
898
+ proc = Qnil;
899
+ glfwSetMonitorCallback(NULL);
900
+ }
901
+ rb_iv_set(glfw, CB_MONITOR, proc);
902
+ return current;
903
+ }
904
+
905
+ static void glfw_gamma_free(void *data)
906
+ {
907
+ GLFWgammaramp *ramp = data;
908
+
909
+ if (ramp->red)
910
+ xfree(ramp->red);
911
+ if (ramp->green)
912
+ xfree(ramp->green);
913
+ if (ramp->blue)
914
+ xfree(ramp->blue);
915
+
916
+ xfree(ramp);
917
+ }
918
+
919
+ static VALUE glfw_gamma_initialize(VALUE self, VALUE red, VALUE green, VALUE blue)
920
+ {
921
+ GLFWgammaramp *ramp;
922
+ long size_red, size_green, size_blue;
923
+
924
+ size_red = rb_array_len(red);
925
+ size_green = rb_array_len(green);
926
+ size_blue = rb_array_len(blue);
927
+
928
+ if (size_red != size_green || size_green != size_blue)
929
+ rb_raise(rb_eArgError, "unequal length gamma ramps provided");
930
+
931
+ ramp = DATA_PTR(self);
932
+ ramp->size = (unsigned int) size_red;
933
+ ramp->red = xmalloc(sizeof(unsigned short) * ramp->size);
934
+ ramp->green = xmalloc(sizeof(unsigned short) * ramp->size);
935
+ ramp->blue = xmalloc(sizeof(unsigned short) * ramp->size);
936
+
937
+ for (long i = 0; i < size_red; i++)
938
+ {
939
+ ramp->red[i] = NUM2USHORT(rb_ary_entry(red, i));
940
+ ramp->green[i] = NUM2USHORT(rb_ary_entry(green, i));
941
+ ramp->blue[i] = NUM2USHORT(rb_ary_entry(blue, i));
942
+ }
943
+
944
+ return self;
945
+ }
946
+
947
+ static VALUE glfw_gamma_each(VALUE self)
948
+ {
949
+ RETURN_ENUMERATOR(self, 0, NULL);
950
+
951
+ VALUE args;
952
+ GLFWgammaramp *ramp = DATA_PTR(self);
953
+ for (unsigned int i = 0; i < ramp->size; i++)
954
+ {
955
+ args = rb_ary_new_from_args(3, USHORT2NUM(ramp->red[i]), USHORT2NUM(ramp->green[i]), USHORT2NUM(ramp->blue[i]));
956
+ rb_yield(args);
957
+ }
958
+ return self;
959
+ }
960
+
961
+ static VALUE glfw_gamma_size(VALUE self)
962
+ {
963
+ GLFWgammaramp *ramp = DATA_PTR(self);
964
+ return UINT2NUM(ramp->size);
965
+ }
966
+
967
+ #define VIDEO_ATTRIB(field, name)\
968
+ static VALUE name(VALUE self)\
969
+ {\
970
+ GLFWvidmode *mode = DATA_PTR(self);\
971
+ return INT2NUM(mode->field);\
972
+ }
973
+
974
+ VIDEO_ATTRIB(redBits, glfw_video_red)
975
+ VIDEO_ATTRIB(greenBits, glfw_video_green)
976
+ VIDEO_ATTRIB(blueBits, glfw_video_blue)
977
+ VIDEO_ATTRIB(width, glfw_video_width)
978
+ VIDEO_ATTRIB(height, glfw_video_height)
979
+ VIDEO_ATTRIB(refreshRate, glfw_video_rate)
980
+
981
+ #define GAMEPAD_ATTRIB(field, name)
982
+
983
+ static VALUE glfw_gamepad_axes(VALUE gamepad, VALUE axis)
984
+ {
985
+ GLFWgamepadstate *state = DATA_PTR(gamepad);
986
+ return DBL2NUM(state->axes[NUM2INT(axis)]);
987
+ }
988
+
989
+ static VALUE glfw_gamepad_button(VALUE gamepad, VALUE button)
990
+ {
991
+ GLFWgamepadstate *state = DATA_PTR(gamepad);
992
+ return RB_BOOL(state->buttons[NUM2INT(button)]);
993
+ }
994
+
995
+ static VALUE glfw_gamma_alloc(VALUE klass)
996
+ {
997
+ GLFWgammaramp *ramp = ALLOC(GLFWgammaramp);
998
+ memset(ramp, 0, sizeof(GLFWgammaramp));
999
+ return Data_Wrap_Struct(klass, NULL, glfw_gamma_free, ramp);
1000
+ }
1001
+
1002
+ static VALUE glfw_video_alloc(VALUE klass)
1003
+ {
1004
+ GLFWvidmode *video = ALLOC(GLFWvidmode);
1005
+ memset(video, 0, sizeof(GLFWvidmode));
1006
+ return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, video);
1007
+ }
1008
+
1009
+ static VALUE glfw_gamepad_alloc(VALUE klass)
1010
+ {
1011
+ GLFWgamepadstate *gamepad = ALLOC(GLFWgamepadstate);
1012
+ memset(gamepad, 0, sizeof(GLFWgamepadstate));
1013
+ return Data_Wrap_Struct(klass, NULL, RUBY_DEFAULT_FREE, gamepad);
1014
+ }
1015
+
1016
+ void RGSS_Init_GLFW(VALUE parent)
1017
+ {
1018
+ rb_mGLFW = rb_define_module_under(parent, "GLFW");
1019
+ rb_cWindow = rb_define_class_under(rb_mGLFW, "Window", rb_cObject);
1020
+ rb_cMonitor = rb_define_class_under(rb_mGLFW, "Monitor", rb_cObject);
1021
+ rb_cCursor = rb_define_class_under(rb_mGLFW, "Cursor", rb_cObject);
1022
+ rb_cGamepadState = rb_define_class_under(rb_mGLFW, "GamepadState", rb_cObject);
1023
+ rb_cVideoMode = rb_define_class_under(rb_mGLFW, "VideoMode", rb_cObject);
1024
+ rb_cGammaRamp = rb_define_class_under(rb_mGLFW, "GammaRamp", rb_cObject);
1025
+
1026
+ rb_define_alloc_func(rb_cWindow, RGSS_Handle_Alloc);
1027
+ rb_define_alloc_func(rb_cMonitor, RGSS_Handle_Alloc);
1028
+ rb_define_alloc_func(rb_cCursor, RGSS_Handle_Alloc);
1029
+ rb_define_alloc_func(rb_cGamepadState, glfw_gamepad_alloc);
1030
+ rb_define_alloc_func(rb_cGammaRamp, glfw_gamma_alloc);
1031
+ rb_define_alloc_func(rb_cVideoMode, glfw_video_alloc);
1032
+
1033
+ rb_define_method1(rb_cGamepadState, "axis", glfw_gamepad_axes, 1);
1034
+ rb_define_method1(rb_cGamepadState, "button", glfw_gamepad_button, 1);
1035
+
1036
+ rb_define_method3(rb_cGammaRamp, "initialize", glfw_gamma_initialize, 3);
1037
+ rb_define_method0(rb_cGammaRamp, "size", glfw_gamma_size, 0);
1038
+ rb_define_method0(rb_cGammaRamp, "each", glfw_gamma_each, 0);
1039
+
1040
+ rb_define_method0(rb_cVideoMode, "red_bits", glfw_video_red, 0);
1041
+ rb_define_method0(rb_cVideoMode, "green_bits", glfw_video_green, 0);
1042
+ rb_define_method0(rb_cVideoMode, "blue_bits", glfw_video_blue, 0);
1043
+ rb_define_method0(rb_cVideoMode, "width", glfw_video_width, 0);
1044
+ rb_define_method0(rb_cVideoMode, "height", glfw_video_height, 0);
1045
+ rb_define_method0(rb_cVideoMode, "refresh_rate", glfw_video_rate, 0);
1046
+
1047
+ rb_define_module_function3(rb_mGLFW, "glfwCreateCursor", rb_glfwCreateCursor, 3);
1048
+ rb_define_module_function1(rb_mGLFW, "glfwCreateStandardCursor", rb_glfwCreateStandardCursor, 1);
1049
+ rb_define_module_functionm1(rb_mGLFW, "glfwCreateWindow", rb_glfwCreateWindow, -1);
1050
+ rb_define_module_function0(rb_mGLFW, "glfwDefaultWindowHints", rb_glfwDefaultWindowHints, 0);
1051
+ rb_define_module_function1(rb_mGLFW, "glfwDestroyCursor", rb_glfwDestroyCursor, 1);
1052
+ rb_define_module_function1(rb_mGLFW, "glfwDestroyWindow", rb_glfwDestroyWindow, 1);
1053
+ rb_define_module_function1(rb_mGLFW, "glfwExtensionSupported", rb_glfwExtensionSupported, 1);
1054
+ rb_define_module_function1(rb_mGLFW, "glfwFocusWindow", rb_glfwFocusWindow, 1);
1055
+ rb_define_module_function0(rb_mGLFW, "glfwGetClipboardString", rb_glfwGetClipboardString, 0);
1056
+ rb_define_module_function0(rb_mGLFW, "glfwGetCurrentContext", rb_glfwGetCurrentContext, 0);
1057
+ rb_define_module_function1(rb_mGLFW, "glfwGetCursorPos", rb_glfwGetCursorPos, 1);
1058
+ rb_define_module_function0(rb_mGLFW, "glfwGetError", rb_glfwGetError, 0);
1059
+ rb_define_module_function1(rb_mGLFW, "glfwGetFramebufferSize", rb_glfwGetFramebufferSize, 1);
1060
+ rb_define_module_function1(rb_mGLFW, "glfwGetGamepadName", rb_glfwGetGamepadName, 1);
1061
+ rb_define_module_function2(rb_mGLFW, "glfwGetGamepadState", rb_glfwGetGamepadState, 2);
1062
+ rb_define_module_function1(rb_mGLFW, "glfwGetGammaRamp", rb_glfwGetGammaRamp, 1);
1063
+ rb_define_module_function2(rb_mGLFW, "glfwGetInputMode", rb_glfwGetInputMode, 2);
1064
+ rb_define_module_function1(rb_mGLFW, "glfwGetJoystickAxes", rb_glfwGetJoystickAxes, 1);
1065
+ rb_define_module_function1(rb_mGLFW, "glfwGetJoystickButtons", rb_glfwGetJoystickButtons, 1);
1066
+ rb_define_module_function1(rb_mGLFW, "glfwGetJoystickGUID", rb_glfwGetJoystickGUID, 1);
1067
+ rb_define_module_function1(rb_mGLFW, "glfwGetJoystickHats", rb_glfwGetJoystickHats, 1);
1068
+ rb_define_module_function1(rb_mGLFW, "glfwGetJoystickName", rb_glfwGetJoystickName, 1);
1069
+ rb_define_module_function2(rb_mGLFW, "glfwGetKey", rb_glfwGetKey, 2);
1070
+ rb_define_module_function2(rb_mGLFW, "glfwGetKeyName", rb_glfwGetKeyName, 2);
1071
+ rb_define_module_function1(rb_mGLFW, "glfwGetKeyScancode", rb_glfwGetKeyScancode, 1);
1072
+ rb_define_module_function1(rb_mGLFW, "glfwGetMonitorContentScale", rb_glfwGetMonitorContentScale, 1);
1073
+ rb_define_module_function1(rb_mGLFW, "glfwGetMonitorName", rb_glfwGetMonitorName, 1);
1074
+ rb_define_module_function1(rb_mGLFW, "glfwGetMonitorPhysicalSize", rb_glfwGetMonitorPhysicalSize, 1);
1075
+ rb_define_module_function1(rb_mGLFW, "glfwGetMonitorPos", rb_glfwGetMonitorPos, 1);
1076
+ rb_define_module_function1(rb_mGLFW, "glfwGetMonitorWorkarea", rb_glfwGetMonitorWorkarea, 1);
1077
+ rb_define_module_function0(rb_mGLFW, "glfwGetMonitors", rb_glfwGetMonitors, 0);
1078
+ rb_define_module_function2(rb_mGLFW, "glfwGetMouseButton", rb_glfwGetMouseButton, 2);
1079
+ rb_define_module_function0(rb_mGLFW, "glfwGetPrimaryMonitor", rb_glfwGetPrimaryMonitor, 0);
1080
+ rb_define_module_function1(rb_mGLFW, "glfwGetProcAddress", rb_glfwGetProcAddress, 1);
1081
+ rb_define_module_function0(rb_mGLFW, "glfwGetRequiredInstanceExtensions", rb_glfwGetRequiredInstanceExtensions, 0);
1082
+ rb_define_module_function0(rb_mGLFW, "glfwGetTime", rb_glfwGetTime, 0);
1083
+ rb_define_module_function0(rb_mGLFW, "glfwGetTimerFrequency", rb_glfwGetTimerFrequency, 0);
1084
+ rb_define_module_function0(rb_mGLFW, "glfwGetTimerValue", rb_glfwGetTimerValue, 0);
1085
+ rb_define_module_function0(rb_mGLFW, "glfwGetVersion", rb_glfwGetVersion, 0);
1086
+ rb_define_module_function0(rb_mGLFW, "glfwGetVersionString", rb_glfwGetVersionString, 0);
1087
+ rb_define_module_function1(rb_mGLFW, "glfwGetVideoMode", rb_glfwGetVideoMode, 1);
1088
+ rb_define_module_function1(rb_mGLFW, "glfwGetVideoModes", rb_glfwGetVideoModes, 1);
1089
+ rb_define_module_function2(rb_mGLFW, "glfwGetWindowAttrib", rb_glfwGetWindowAttrib, 2);
1090
+ rb_define_module_function1(rb_mGLFW, "glfwGetWindowContentScale", rb_glfwGetWindowContentScale, 1);
1091
+ rb_define_module_function1(rb_mGLFW, "glfwGetWindowFrameSize", rb_glfwGetWindowFrameSize, 1);
1092
+ rb_define_module_function1(rb_mGLFW, "glfwGetWindowMonitor", rb_glfwGetWindowMonitor, 1);
1093
+ rb_define_module_function1(rb_mGLFW, "glfwGetWindowOpacity", rb_glfwGetWindowOpacity, 1);
1094
+ rb_define_module_function1(rb_mGLFW, "glfwGetWindowPos", rb_glfwGetWindowPos, 1);
1095
+ rb_define_module_function1(rb_mGLFW, "glfwGetWindowSize", rb_glfwGetWindowSize, 1);
1096
+ rb_define_module_function1(rb_mGLFW, "glfwHideWindow", rb_glfwHideWindow, 1);
1097
+ rb_define_module_function1(rb_mGLFW, "glfwIconifyWindow", rb_glfwIconifyWindow, 1);
1098
+ rb_define_module_function0(rb_mGLFW, "glfwInit", rb_glfwInit, 0);
1099
+ rb_define_module_function2(rb_mGLFW, "glfwInitHint", rb_glfwInitHint, 2);
1100
+ rb_define_module_function1(rb_mGLFW, "glfwJoystickIsGamepad", rb_glfwJoystickIsGamepad, 1);
1101
+ rb_define_module_function1(rb_mGLFW, "glfwJoystickPresent", rb_glfwJoystickPresent, 1);
1102
+ rb_define_module_function1(rb_mGLFW, "glfwMakeContextCurrent", rb_glfwMakeContextCurrent, 1);
1103
+ rb_define_module_function1(rb_mGLFW, "glfwMaximizeWindow", rb_glfwMaximizeWindow, 1);
1104
+ rb_define_module_function0(rb_mGLFW, "glfwPollEvents", rb_glfwPollEvents, 0);
1105
+ rb_define_module_function0(rb_mGLFW, "glfwPostEmptyEvent", rb_glfwPostEmptyEvent, 0);
1106
+ rb_define_module_function0(rb_mGLFW, "glfwRawMouseMotionSupported", rb_glfwRawMouseMotionSupported, 0);
1107
+ rb_define_module_function1(rb_mGLFW, "glfwRequestWindowAttention", rb_glfwRequestWindowAttention, 1);
1108
+ rb_define_module_function1(rb_mGLFW, "glfwRestoreWindow", rb_glfwRestoreWindow, 1);
1109
+ rb_define_module_function1(rb_mGLFW, "glfwSetClipboardString", rb_glfwSetClipboardString, 1);
1110
+ rb_define_module_function2(rb_mGLFW, "glfwSetCursor", rb_glfwSetCursor, 2);
1111
+ rb_define_module_function2(rb_mGLFW, "glfwSetCursorPos", rb_glfwSetCursorPos, 2);
1112
+ rb_define_module_function2(rb_mGLFW, "glfwSetGamma", rb_glfwSetGamma, 2);
1113
+ rb_define_module_function2(rb_mGLFW, "glfwSetGammaRamp", rb_glfwSetGammaRamp, 2);
1114
+ rb_define_module_function3(rb_mGLFW, "glfwSetInputMode", rb_glfwSetInputMode, 3);
1115
+ rb_define_module_function1(rb_mGLFW, "glfwSetTime", rb_glfwSetTime, 1);
1116
+ rb_define_module_function3(rb_mGLFW, "glfwSetWindowAspectRatio", rb_glfwSetWindowAspectRatio, 3);
1117
+ rb_define_module_function3(rb_mGLFW, "glfwSetWindowAttrib", rb_glfwSetWindowAttrib, 3);
1118
+ rb_define_module_function2(rb_mGLFW, "glfwSetWindowIcon", rb_glfwSetWindowIcon, 2);
1119
+ rb_define_module_function7(rb_mGLFW, "glfwSetWindowMonitor", rb_glfwSetWindowMonitor, 7);
1120
+ rb_define_module_function2(rb_mGLFW, "glfwSetWindowOpacity", rb_glfwSetWindowOpacity, 2);
1121
+ rb_define_module_function2(rb_mGLFW, "glfwSetWindowPos", rb_glfwSetWindowPos, 2);
1122
+ rb_define_module_function2(rb_mGLFW, "glfwSetWindowShouldClose", rb_glfwSetWindowShouldClose, 2);
1123
+ rb_define_module_function2(rb_mGLFW, "glfwSetWindowSize", rb_glfwSetWindowSize, 2);
1124
+ rb_define_module_function5(rb_mGLFW, "glfwSetWindowSizeLimits", rb_glfwSetWindowSizeLimits, 5);
1125
+ rb_define_module_function2(rb_mGLFW, "glfwSetWindowTitle", rb_glfwSetWindowTitle, 2);
1126
+ rb_define_module_function1(rb_mGLFW, "glfwShowWindow", rb_glfwShowWindow, 1);
1127
+ rb_define_module_function1(rb_mGLFW, "glfwSwapBuffers", rb_glfwSwapBuffers, 1);
1128
+ rb_define_module_function1(rb_mGLFW, "glfwSwapInterval", rb_glfwSwapInterval, 1);
1129
+ rb_define_module_function0(rb_mGLFW, "glfwTerminate", rb_glfwTerminate, 0);
1130
+ rb_define_module_function1(rb_mGLFW, "glfwUpdateGamepadMappings", rb_glfwUpdateGamepadMappings, 1);
1131
+ rb_define_module_function0(rb_mGLFW, "glfwVulkanSupported", rb_glfwVulkanSupported, 0);
1132
+ rb_define_module_function0(rb_mGLFW, "glfwWaitEvents", rb_glfwWaitEvents, 0);
1133
+ rb_define_module_function1(rb_mGLFW, "glfwWaitEventsTimeout", rb_glfwWaitEventsTimeout, 1);
1134
+ rb_define_module_function2(rb_mGLFW, "glfwWindowHint", rb_glfwWindowHint, 2);
1135
+ rb_define_module_function2(rb_mGLFW, "glfwWindowHintString", rb_glfwWindowHintString, 2);
1136
+ rb_define_module_function1(rb_mGLFW, "glfwWindowShouldClose", rb_glfwWindowShouldClose, 1);
1137
+ rb_define_module_function1(rb_mGLFW, "glfwSetWindowPosCallback", rb_glfwSetWindowPosCallback, 1);
1138
+ rb_define_module_function1(rb_mGLFW, "glfwSetCursorPosCallback", rb_glfwSetCursorPosCallback, 1);
1139
+ rb_define_module_function1(rb_mGLFW, "glfwSetWindowSizeCallback", rb_glfwSetWindowSizeCallback, 1);
1140
+ rb_define_module_function1(rb_mGLFW, "glfwSetFramebufferSizeCallback", rb_glfwSetFramebufferSizeCallback, 1);
1141
+ rb_define_module_function1(rb_mGLFW, "glfwSetDropCallback", rb_glfwSetDropCallback, 1);
1142
+ rb_define_module_function1(rb_mGLFW, "glfwSetScrollCallback", rb_glfwSetScrollCallback, 1);
1143
+ rb_define_module_function1(rb_mGLFW, "glfwSetWindowFocusCallback", rb_glfwSetWindowFocusCallback, 1);
1144
+ rb_define_module_function1(rb_mGLFW, "glfwSetWindowIconifyCallback", rb_glfwSetWindowIconifyCallback, 1);
1145
+ rb_define_module_function1(rb_mGLFW, "glfwSetWindowMaximizeCallback", rb_glfwSetWindowMaximizeCallback, 1);
1146
+ rb_define_module_function1(rb_mGLFW, "glfwSetWindowCloseCallback", rb_glfwSetWindowCloseCallback, 1);
1147
+ rb_define_module_function1(rb_mGLFW, "glfwSetWindowContentScaleCallback", rb_glfwSetWindowContentScaleCallback, 1);
1148
+ rb_define_module_function1(rb_mGLFW, "glfwSetWindowRefreshCallback", rb_glfwSetWindowRefreshCallback, 1);
1149
+ rb_define_module_function1(rb_mGLFW, "glfwSetKeyCallback", rb_glfwSetKeyCallback, 1);
1150
+ rb_define_module_function1(rb_mGLFW, "glfwSetMouseButtonCallback", rb_glfwSetMouseButtonCallback, 1);
1151
+ rb_define_module_function1(rb_mGLFW, "glfwSetCharCallback", rb_glfwSetCharCallback, 1);
1152
+ rb_define_module_function1(rb_mGLFW, "glfwSetCursorEnterCallback", rb_glfwSetCursorEnterCallback, 1);
1153
+ rb_define_module_function0(rb_mGLFW, "glfwSetErrorCallback", rb_glfwSetErrorCallback, 0);
1154
+ rb_define_module_function0(rb_mGLFW, "glfwSetJoystickCallback", rb_glfwSetJoystickCallback, 0);
1155
+ rb_define_module_function0(rb_mGLFW, "glfwSetMonitorCallback", rb_glfwSetMonitorCallback, 0);
1156
+
1157
+ #pragma region Constants
1158
+
1159
+ rb_define_const(rb_mGLFW, "GLFW_VERSION_MAJOR", INT2NUM(GLFW_VERSION_MAJOR));
1160
+ rb_define_const(rb_mGLFW, "GLFW_VERSION_MINOR", INT2NUM(GLFW_VERSION_MINOR));
1161
+ rb_define_const(rb_mGLFW, "GLFW_VERSION_REVISION", INT2NUM(GLFW_VERSION_REVISION));
1162
+ rb_define_const(rb_mGLFW, "GLFW_TRUE", INT2NUM(GLFW_TRUE));
1163
+ rb_define_const(rb_mGLFW, "GLFW_FALSE", INT2NUM(GLFW_FALSE));
1164
+ rb_define_const(rb_mGLFW, "GLFW_RELEASE", INT2NUM(GLFW_RELEASE));
1165
+ rb_define_const(rb_mGLFW, "GLFW_PRESS", INT2NUM(GLFW_PRESS));
1166
+ rb_define_const(rb_mGLFW, "GLFW_REPEAT", INT2NUM(GLFW_REPEAT));
1167
+ rb_define_const(rb_mGLFW, "GLFW_HAT_CENTERED", INT2NUM(GLFW_HAT_CENTERED));
1168
+ rb_define_const(rb_mGLFW, "GLFW_HAT_UP", INT2NUM(GLFW_HAT_UP));
1169
+ rb_define_const(rb_mGLFW, "GLFW_HAT_RIGHT", INT2NUM(GLFW_HAT_RIGHT));
1170
+ rb_define_const(rb_mGLFW, "GLFW_HAT_DOWN", INT2NUM(GLFW_HAT_DOWN));
1171
+ rb_define_const(rb_mGLFW, "GLFW_HAT_LEFT", INT2NUM(GLFW_HAT_LEFT));
1172
+ rb_define_const(rb_mGLFW, "GLFW_HAT_RIGHT_UP", INT2NUM(GLFW_HAT_RIGHT_UP));
1173
+ rb_define_const(rb_mGLFW, "GLFW_HAT_RIGHT_DOWN", INT2NUM(GLFW_HAT_RIGHT_DOWN));
1174
+ rb_define_const(rb_mGLFW, "GLFW_HAT_LEFT_UP", INT2NUM(GLFW_HAT_LEFT_UP));
1175
+ rb_define_const(rb_mGLFW, "GLFW_HAT_LEFT_DOWN", INT2NUM(GLFW_HAT_LEFT_DOWN));
1176
+ rb_define_const(rb_mGLFW, "GLFW_KEY_UNKNOWN", INT2NUM(GLFW_KEY_UNKNOWN));
1177
+ rb_define_const(rb_mGLFW, "GLFW_KEY_SPACE", INT2NUM(GLFW_KEY_SPACE));
1178
+ rb_define_const(rb_mGLFW, "GLFW_KEY_APOSTROPHE", INT2NUM(GLFW_KEY_APOSTROPHE));
1179
+ rb_define_const(rb_mGLFW, "GLFW_KEY_COMMA", INT2NUM(GLFW_KEY_COMMA));
1180
+ rb_define_const(rb_mGLFW, "GLFW_KEY_MINUS", INT2NUM(GLFW_KEY_MINUS));
1181
+ rb_define_const(rb_mGLFW, "GLFW_KEY_PERIOD", INT2NUM(GLFW_KEY_PERIOD));
1182
+ rb_define_const(rb_mGLFW, "GLFW_KEY_SLASH", INT2NUM(GLFW_KEY_SLASH));
1183
+ rb_define_const(rb_mGLFW, "GLFW_KEY_0", INT2NUM(GLFW_KEY_0));
1184
+ rb_define_const(rb_mGLFW, "GLFW_KEY_1", INT2NUM(GLFW_KEY_1));
1185
+ rb_define_const(rb_mGLFW, "GLFW_KEY_2", INT2NUM(GLFW_KEY_2));
1186
+ rb_define_const(rb_mGLFW, "GLFW_KEY_3", INT2NUM(GLFW_KEY_3));
1187
+ rb_define_const(rb_mGLFW, "GLFW_KEY_4", INT2NUM(GLFW_KEY_4));
1188
+ rb_define_const(rb_mGLFW, "GLFW_KEY_5", INT2NUM(GLFW_KEY_5));
1189
+ rb_define_const(rb_mGLFW, "GLFW_KEY_6", INT2NUM(GLFW_KEY_6));
1190
+ rb_define_const(rb_mGLFW, "GLFW_KEY_7", INT2NUM(GLFW_KEY_7));
1191
+ rb_define_const(rb_mGLFW, "GLFW_KEY_8", INT2NUM(GLFW_KEY_8));
1192
+ rb_define_const(rb_mGLFW, "GLFW_KEY_9", INT2NUM(GLFW_KEY_9));
1193
+ rb_define_const(rb_mGLFW, "GLFW_KEY_SEMICOLON", INT2NUM(GLFW_KEY_SEMICOLON));
1194
+ rb_define_const(rb_mGLFW, "GLFW_KEY_EQUAL", INT2NUM(GLFW_KEY_EQUAL));
1195
+ rb_define_const(rb_mGLFW, "GLFW_KEY_A", INT2NUM(GLFW_KEY_A));
1196
+ rb_define_const(rb_mGLFW, "GLFW_KEY_B", INT2NUM(GLFW_KEY_B));
1197
+ rb_define_const(rb_mGLFW, "GLFW_KEY_C", INT2NUM(GLFW_KEY_C));
1198
+ rb_define_const(rb_mGLFW, "GLFW_KEY_D", INT2NUM(GLFW_KEY_D));
1199
+ rb_define_const(rb_mGLFW, "GLFW_KEY_E", INT2NUM(GLFW_KEY_E));
1200
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F", INT2NUM(GLFW_KEY_F));
1201
+ rb_define_const(rb_mGLFW, "GLFW_KEY_G", INT2NUM(GLFW_KEY_G));
1202
+ rb_define_const(rb_mGLFW, "GLFW_KEY_H", INT2NUM(GLFW_KEY_H));
1203
+ rb_define_const(rb_mGLFW, "GLFW_KEY_I", INT2NUM(GLFW_KEY_I));
1204
+ rb_define_const(rb_mGLFW, "GLFW_KEY_J", INT2NUM(GLFW_KEY_J));
1205
+ rb_define_const(rb_mGLFW, "GLFW_KEY_K", INT2NUM(GLFW_KEY_K));
1206
+ rb_define_const(rb_mGLFW, "GLFW_KEY_L", INT2NUM(GLFW_KEY_L));
1207
+ rb_define_const(rb_mGLFW, "GLFW_KEY_M", INT2NUM(GLFW_KEY_M));
1208
+ rb_define_const(rb_mGLFW, "GLFW_KEY_N", INT2NUM(GLFW_KEY_N));
1209
+ rb_define_const(rb_mGLFW, "GLFW_KEY_O", INT2NUM(GLFW_KEY_O));
1210
+ rb_define_const(rb_mGLFW, "GLFW_KEY_P", INT2NUM(GLFW_KEY_P));
1211
+ rb_define_const(rb_mGLFW, "GLFW_KEY_Q", INT2NUM(GLFW_KEY_Q));
1212
+ rb_define_const(rb_mGLFW, "GLFW_KEY_R", INT2NUM(GLFW_KEY_R));
1213
+ rb_define_const(rb_mGLFW, "GLFW_KEY_S", INT2NUM(GLFW_KEY_S));
1214
+ rb_define_const(rb_mGLFW, "GLFW_KEY_T", INT2NUM(GLFW_KEY_T));
1215
+ rb_define_const(rb_mGLFW, "GLFW_KEY_U", INT2NUM(GLFW_KEY_U));
1216
+ rb_define_const(rb_mGLFW, "GLFW_KEY_V", INT2NUM(GLFW_KEY_V));
1217
+ rb_define_const(rb_mGLFW, "GLFW_KEY_W", INT2NUM(GLFW_KEY_W));
1218
+ rb_define_const(rb_mGLFW, "GLFW_KEY_X", INT2NUM(GLFW_KEY_X));
1219
+ rb_define_const(rb_mGLFW, "GLFW_KEY_Y", INT2NUM(GLFW_KEY_Y));
1220
+ rb_define_const(rb_mGLFW, "GLFW_KEY_Z", INT2NUM(GLFW_KEY_Z));
1221
+ rb_define_const(rb_mGLFW, "GLFW_KEY_LEFT_BRACKET", INT2NUM(GLFW_KEY_LEFT_BRACKET));
1222
+ rb_define_const(rb_mGLFW, "GLFW_KEY_BACKSLASH", INT2NUM(GLFW_KEY_BACKSLASH));
1223
+ rb_define_const(rb_mGLFW, "GLFW_KEY_RIGHT_BRACKET", INT2NUM(GLFW_KEY_RIGHT_BRACKET));
1224
+ rb_define_const(rb_mGLFW, "GLFW_KEY_GRAVE_ACCENT", INT2NUM(GLFW_KEY_GRAVE_ACCENT));
1225
+ rb_define_const(rb_mGLFW, "GLFW_KEY_WORLD_1", INT2NUM(GLFW_KEY_WORLD_1));
1226
+ rb_define_const(rb_mGLFW, "GLFW_KEY_WORLD_2", INT2NUM(GLFW_KEY_WORLD_2));
1227
+ rb_define_const(rb_mGLFW, "GLFW_KEY_ESCAPE", INT2NUM(GLFW_KEY_ESCAPE));
1228
+ rb_define_const(rb_mGLFW, "GLFW_KEY_ENTER", INT2NUM(GLFW_KEY_ENTER));
1229
+ rb_define_const(rb_mGLFW, "GLFW_KEY_TAB", INT2NUM(GLFW_KEY_TAB));
1230
+ rb_define_const(rb_mGLFW, "GLFW_KEY_BACKSPACE", INT2NUM(GLFW_KEY_BACKSPACE));
1231
+ rb_define_const(rb_mGLFW, "GLFW_KEY_INSERT", INT2NUM(GLFW_KEY_INSERT));
1232
+ rb_define_const(rb_mGLFW, "GLFW_KEY_DELETE", INT2NUM(GLFW_KEY_DELETE));
1233
+ rb_define_const(rb_mGLFW, "GLFW_KEY_RIGHT", INT2NUM(GLFW_KEY_RIGHT));
1234
+ rb_define_const(rb_mGLFW, "GLFW_KEY_LEFT", INT2NUM(GLFW_KEY_LEFT));
1235
+ rb_define_const(rb_mGLFW, "GLFW_KEY_DOWN", INT2NUM(GLFW_KEY_DOWN));
1236
+ rb_define_const(rb_mGLFW, "GLFW_KEY_UP", INT2NUM(GLFW_KEY_UP));
1237
+ rb_define_const(rb_mGLFW, "GLFW_KEY_PAGE_UP", INT2NUM(GLFW_KEY_PAGE_UP));
1238
+ rb_define_const(rb_mGLFW, "GLFW_KEY_PAGE_DOWN", INT2NUM(GLFW_KEY_PAGE_DOWN));
1239
+ rb_define_const(rb_mGLFW, "GLFW_KEY_HOME", INT2NUM(GLFW_KEY_HOME));
1240
+ rb_define_const(rb_mGLFW, "GLFW_KEY_END", INT2NUM(GLFW_KEY_END));
1241
+ rb_define_const(rb_mGLFW, "GLFW_KEY_CAPS_LOCK", INT2NUM(GLFW_KEY_CAPS_LOCK));
1242
+ rb_define_const(rb_mGLFW, "GLFW_KEY_SCROLL_LOCK", INT2NUM(GLFW_KEY_SCROLL_LOCK));
1243
+ rb_define_const(rb_mGLFW, "GLFW_KEY_NUM_LOCK", INT2NUM(GLFW_KEY_NUM_LOCK));
1244
+ rb_define_const(rb_mGLFW, "GLFW_KEY_PRINT_SCREEN", INT2NUM(GLFW_KEY_PRINT_SCREEN));
1245
+ rb_define_const(rb_mGLFW, "GLFW_KEY_PAUSE", INT2NUM(GLFW_KEY_PAUSE));
1246
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F1", INT2NUM(GLFW_KEY_F1));
1247
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F2", INT2NUM(GLFW_KEY_F2));
1248
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F3", INT2NUM(GLFW_KEY_F3));
1249
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F4", INT2NUM(GLFW_KEY_F4));
1250
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F5", INT2NUM(GLFW_KEY_F5));
1251
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F6", INT2NUM(GLFW_KEY_F6));
1252
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F7", INT2NUM(GLFW_KEY_F7));
1253
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F8", INT2NUM(GLFW_KEY_F8));
1254
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F9", INT2NUM(GLFW_KEY_F9));
1255
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F10", INT2NUM(GLFW_KEY_F10));
1256
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F11", INT2NUM(GLFW_KEY_F11));
1257
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F12", INT2NUM(GLFW_KEY_F12));
1258
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F13", INT2NUM(GLFW_KEY_F13));
1259
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F14", INT2NUM(GLFW_KEY_F14));
1260
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F15", INT2NUM(GLFW_KEY_F15));
1261
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F16", INT2NUM(GLFW_KEY_F16));
1262
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F17", INT2NUM(GLFW_KEY_F17));
1263
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F18", INT2NUM(GLFW_KEY_F18));
1264
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F19", INT2NUM(GLFW_KEY_F19));
1265
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F20", INT2NUM(GLFW_KEY_F20));
1266
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F21", INT2NUM(GLFW_KEY_F21));
1267
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F22", INT2NUM(GLFW_KEY_F22));
1268
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F23", INT2NUM(GLFW_KEY_F23));
1269
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F24", INT2NUM(GLFW_KEY_F24));
1270
+ rb_define_const(rb_mGLFW, "GLFW_KEY_F25", INT2NUM(GLFW_KEY_F25));
1271
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_0", INT2NUM(GLFW_KEY_KP_0));
1272
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_1", INT2NUM(GLFW_KEY_KP_1));
1273
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_2", INT2NUM(GLFW_KEY_KP_2));
1274
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_3", INT2NUM(GLFW_KEY_KP_3));
1275
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_4", INT2NUM(GLFW_KEY_KP_4));
1276
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_5", INT2NUM(GLFW_KEY_KP_5));
1277
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_6", INT2NUM(GLFW_KEY_KP_6));
1278
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_7", INT2NUM(GLFW_KEY_KP_7));
1279
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_8", INT2NUM(GLFW_KEY_KP_8));
1280
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_9", INT2NUM(GLFW_KEY_KP_9));
1281
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_DECIMAL", INT2NUM(GLFW_KEY_KP_DECIMAL));
1282
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_DIVIDE", INT2NUM(GLFW_KEY_KP_DIVIDE));
1283
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_MULTIPLY", INT2NUM(GLFW_KEY_KP_MULTIPLY));
1284
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_SUBTRACT", INT2NUM(GLFW_KEY_KP_SUBTRACT));
1285
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_ADD", INT2NUM(GLFW_KEY_KP_ADD));
1286
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_ENTER", INT2NUM(GLFW_KEY_KP_ENTER));
1287
+ rb_define_const(rb_mGLFW, "GLFW_KEY_KP_EQUAL", INT2NUM(GLFW_KEY_KP_EQUAL));
1288
+ rb_define_const(rb_mGLFW, "GLFW_KEY_LEFT_SHIFT", INT2NUM(GLFW_KEY_LEFT_SHIFT));
1289
+ rb_define_const(rb_mGLFW, "GLFW_KEY_LEFT_CONTROL", INT2NUM(GLFW_KEY_LEFT_CONTROL));
1290
+ rb_define_const(rb_mGLFW, "GLFW_KEY_LEFT_ALT", INT2NUM(GLFW_KEY_LEFT_ALT));
1291
+ rb_define_const(rb_mGLFW, "GLFW_KEY_LEFT_SUPER", INT2NUM(GLFW_KEY_LEFT_SUPER));
1292
+ rb_define_const(rb_mGLFW, "GLFW_KEY_RIGHT_SHIFT", INT2NUM(GLFW_KEY_RIGHT_SHIFT));
1293
+ rb_define_const(rb_mGLFW, "GLFW_KEY_RIGHT_CONTROL", INT2NUM(GLFW_KEY_RIGHT_CONTROL));
1294
+ rb_define_const(rb_mGLFW, "GLFW_KEY_RIGHT_ALT", INT2NUM(GLFW_KEY_RIGHT_ALT));
1295
+ rb_define_const(rb_mGLFW, "GLFW_KEY_RIGHT_SUPER", INT2NUM(GLFW_KEY_RIGHT_SUPER));
1296
+ rb_define_const(rb_mGLFW, "GLFW_KEY_MENU", INT2NUM(GLFW_KEY_MENU));
1297
+ rb_define_const(rb_mGLFW, "GLFW_KEY_LAST", INT2NUM(GLFW_KEY_LAST));
1298
+ rb_define_const(rb_mGLFW, "GLFW_MOD_SHIFT", INT2NUM(GLFW_MOD_SHIFT));
1299
+ rb_define_const(rb_mGLFW, "GLFW_MOD_CONTROL", INT2NUM(GLFW_MOD_CONTROL));
1300
+ rb_define_const(rb_mGLFW, "GLFW_MOD_ALT", INT2NUM(GLFW_MOD_ALT));
1301
+ rb_define_const(rb_mGLFW, "GLFW_MOD_SUPER", INT2NUM(GLFW_MOD_SUPER));
1302
+ rb_define_const(rb_mGLFW, "GLFW_MOD_CAPS_LOCK", INT2NUM(GLFW_MOD_CAPS_LOCK));
1303
+ rb_define_const(rb_mGLFW, "GLFW_MOD_NUM_LOCK", INT2NUM(GLFW_MOD_NUM_LOCK));
1304
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_1", INT2NUM(GLFW_MOUSE_BUTTON_1));
1305
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_2", INT2NUM(GLFW_MOUSE_BUTTON_2));
1306
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_3", INT2NUM(GLFW_MOUSE_BUTTON_3));
1307
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_4", INT2NUM(GLFW_MOUSE_BUTTON_4));
1308
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_5", INT2NUM(GLFW_MOUSE_BUTTON_5));
1309
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_6", INT2NUM(GLFW_MOUSE_BUTTON_6));
1310
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_7", INT2NUM(GLFW_MOUSE_BUTTON_7));
1311
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_8", INT2NUM(GLFW_MOUSE_BUTTON_8));
1312
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_LAST", INT2NUM(GLFW_MOUSE_BUTTON_LAST));
1313
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_LEFT", INT2NUM(GLFW_MOUSE_BUTTON_LEFT));
1314
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_RIGHT", INT2NUM(GLFW_MOUSE_BUTTON_RIGHT));
1315
+ rb_define_const(rb_mGLFW, "GLFW_MOUSE_BUTTON_MIDDLE", INT2NUM(GLFW_MOUSE_BUTTON_MIDDLE));
1316
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_1", INT2NUM(GLFW_JOYSTICK_1));
1317
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_2", INT2NUM(GLFW_JOYSTICK_2));
1318
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_3", INT2NUM(GLFW_JOYSTICK_3));
1319
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_4", INT2NUM(GLFW_JOYSTICK_4));
1320
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_5", INT2NUM(GLFW_JOYSTICK_5));
1321
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_6", INT2NUM(GLFW_JOYSTICK_6));
1322
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_7", INT2NUM(GLFW_JOYSTICK_7));
1323
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_8", INT2NUM(GLFW_JOYSTICK_8));
1324
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_9", INT2NUM(GLFW_JOYSTICK_9));
1325
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_10", INT2NUM(GLFW_JOYSTICK_10));
1326
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_11", INT2NUM(GLFW_JOYSTICK_11));
1327
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_12", INT2NUM(GLFW_JOYSTICK_12));
1328
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_13", INT2NUM(GLFW_JOYSTICK_13));
1329
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_14", INT2NUM(GLFW_JOYSTICK_14));
1330
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_15", INT2NUM(GLFW_JOYSTICK_15));
1331
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_16", INT2NUM(GLFW_JOYSTICK_16));
1332
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_LAST", INT2NUM(GLFW_JOYSTICK_LAST));
1333
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_A", INT2NUM(GLFW_GAMEPAD_BUTTON_A));
1334
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_B", INT2NUM(GLFW_GAMEPAD_BUTTON_B));
1335
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_X", INT2NUM(GLFW_GAMEPAD_BUTTON_X));
1336
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_Y", INT2NUM(GLFW_GAMEPAD_BUTTON_Y));
1337
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_LEFT_BUMPER", INT2NUM(GLFW_GAMEPAD_BUTTON_LEFT_BUMPER));
1338
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER", INT2NUM(GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER));
1339
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_BACK", INT2NUM(GLFW_GAMEPAD_BUTTON_BACK));
1340
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_START", INT2NUM(GLFW_GAMEPAD_BUTTON_START));
1341
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_GUIDE", INT2NUM(GLFW_GAMEPAD_BUTTON_GUIDE));
1342
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_LEFT_THUMB", INT2NUM(GLFW_GAMEPAD_BUTTON_LEFT_THUMB));
1343
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_RIGHT_THUMB", INT2NUM(GLFW_GAMEPAD_BUTTON_RIGHT_THUMB));
1344
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_DPAD_UP", INT2NUM(GLFW_GAMEPAD_BUTTON_DPAD_UP));
1345
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_DPAD_RIGHT", INT2NUM(GLFW_GAMEPAD_BUTTON_DPAD_RIGHT));
1346
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_DPAD_DOWN", INT2NUM(GLFW_GAMEPAD_BUTTON_DPAD_DOWN));
1347
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_DPAD_LEFT", INT2NUM(GLFW_GAMEPAD_BUTTON_DPAD_LEFT));
1348
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_LAST", INT2NUM(GLFW_GAMEPAD_BUTTON_LAST));
1349
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_CROSS", INT2NUM(GLFW_GAMEPAD_BUTTON_CROSS));
1350
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_CIRCLE", INT2NUM(GLFW_GAMEPAD_BUTTON_CIRCLE));
1351
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_SQUARE", INT2NUM(GLFW_GAMEPAD_BUTTON_SQUARE));
1352
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_BUTTON_TRIANGLE", INT2NUM(GLFW_GAMEPAD_BUTTON_TRIANGLE));
1353
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_AXIS_LEFT_X", INT2NUM(GLFW_GAMEPAD_AXIS_LEFT_X));
1354
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_AXIS_LEFT_Y", INT2NUM(GLFW_GAMEPAD_AXIS_LEFT_Y));
1355
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_AXIS_RIGHT_X", INT2NUM(GLFW_GAMEPAD_AXIS_RIGHT_X));
1356
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_AXIS_RIGHT_Y", INT2NUM(GLFW_GAMEPAD_AXIS_RIGHT_Y));
1357
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_AXIS_LEFT_TRIGGER", INT2NUM(GLFW_GAMEPAD_AXIS_LEFT_TRIGGER));
1358
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER", INT2NUM(GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER));
1359
+ rb_define_const(rb_mGLFW, "GLFW_GAMEPAD_AXIS_LAST", INT2NUM(GLFW_GAMEPAD_AXIS_LAST));
1360
+ rb_define_const(rb_mGLFW, "GLFW_NO_ERROR", INT2NUM(GLFW_NO_ERROR));
1361
+ rb_define_const(rb_mGLFW, "GLFW_NOT_INITIALIZED", INT2NUM(GLFW_NOT_INITIALIZED));
1362
+ rb_define_const(rb_mGLFW, "GLFW_NO_CURRENT_CONTEXT", INT2NUM(GLFW_NO_CURRENT_CONTEXT));
1363
+ rb_define_const(rb_mGLFW, "GLFW_INVALID_ENUM", INT2NUM(GLFW_INVALID_ENUM));
1364
+ rb_define_const(rb_mGLFW, "GLFW_INVALID_VALUE", INT2NUM(GLFW_INVALID_VALUE));
1365
+ rb_define_const(rb_mGLFW, "GLFW_OUT_OF_MEMORY", INT2NUM(GLFW_OUT_OF_MEMORY));
1366
+ rb_define_const(rb_mGLFW, "GLFW_API_UNAVAILABLE", INT2NUM(GLFW_API_UNAVAILABLE));
1367
+ rb_define_const(rb_mGLFW, "GLFW_VERSION_UNAVAILABLE", INT2NUM(GLFW_VERSION_UNAVAILABLE));
1368
+ rb_define_const(rb_mGLFW, "GLFW_PLATFORM_ERROR", INT2NUM(GLFW_PLATFORM_ERROR));
1369
+ rb_define_const(rb_mGLFW, "GLFW_FORMAT_UNAVAILABLE", INT2NUM(GLFW_FORMAT_UNAVAILABLE));
1370
+ rb_define_const(rb_mGLFW, "GLFW_NO_WINDOW_CONTEXT", INT2NUM(GLFW_NO_WINDOW_CONTEXT));
1371
+ rb_define_const(rb_mGLFW, "GLFW_FOCUSED", INT2NUM(GLFW_FOCUSED));
1372
+ rb_define_const(rb_mGLFW, "GLFW_ICONIFIED", INT2NUM(GLFW_ICONIFIED));
1373
+ rb_define_const(rb_mGLFW, "GLFW_RESIZABLE", INT2NUM(GLFW_RESIZABLE));
1374
+ rb_define_const(rb_mGLFW, "GLFW_VISIBLE", INT2NUM(GLFW_VISIBLE));
1375
+ rb_define_const(rb_mGLFW, "GLFW_DECORATED", INT2NUM(GLFW_DECORATED));
1376
+ rb_define_const(rb_mGLFW, "GLFW_AUTO_ICONIFY", INT2NUM(GLFW_AUTO_ICONIFY));
1377
+ rb_define_const(rb_mGLFW, "GLFW_FLOATING", INT2NUM(GLFW_FLOATING));
1378
+ rb_define_const(rb_mGLFW, "GLFW_MAXIMIZED", INT2NUM(GLFW_MAXIMIZED));
1379
+ rb_define_const(rb_mGLFW, "GLFW_CENTER_CURSOR", INT2NUM(GLFW_CENTER_CURSOR));
1380
+ rb_define_const(rb_mGLFW, "GLFW_TRANSPARENT_FRAMEBUFFER", INT2NUM(GLFW_TRANSPARENT_FRAMEBUFFER));
1381
+ rb_define_const(rb_mGLFW, "GLFW_HOVERED", INT2NUM(GLFW_HOVERED));
1382
+ rb_define_const(rb_mGLFW, "GLFW_FOCUS_ON_SHOW", INT2NUM(GLFW_FOCUS_ON_SHOW));
1383
+ rb_define_const(rb_mGLFW, "GLFW_RED_BITS", INT2NUM(GLFW_RED_BITS));
1384
+ rb_define_const(rb_mGLFW, "GLFW_GREEN_BITS", INT2NUM(GLFW_GREEN_BITS));
1385
+ rb_define_const(rb_mGLFW, "GLFW_BLUE_BITS", INT2NUM(GLFW_BLUE_BITS));
1386
+ rb_define_const(rb_mGLFW, "GLFW_ALPHA_BITS", INT2NUM(GLFW_ALPHA_BITS));
1387
+ rb_define_const(rb_mGLFW, "GLFW_DEPTH_BITS", INT2NUM(GLFW_DEPTH_BITS));
1388
+ rb_define_const(rb_mGLFW, "GLFW_STENCIL_BITS", INT2NUM(GLFW_STENCIL_BITS));
1389
+ rb_define_const(rb_mGLFW, "GLFW_ACCUM_RED_BITS", INT2NUM(GLFW_ACCUM_RED_BITS));
1390
+ rb_define_const(rb_mGLFW, "GLFW_ACCUM_GREEN_BITS", INT2NUM(GLFW_ACCUM_GREEN_BITS));
1391
+ rb_define_const(rb_mGLFW, "GLFW_ACCUM_BLUE_BITS", INT2NUM(GLFW_ACCUM_BLUE_BITS));
1392
+ rb_define_const(rb_mGLFW, "GLFW_ACCUM_ALPHA_BITS", INT2NUM(GLFW_ACCUM_ALPHA_BITS));
1393
+ rb_define_const(rb_mGLFW, "GLFW_AUX_BUFFERS", INT2NUM(GLFW_AUX_BUFFERS));
1394
+ rb_define_const(rb_mGLFW, "GLFW_STEREO", INT2NUM(GLFW_STEREO));
1395
+ rb_define_const(rb_mGLFW, "GLFW_SAMPLES", INT2NUM(GLFW_SAMPLES));
1396
+ rb_define_const(rb_mGLFW, "GLFW_SRGB_CAPABLE", INT2NUM(GLFW_SRGB_CAPABLE));
1397
+ rb_define_const(rb_mGLFW, "GLFW_REFRESH_RATE", INT2NUM(GLFW_REFRESH_RATE));
1398
+ rb_define_const(rb_mGLFW, "GLFW_DOUBLEBUFFER", INT2NUM(GLFW_DOUBLEBUFFER));
1399
+ rb_define_const(rb_mGLFW, "GLFW_CLIENT_API", INT2NUM(GLFW_CLIENT_API));
1400
+ rb_define_const(rb_mGLFW, "GLFW_CONTEXT_VERSION_MAJOR", INT2NUM(GLFW_CONTEXT_VERSION_MAJOR));
1401
+ rb_define_const(rb_mGLFW, "GLFW_CONTEXT_VERSION_MINOR", INT2NUM(GLFW_CONTEXT_VERSION_MINOR));
1402
+ rb_define_const(rb_mGLFW, "GLFW_CONTEXT_REVISION", INT2NUM(GLFW_CONTEXT_REVISION));
1403
+ rb_define_const(rb_mGLFW, "GLFW_CONTEXT_ROBUSTNESS", INT2NUM(GLFW_CONTEXT_ROBUSTNESS));
1404
+ rb_define_const(rb_mGLFW, "GLFW_OPENGL_FORWARD_COMPAT", INT2NUM(GLFW_OPENGL_FORWARD_COMPAT));
1405
+ rb_define_const(rb_mGLFW, "GLFW_OPENGL_DEBUG_CONTEXT", INT2NUM(GLFW_OPENGL_DEBUG_CONTEXT));
1406
+ rb_define_const(rb_mGLFW, "GLFW_OPENGL_PROFILE", INT2NUM(GLFW_OPENGL_PROFILE));
1407
+ rb_define_const(rb_mGLFW, "GLFW_CONTEXT_RELEASE_BEHAVIOR", INT2NUM(GLFW_CONTEXT_RELEASE_BEHAVIOR));
1408
+ rb_define_const(rb_mGLFW, "GLFW_CONTEXT_NO_ERROR", INT2NUM(GLFW_CONTEXT_NO_ERROR));
1409
+ rb_define_const(rb_mGLFW, "GLFW_CONTEXT_CREATION_API", INT2NUM(GLFW_CONTEXT_CREATION_API));
1410
+ rb_define_const(rb_mGLFW, "GLFW_SCALE_TO_MONITOR", INT2NUM(GLFW_SCALE_TO_MONITOR));
1411
+ rb_define_const(rb_mGLFW, "GLFW_COCOA_RETINA_FRAMEBUFFER", INT2NUM(GLFW_COCOA_RETINA_FRAMEBUFFER));
1412
+ rb_define_const(rb_mGLFW, "GLFW_COCOA_FRAME_NAME", INT2NUM(GLFW_COCOA_FRAME_NAME));
1413
+ rb_define_const(rb_mGLFW, "GLFW_COCOA_GRAPHICS_SWITCHING", INT2NUM(GLFW_COCOA_GRAPHICS_SWITCHING));
1414
+ rb_define_const(rb_mGLFW, "GLFW_X11_CLASS_NAME", INT2NUM(GLFW_X11_CLASS_NAME));
1415
+ rb_define_const(rb_mGLFW, "GLFW_X11_INSTANCE_NAME", INT2NUM(GLFW_X11_INSTANCE_NAME));
1416
+ rb_define_const(rb_mGLFW, "GLFW_NO_API", INT2NUM(GLFW_NO_API));
1417
+ rb_define_const(rb_mGLFW, "GLFW_OPENGL_API", INT2NUM(GLFW_OPENGL_API));
1418
+ rb_define_const(rb_mGLFW, "GLFW_OPENGL_ES_API", INT2NUM(GLFW_OPENGL_ES_API));
1419
+ rb_define_const(rb_mGLFW, "GLFW_NO_ROBUSTNESS", INT2NUM(GLFW_NO_ROBUSTNESS));
1420
+ rb_define_const(rb_mGLFW, "GLFW_NO_RESET_NOTIFICATION", INT2NUM(GLFW_NO_RESET_NOTIFICATION));
1421
+ rb_define_const(rb_mGLFW, "GLFW_LOSE_CONTEXT_ON_RESET", INT2NUM(GLFW_LOSE_CONTEXT_ON_RESET));
1422
+ rb_define_const(rb_mGLFW, "GLFW_OPENGL_ANY_PROFILE", INT2NUM(GLFW_OPENGL_ANY_PROFILE));
1423
+ rb_define_const(rb_mGLFW, "GLFW_OPENGL_CORE_PROFILE", INT2NUM(GLFW_OPENGL_CORE_PROFILE));
1424
+ rb_define_const(rb_mGLFW, "GLFW_OPENGL_COMPAT_PROFILE", INT2NUM(GLFW_OPENGL_COMPAT_PROFILE));
1425
+ rb_define_const(rb_mGLFW, "GLFW_CURSOR", INT2NUM(GLFW_CURSOR));
1426
+ rb_define_const(rb_mGLFW, "GLFW_STICKY_KEYS", INT2NUM(GLFW_STICKY_KEYS));
1427
+ rb_define_const(rb_mGLFW, "GLFW_STICKY_MOUSE_BUTTONS", INT2NUM(GLFW_STICKY_MOUSE_BUTTONS));
1428
+ rb_define_const(rb_mGLFW, "GLFW_LOCK_KEY_MODS", INT2NUM(GLFW_LOCK_KEY_MODS));
1429
+ rb_define_const(rb_mGLFW, "GLFW_RAW_MOUSE_MOTION", INT2NUM(GLFW_RAW_MOUSE_MOTION));
1430
+ rb_define_const(rb_mGLFW, "GLFW_CURSOR_NORMAL", INT2NUM(GLFW_CURSOR_NORMAL));
1431
+ rb_define_const(rb_mGLFW, "GLFW_CURSOR_HIDDEN", INT2NUM(GLFW_CURSOR_HIDDEN));
1432
+ rb_define_const(rb_mGLFW, "GLFW_CURSOR_DISABLED", INT2NUM(GLFW_CURSOR_DISABLED));
1433
+ rb_define_const(rb_mGLFW, "GLFW_ANY_RELEASE_BEHAVIOR", INT2NUM(GLFW_ANY_RELEASE_BEHAVIOR));
1434
+ rb_define_const(rb_mGLFW, "GLFW_RELEASE_BEHAVIOR_FLUSH", INT2NUM(GLFW_RELEASE_BEHAVIOR_FLUSH));
1435
+ rb_define_const(rb_mGLFW, "GLFW_RELEASE_BEHAVIOR_NONE", INT2NUM(GLFW_RELEASE_BEHAVIOR_NONE));
1436
+ rb_define_const(rb_mGLFW, "GLFW_NATIVE_CONTEXT_API", INT2NUM(GLFW_NATIVE_CONTEXT_API));
1437
+ rb_define_const(rb_mGLFW, "GLFW_EGL_CONTEXT_API", INT2NUM(GLFW_EGL_CONTEXT_API));
1438
+ rb_define_const(rb_mGLFW, "GLFW_OSMESA_CONTEXT_API", INT2NUM(GLFW_OSMESA_CONTEXT_API));
1439
+ rb_define_const(rb_mGLFW, "GLFW_ARROW_CURSOR", INT2NUM(GLFW_ARROW_CURSOR));
1440
+ rb_define_const(rb_mGLFW, "GLFW_IBEAM_CURSOR", INT2NUM(GLFW_IBEAM_CURSOR));
1441
+ rb_define_const(rb_mGLFW, "GLFW_CROSSHAIR_CURSOR", INT2NUM(GLFW_CROSSHAIR_CURSOR));
1442
+ rb_define_const(rb_mGLFW, "GLFW_HAND_CURSOR", INT2NUM(GLFW_HAND_CURSOR));
1443
+ rb_define_const(rb_mGLFW, "GLFW_HRESIZE_CURSOR", INT2NUM(GLFW_HRESIZE_CURSOR));
1444
+ rb_define_const(rb_mGLFW, "GLFW_VRESIZE_CURSOR", INT2NUM(GLFW_VRESIZE_CURSOR));
1445
+ rb_define_const(rb_mGLFW, "GLFW_CONNECTED", INT2NUM(GLFW_CONNECTED));
1446
+ rb_define_const(rb_mGLFW, "GLFW_DISCONNECTED", INT2NUM(GLFW_DISCONNECTED));
1447
+ rb_define_const(rb_mGLFW, "GLFW_JOYSTICK_HAT_BUTTONS", INT2NUM(GLFW_JOYSTICK_HAT_BUTTONS));
1448
+ rb_define_const(rb_mGLFW, "GLFW_COCOA_CHDIR_RESOURCES", INT2NUM(GLFW_COCOA_CHDIR_RESOURCES));
1449
+ rb_define_const(rb_mGLFW, "GLFW_COCOA_MENUBAR", INT2NUM(GLFW_COCOA_MENUBAR));
1450
+ rb_define_const(rb_mGLFW, "GLFW_DONT_CARE", INT2NUM(GLFW_DONT_CARE));
1451
+
1452
+ #pragma endregion
1453
+ }