sdl3-bindings 1.0.0.beta.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/ChangeLog +159 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +132 -0
  5. data/lib/sdl3.rb +150 -0
  6. data/lib/sdl3_assert.rb +61 -0
  7. data/lib/sdl3_asyncio.rb +68 -0
  8. data/lib/sdl3_atomic.rb +64 -0
  9. data/lib/sdl3_audio.rb +120 -0
  10. data/lib/sdl3_bits.rb +38 -0
  11. data/lib/sdl3_blendmode.rb +63 -0
  12. data/lib/sdl3_camera.rb +67 -0
  13. data/lib/sdl3_clipboard.rb +49 -0
  14. data/lib/sdl3_cpuinfo.rb +55 -0
  15. data/lib/sdl3_dialog.rb +60 -0
  16. data/lib/sdl3_endian.rb +39 -0
  17. data/lib/sdl3_error.rb +41 -0
  18. data/lib/sdl3_events.rb +680 -0
  19. data/lib/sdl3_filesystem.rb +82 -0
  20. data/lib/sdl3_gamepad.rb +216 -0
  21. data/lib/sdl3_gpu.rb +836 -0
  22. data/lib/sdl3_guid.rb +44 -0
  23. data/lib/sdl3_haptic.rb +209 -0
  24. data/lib/sdl3_hidapi.rb +84 -0
  25. data/lib/sdl3_hints.rb +285 -0
  26. data/lib/sdl3_image.rb +108 -0
  27. data/lib/sdl3_init.rb +71 -0
  28. data/lib/sdl3_iostream.rb +115 -0
  29. data/lib/sdl3_joystick.rb +174 -0
  30. data/lib/sdl3_keyboard.rb +81 -0
  31. data/lib/sdl3_keycode.rb +310 -0
  32. data/lib/sdl3_loadso.rb +39 -0
  33. data/lib/sdl3_locale.rb +44 -0
  34. data/lib/sdl3_log.rb +85 -0
  35. data/lib/sdl3_messagebox.rb +88 -0
  36. data/lib/sdl3_misc.rb +37 -0
  37. data/lib/sdl3_mixer.rb +179 -0
  38. data/lib/sdl3_mouse.rb +90 -0
  39. data/lib/sdl3_mutex.rb +77 -0
  40. data/lib/sdl3_pen.rb +56 -0
  41. data/lib/sdl3_pixels.rb +296 -0
  42. data/lib/sdl3_platform.rb +37 -0
  43. data/lib/sdl3_power.rb +44 -0
  44. data/lib/sdl3_process.rb +65 -0
  45. data/lib/sdl3_properties.rb +67 -0
  46. data/lib/sdl3_rect.rb +98 -0
  47. data/lib/sdl3_render.rb +240 -0
  48. data/lib/sdl3_revision.rb +37 -0
  49. data/lib/sdl3_scancode.rb +286 -0
  50. data/lib/sdl3_sensor.rb +61 -0
  51. data/lib/sdl3_sound.rb +98 -0
  52. data/lib/sdl3_stdinc.rb +229 -0
  53. data/lib/sdl3_storage.rb +70 -0
  54. data/lib/sdl3_surface.rb +122 -0
  55. data/lib/sdl3_thread.rb +65 -0
  56. data/lib/sdl3_time.rb +66 -0
  57. data/lib/sdl3_timer.rb +54 -0
  58. data/lib/sdl3_touch.rb +56 -0
  59. data/lib/sdl3_tray.rb +66 -0
  60. data/lib/sdl3_ttf.rb +216 -0
  61. data/lib/sdl3_version.rb +41 -0
  62. data/lib/sdl3_video.rb +341 -0
  63. data/lib/sdl3_vulkan.rb +46 -0
  64. metadata +118 -0
@@ -0,0 +1,310 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ SDLK_EXTENDED_MASK = 1 << 29
14
+ SDLK_SCANCODE_MASK = 1 << 30
15
+ SDLK_UNKNOWN = 0x00000000
16
+ SDLK_RETURN = 0x0000000d
17
+ SDLK_ESCAPE = 0x0000001b
18
+ SDLK_BACKSPACE = 0x00000008
19
+ SDLK_TAB = 0x00000009
20
+ SDLK_SPACE = 0x00000020
21
+ SDLK_EXCLAIM = 0x00000021
22
+ SDLK_DBLAPOSTROPHE = 0x00000022
23
+ SDLK_HASH = 0x00000023
24
+ SDLK_DOLLAR = 0x00000024
25
+ SDLK_PERCENT = 0x00000025
26
+ SDLK_AMPERSAND = 0x00000026
27
+ SDLK_APOSTROPHE = 0x00000027
28
+ SDLK_LEFTPAREN = 0x00000028
29
+ SDLK_RIGHTPAREN = 0x00000029
30
+ SDLK_ASTERISK = 0x0000002a
31
+ SDLK_PLUS = 0x0000002b
32
+ SDLK_COMMA = 0x0000002c
33
+ SDLK_MINUS = 0x0000002d
34
+ SDLK_PERIOD = 0x0000002e
35
+ SDLK_SLASH = 0x0000002f
36
+ SDLK_0 = 0x00000030
37
+ SDLK_1 = 0x00000031
38
+ SDLK_2 = 0x00000032
39
+ SDLK_3 = 0x00000033
40
+ SDLK_4 = 0x00000034
41
+ SDLK_5 = 0x00000035
42
+ SDLK_6 = 0x00000036
43
+ SDLK_7 = 0x00000037
44
+ SDLK_8 = 0x00000038
45
+ SDLK_9 = 0x00000039
46
+ SDLK_COLON = 0x0000003a
47
+ SDLK_SEMICOLON = 0x0000003b
48
+ SDLK_LESS = 0x0000003c
49
+ SDLK_EQUALS = 0x0000003d
50
+ SDLK_GREATER = 0x0000003e
51
+ SDLK_QUESTION = 0x0000003f
52
+ SDLK_AT = 0x00000040
53
+ SDLK_LEFTBRACKET = 0x0000005b
54
+ SDLK_BACKSLASH = 0x0000005c
55
+ SDLK_RIGHTBRACKET = 0x0000005d
56
+ SDLK_CARET = 0x0000005e
57
+ SDLK_UNDERSCORE = 0x0000005f
58
+ SDLK_GRAVE = 0x00000060
59
+ SDLK_A = 0x00000061
60
+ SDLK_B = 0x00000062
61
+ SDLK_C = 0x00000063
62
+ SDLK_D = 0x00000064
63
+ SDLK_E = 0x00000065
64
+ SDLK_F = 0x00000066
65
+ SDLK_G = 0x00000067
66
+ SDLK_H = 0x00000068
67
+ SDLK_I = 0x00000069
68
+ SDLK_J = 0x0000006a
69
+ SDLK_K = 0x0000006b
70
+ SDLK_L = 0x0000006c
71
+ SDLK_M = 0x0000006d
72
+ SDLK_N = 0x0000006e
73
+ SDLK_O = 0x0000006f
74
+ SDLK_P = 0x00000070
75
+ SDLK_Q = 0x00000071
76
+ SDLK_R = 0x00000072
77
+ SDLK_S = 0x00000073
78
+ SDLK_T = 0x00000074
79
+ SDLK_U = 0x00000075
80
+ SDLK_V = 0x00000076
81
+ SDLK_W = 0x00000077
82
+ SDLK_X = 0x00000078
83
+ SDLK_Y = 0x00000079
84
+ SDLK_Z = 0x0000007a
85
+ SDLK_LEFTBRACE = 0x0000007b
86
+ SDLK_PIPE = 0x0000007c
87
+ SDLK_RIGHTBRACE = 0x0000007d
88
+ SDLK_TILDE = 0x0000007e
89
+ SDLK_DELETE = 0x0000007f
90
+ SDLK_PLUSMINUS = 0x000000b1
91
+ SDLK_CAPSLOCK = 0x40000039
92
+ SDLK_F1 = 0x4000003a
93
+ SDLK_F2 = 0x4000003b
94
+ SDLK_F3 = 0x4000003c
95
+ SDLK_F4 = 0x4000003d
96
+ SDLK_F5 = 0x4000003e
97
+ SDLK_F6 = 0x4000003f
98
+ SDLK_F7 = 0x40000040
99
+ SDLK_F8 = 0x40000041
100
+ SDLK_F9 = 0x40000042
101
+ SDLK_F10 = 0x40000043
102
+ SDLK_F11 = 0x40000044
103
+ SDLK_F12 = 0x40000045
104
+ SDLK_PRINTSCREEN = 0x40000046
105
+ SDLK_SCROLLLOCK = 0x40000047
106
+ SDLK_PAUSE = 0x40000048
107
+ SDLK_INSERT = 0x40000049
108
+ SDLK_HOME = 0x4000004a
109
+ SDLK_PAGEUP = 0x4000004b
110
+ SDLK_END = 0x4000004d
111
+ SDLK_PAGEDOWN = 0x4000004e
112
+ SDLK_RIGHT = 0x4000004f
113
+ SDLK_LEFT = 0x40000050
114
+ SDLK_DOWN = 0x40000051
115
+ SDLK_UP = 0x40000052
116
+ SDLK_NUMLOCKCLEAR = 0x40000053
117
+ SDLK_KP_DIVIDE = 0x40000054
118
+ SDLK_KP_MULTIPLY = 0x40000055
119
+ SDLK_KP_MINUS = 0x40000056
120
+ SDLK_KP_PLUS = 0x40000057
121
+ SDLK_KP_ENTER = 0x40000058
122
+ SDLK_KP_1 = 0x40000059
123
+ SDLK_KP_2 = 0x4000005a
124
+ SDLK_KP_3 = 0x4000005b
125
+ SDLK_KP_4 = 0x4000005c
126
+ SDLK_KP_5 = 0x4000005d
127
+ SDLK_KP_6 = 0x4000005e
128
+ SDLK_KP_7 = 0x4000005f
129
+ SDLK_KP_8 = 0x40000060
130
+ SDLK_KP_9 = 0x40000061
131
+ SDLK_KP_0 = 0x40000062
132
+ SDLK_KP_PERIOD = 0x40000063
133
+ SDLK_APPLICATION = 0x40000065
134
+ SDLK_POWER = 0x40000066
135
+ SDLK_KP_EQUALS = 0x40000067
136
+ SDLK_F13 = 0x40000068
137
+ SDLK_F14 = 0x40000069
138
+ SDLK_F15 = 0x4000006a
139
+ SDLK_F16 = 0x4000006b
140
+ SDLK_F17 = 0x4000006c
141
+ SDLK_F18 = 0x4000006d
142
+ SDLK_F19 = 0x4000006e
143
+ SDLK_F20 = 0x4000006f
144
+ SDLK_F21 = 0x40000070
145
+ SDLK_F22 = 0x40000071
146
+ SDLK_F23 = 0x40000072
147
+ SDLK_F24 = 0x40000073
148
+ SDLK_EXECUTE = 0x40000074
149
+ SDLK_HELP = 0x40000075
150
+ SDLK_MENU = 0x40000076
151
+ SDLK_SELECT = 0x40000077
152
+ SDLK_STOP = 0x40000078
153
+ SDLK_AGAIN = 0x40000079
154
+ SDLK_UNDO = 0x4000007a
155
+ SDLK_CUT = 0x4000007b
156
+ SDLK_COPY = 0x4000007c
157
+ SDLK_PASTE = 0x4000007d
158
+ SDLK_FIND = 0x4000007e
159
+ SDLK_MUTE = 0x4000007f
160
+ SDLK_VOLUMEUP = 0x40000080
161
+ SDLK_VOLUMEDOWN = 0x40000081
162
+ SDLK_KP_COMMA = 0x40000085
163
+ SDLK_KP_EQUALSAS400 = 0x40000086
164
+ SDLK_ALTERASE = 0x40000099
165
+ SDLK_SYSREQ = 0x4000009a
166
+ SDLK_CANCEL = 0x4000009b
167
+ SDLK_CLEAR = 0x4000009c
168
+ SDLK_PRIOR = 0x4000009d
169
+ SDLK_RETURN2 = 0x4000009e
170
+ SDLK_SEPARATOR = 0x4000009f
171
+ SDLK_OUT = 0x400000a0
172
+ SDLK_OPER = 0x400000a1
173
+ SDLK_CLEARAGAIN = 0x400000a2
174
+ SDLK_CRSEL = 0x400000a3
175
+ SDLK_EXSEL = 0x400000a4
176
+ SDLK_KP_00 = 0x400000b0
177
+ SDLK_KP_000 = 0x400000b1
178
+ SDLK_THOUSANDSSEPARATOR = 0x400000b2
179
+ SDLK_DECIMALSEPARATOR = 0x400000b3
180
+ SDLK_CURRENCYUNIT = 0x400000b4
181
+ SDLK_CURRENCYSUBUNIT = 0x400000b5
182
+ SDLK_KP_LEFTPAREN = 0x400000b6
183
+ SDLK_KP_RIGHTPAREN = 0x400000b7
184
+ SDLK_KP_LEFTBRACE = 0x400000b8
185
+ SDLK_KP_RIGHTBRACE = 0x400000b9
186
+ SDLK_KP_TAB = 0x400000ba
187
+ SDLK_KP_BACKSPACE = 0x400000bb
188
+ SDLK_KP_A = 0x400000bc
189
+ SDLK_KP_B = 0x400000bd
190
+ SDLK_KP_C = 0x400000be
191
+ SDLK_KP_D = 0x400000bf
192
+ SDLK_KP_E = 0x400000c0
193
+ SDLK_KP_F = 0x400000c1
194
+ SDLK_KP_XOR = 0x400000c2
195
+ SDLK_KP_POWER = 0x400000c3
196
+ SDLK_KP_PERCENT = 0x400000c4
197
+ SDLK_KP_LESS = 0x400000c5
198
+ SDLK_KP_GREATER = 0x400000c6
199
+ SDLK_KP_AMPERSAND = 0x400000c7
200
+ SDLK_KP_DBLAMPERSAND = 0x400000c8
201
+ SDLK_KP_VERTICALBAR = 0x400000c9
202
+ SDLK_KP_DBLVERTICALBAR = 0x400000ca
203
+ SDLK_KP_COLON = 0x400000cb
204
+ SDLK_KP_HASH = 0x400000cc
205
+ SDLK_KP_SPACE = 0x400000cd
206
+ SDLK_KP_AT = 0x400000ce
207
+ SDLK_KP_EXCLAM = 0x400000cf
208
+ SDLK_KP_MEMSTORE = 0x400000d0
209
+ SDLK_KP_MEMRECALL = 0x400000d1
210
+ SDLK_KP_MEMCLEAR = 0x400000d2
211
+ SDLK_KP_MEMADD = 0x400000d3
212
+ SDLK_KP_MEMSUBTRACT = 0x400000d4
213
+ SDLK_KP_MEMMULTIPLY = 0x400000d5
214
+ SDLK_KP_MEMDIVIDE = 0x400000d6
215
+ SDLK_KP_PLUSMINUS = 0x400000d7
216
+ SDLK_KP_CLEAR = 0x400000d8
217
+ SDLK_KP_CLEARENTRY = 0x400000d9
218
+ SDLK_KP_BINARY = 0x400000da
219
+ SDLK_KP_OCTAL = 0x400000db
220
+ SDLK_KP_DECIMAL = 0x400000dc
221
+ SDLK_KP_HEXADECIMAL = 0x400000dd
222
+ SDLK_LCTRL = 0x400000e0
223
+ SDLK_LSHIFT = 0x400000e1
224
+ SDLK_LALT = 0x400000e2
225
+ SDLK_LGUI = 0x400000e3
226
+ SDLK_RCTRL = 0x400000e4
227
+ SDLK_RSHIFT = 0x400000e5
228
+ SDLK_RALT = 0x400000e6
229
+ SDLK_RGUI = 0x400000e7
230
+ SDLK_MODE = 0x40000101
231
+ SDLK_SLEEP = 0x40000102
232
+ SDLK_WAKE = 0x40000103
233
+ SDLK_CHANNEL_INCREMENT = 0x40000104
234
+ SDLK_CHANNEL_DECREMENT = 0x40000105
235
+ SDLK_MEDIA_PLAY = 0x40000106
236
+ SDLK_MEDIA_PAUSE = 0x40000107
237
+ SDLK_MEDIA_RECORD = 0x40000108
238
+ SDLK_MEDIA_FAST_FORWARD = 0x40000109
239
+ SDLK_MEDIA_REWIND = 0x4000010a
240
+ SDLK_MEDIA_NEXT_TRACK = 0x4000010b
241
+ SDLK_MEDIA_PREVIOUS_TRACK = 0x4000010c
242
+ SDLK_MEDIA_STOP = 0x4000010d
243
+ SDLK_MEDIA_EJECT = 0x4000010e
244
+ SDLK_MEDIA_PLAY_PAUSE = 0x4000010f
245
+ SDLK_MEDIA_SELECT = 0x40000110
246
+ SDLK_AC_NEW = 0x40000111
247
+ SDLK_AC_OPEN = 0x40000112
248
+ SDLK_AC_CLOSE = 0x40000113
249
+ SDLK_AC_EXIT = 0x40000114
250
+ SDLK_AC_SAVE = 0x40000115
251
+ SDLK_AC_PRINT = 0x40000116
252
+ SDLK_AC_PROPERTIES = 0x40000117
253
+ SDLK_AC_SEARCH = 0x40000118
254
+ SDLK_AC_HOME = 0x40000119
255
+ SDLK_AC_BACK = 0x4000011a
256
+ SDLK_AC_FORWARD = 0x4000011b
257
+ SDLK_AC_STOP = 0x4000011c
258
+ SDLK_AC_REFRESH = 0x4000011d
259
+ SDLK_AC_BOOKMARKS = 0x4000011e
260
+ SDLK_SOFTLEFT = 0x4000011f
261
+ SDLK_SOFTRIGHT = 0x40000120
262
+ SDLK_CALL = 0x40000121
263
+ SDLK_ENDCALL = 0x40000122
264
+ SDLK_LEFT_TAB = 0x20000001
265
+ SDLK_LEVEL5_SHIFT = 0x20000002
266
+ SDLK_MULTI_KEY_COMPOSE = 0x20000003
267
+ SDLK_LMETA = 0x20000004
268
+ SDLK_RMETA = 0x20000005
269
+ SDLK_LHYPER = 0x20000006
270
+ SDLK_RHYPER = 0x20000007
271
+ KMOD_NONE = 0x0000
272
+ KMOD_LSHIFT = 0x0001
273
+ KMOD_RSHIFT = 0x0002
274
+ KMOD_LEVEL5 = 0x0004
275
+ KMOD_LCTRL = 0x0040
276
+ KMOD_RCTRL = 0x0080
277
+ KMOD_LALT = 0x0100
278
+ KMOD_RALT = 0x0200
279
+ KMOD_LGUI = 0x0400
280
+ KMOD_RGUI = 0x0800
281
+ KMOD_NUM = 0x1000
282
+ KMOD_CAPS = 0x2000
283
+ KMOD_MODE = 0x4000
284
+ KMOD_SCROLL = 0x8000
285
+
286
+ # Enum
287
+
288
+
289
+ # Typedef
290
+
291
+ typedef :uint, :SDL_Keycode
292
+ typedef :ushort, :SDL_Keymod
293
+
294
+ # Struct
295
+
296
+
297
+ # Function
298
+
299
+ def self.setup_keycode_symbols(output_error = false)
300
+ entries = [
301
+ ]
302
+ entries.each do |entry|
303
+ attach_function entry[0], entry[1], entry[2], entry[3]
304
+ rescue FFI::NotFoundError => e
305
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
306
+ end
307
+ end
308
+
309
+ end
310
+
@@ -0,0 +1,39 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+
23
+ # Function
24
+
25
+ def self.setup_loadso_symbols(output_error = false)
26
+ entries = [
27
+ [:LoadObject, :SDL_LoadObject, [:pointer], :pointer],
28
+ [:LoadFunction, :SDL_LoadFunction, [:pointer, :pointer], :pointer],
29
+ [:UnloadObject, :SDL_UnloadObject, [:pointer], :void],
30
+ ]
31
+ entries.each do |entry|
32
+ attach_function entry[0], entry[1], entry[2], entry[3]
33
+ rescue FFI::NotFoundError => e
34
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
35
+ end
36
+ end
37
+
38
+ end
39
+
@@ -0,0 +1,44 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+ class Locale < FFI::Struct
23
+ layout(
24
+ :language, :pointer,
25
+ :country, :pointer,
26
+ )
27
+ end
28
+
29
+
30
+ # Function
31
+
32
+ def self.setup_locale_symbols(output_error = false)
33
+ entries = [
34
+ [:GetPreferredLocales, :SDL_GetPreferredLocales, [:pointer], :pointer],
35
+ ]
36
+ entries.each do |entry|
37
+ attach_function entry[0], entry[1], entry[2], entry[3]
38
+ rescue FFI::NotFoundError => e
39
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
40
+ end
41
+ end
42
+
43
+ end
44
+
data/lib/sdl3_log.rb ADDED
@@ -0,0 +1,85 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+ LOG_CATEGORY_APPLICATION = 0
17
+ LOG_CATEGORY_ERROR = 1
18
+ LOG_CATEGORY_ASSERT = 2
19
+ LOG_CATEGORY_SYSTEM = 3
20
+ LOG_CATEGORY_AUDIO = 4
21
+ LOG_CATEGORY_VIDEO = 5
22
+ LOG_CATEGORY_RENDER = 6
23
+ LOG_CATEGORY_INPUT = 7
24
+ LOG_CATEGORY_TEST = 8
25
+ LOG_CATEGORY_GPU = 9
26
+ LOG_CATEGORY_RESERVED2 = 10
27
+ LOG_CATEGORY_RESERVED3 = 11
28
+ LOG_CATEGORY_RESERVED4 = 12
29
+ LOG_CATEGORY_RESERVED5 = 13
30
+ LOG_CATEGORY_RESERVED6 = 14
31
+ LOG_CATEGORY_RESERVED7 = 15
32
+ LOG_CATEGORY_RESERVED8 = 16
33
+ LOG_CATEGORY_RESERVED9 = 17
34
+ LOG_CATEGORY_RESERVED10 = 18
35
+ LOG_CATEGORY_CUSTOM = 19
36
+ LOG_PRIORITY_INVALID = 0
37
+ LOG_PRIORITY_TRACE = 1
38
+ LOG_PRIORITY_VERBOSE = 2
39
+ LOG_PRIORITY_DEBUG = 3
40
+ LOG_PRIORITY_INFO = 4
41
+ LOG_PRIORITY_WARN = 5
42
+ LOG_PRIORITY_ERROR = 6
43
+ LOG_PRIORITY_CRITICAL = 7
44
+ LOG_PRIORITY_COUNT = 8
45
+
46
+ # Typedef
47
+
48
+ typedef :int, :SDL_LogCategory
49
+ typedef :int, :SDL_LogPriority
50
+ callback :SDL_LogOutputFunction, [:pointer, :int, :int, :pointer], :void
51
+
52
+ # Struct
53
+
54
+
55
+ # Function
56
+
57
+ def self.setup_log_symbols(output_error = false)
58
+ entries = [
59
+ [:SetLogPriorities, :SDL_SetLogPriorities, [:int], :void],
60
+ [:SetLogPriority, :SDL_SetLogPriority, [:int, :int], :void],
61
+ [:GetLogPriority, :SDL_GetLogPriority, [:int], :int],
62
+ [:ResetLogPriorities, :SDL_ResetLogPriorities, [], :void],
63
+ [:SetLogPriorityPrefix, :SDL_SetLogPriorityPrefix, [:int, :pointer], :bool],
64
+ [:Log, :SDL_Log, [:pointer], :void],
65
+ [:LogTrace, :SDL_LogTrace, [:int, :pointer], :void],
66
+ [:LogVerbose, :SDL_LogVerbose, [:int, :pointer], :void],
67
+ [:LogDebug, :SDL_LogDebug, [:int, :pointer], :void],
68
+ [:LogInfo, :SDL_LogInfo, [:int, :pointer], :void],
69
+ [:LogWarn, :SDL_LogWarn, [:int, :pointer], :void],
70
+ [:LogError, :SDL_LogError, [:int, :pointer], :void],
71
+ [:LogCritical, :SDL_LogCritical, [:int, :pointer], :void],
72
+ [:LogMessage, :SDL_LogMessage, [:int, :int, :pointer], :void],
73
+ [:GetDefaultLogOutputFunction, :SDL_GetDefaultLogOutputFunction, [], :pointer],
74
+ [:GetLogOutputFunction, :SDL_GetLogOutputFunction, [:pointer, :pointer], :void],
75
+ [:SetLogOutputFunction, :SDL_SetLogOutputFunction, [:SDL_LogOutputFunction, :pointer], :void],
76
+ ]
77
+ entries.each do |entry|
78
+ attach_function entry[0], entry[1], entry[2], entry[3]
79
+ rescue FFI::NotFoundError => e
80
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
81
+ end
82
+ end
83
+
84
+ end
85
+
@@ -0,0 +1,88 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ MESSAGEBOX_ERROR = 0x00000010
14
+ MESSAGEBOX_WARNING = 0x00000020
15
+ MESSAGEBOX_INFORMATION = 0x00000040
16
+ MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080
17
+ MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100
18
+ MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001
19
+ MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002
20
+
21
+ # Enum
22
+
23
+ MESSAGEBOX_COLOR_BACKGROUND = 0
24
+ MESSAGEBOX_COLOR_TEXT = 1
25
+ MESSAGEBOX_COLOR_BUTTON_BORDER = 2
26
+ MESSAGEBOX_COLOR_BUTTON_BACKGROUND = 3
27
+ MESSAGEBOX_COLOR_BUTTON_SELECTED = 4
28
+ MESSAGEBOX_COLOR_COUNT = 5
29
+
30
+ # Typedef
31
+
32
+ typedef :uint, :SDL_MessageBoxFlags
33
+ typedef :uint, :SDL_MessageBoxButtonFlags
34
+ typedef :int, :SDL_MessageBoxColorType
35
+
36
+ # Struct
37
+
38
+ class MessageBoxButtonData < FFI::Struct
39
+ layout(
40
+ :flags, :uint,
41
+ :buttonID, :int,
42
+ :text, :pointer,
43
+ )
44
+ end
45
+
46
+ class MessageBoxColor < FFI::Struct
47
+ layout(
48
+ :r, :uchar,
49
+ :g, :uchar,
50
+ :b, :uchar,
51
+ )
52
+ end
53
+
54
+ class MessageBoxColorScheme < FFI::Struct
55
+ layout(
56
+ :colors, [MessageBoxColor, 5],
57
+ )
58
+ end
59
+
60
+ class MessageBoxData < FFI::Struct
61
+ layout(
62
+ :flags, :uint,
63
+ :window, :pointer,
64
+ :title, :pointer,
65
+ :message, :pointer,
66
+ :numbuttons, :int,
67
+ :buttons, :pointer,
68
+ :colorScheme, :pointer,
69
+ )
70
+ end
71
+
72
+
73
+ # Function
74
+
75
+ def self.setup_messagebox_symbols(output_error = false)
76
+ entries = [
77
+ [:ShowMessageBox, :SDL_ShowMessageBox, [:pointer, :pointer], :bool],
78
+ [:ShowSimpleMessageBox, :SDL_ShowSimpleMessageBox, [:uint, :pointer, :pointer, :pointer], :bool],
79
+ ]
80
+ entries.each do |entry|
81
+ attach_function entry[0], entry[1], entry[2], entry[3]
82
+ rescue FFI::NotFoundError => e
83
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
84
+ end
85
+ end
86
+
87
+ end
88
+
data/lib/sdl3_misc.rb ADDED
@@ -0,0 +1,37 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+
23
+ # Function
24
+
25
+ def self.setup_misc_symbols(output_error = false)
26
+ entries = [
27
+ [:OpenURL, :SDL_OpenURL, [:pointer], :bool],
28
+ ]
29
+ entries.each do |entry|
30
+ attach_function entry[0], entry[1], entry[2], entry[3]
31
+ rescue FFI::NotFoundError => e
32
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
33
+ end
34
+ end
35
+
36
+ end
37
+