sdl3-bindings 1.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
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,82 @@
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
+ GLOB_CASEINSENSITIVE = 1 << 0
14
+
15
+ # Enum
16
+
17
+ FOLDER_HOME = 0
18
+ FOLDER_DESKTOP = 1
19
+ FOLDER_DOCUMENTS = 2
20
+ FOLDER_DOWNLOADS = 3
21
+ FOLDER_MUSIC = 4
22
+ FOLDER_PICTURES = 5
23
+ FOLDER_PUBLICSHARE = 6
24
+ FOLDER_SAVEDGAMES = 7
25
+ FOLDER_SCREENSHOTS = 8
26
+ FOLDER_TEMPLATES = 9
27
+ FOLDER_VIDEOS = 10
28
+ FOLDER_COUNT = 11
29
+ PATHTYPE_NONE = 0
30
+ PATHTYPE_FILE = 1
31
+ PATHTYPE_DIRECTORY = 2
32
+ PATHTYPE_OTHER = 3
33
+ ENUM_CONTINUE = 0
34
+ ENUM_SUCCESS = 1
35
+ ENUM_FAILURE = 2
36
+
37
+ # Typedef
38
+
39
+ typedef :int, :SDL_Folder
40
+ typedef :int, :SDL_PathType
41
+ typedef :uint, :SDL_GlobFlags
42
+ typedef :int, :SDL_EnumerationResult
43
+ callback :SDL_EnumerateDirectoryCallback, [:pointer, :pointer, :pointer], :int
44
+
45
+ # Struct
46
+
47
+ class PathInfo < FFI::Struct
48
+ layout(
49
+ :type, :int,
50
+ :size, :ulong_long,
51
+ :create_time, :long_long,
52
+ :modify_time, :long_long,
53
+ :access_time, :long_long,
54
+ )
55
+ end
56
+
57
+
58
+ # Function
59
+
60
+ def self.setup_filesystem_symbols(output_error = false)
61
+ entries = [
62
+ [:GetBasePath, :SDL_GetBasePath, [], :pointer],
63
+ [:GetPrefPath, :SDL_GetPrefPath, [:pointer, :pointer], :pointer],
64
+ [:GetUserFolder, :SDL_GetUserFolder, [:int], :pointer],
65
+ [:CreateDirectory, :SDL_CreateDirectory, [:pointer], :bool],
66
+ [:EnumerateDirectory, :SDL_EnumerateDirectory, [:pointer, :SDL_EnumerateDirectoryCallback, :pointer], :bool],
67
+ [:RemovePath, :SDL_RemovePath, [:pointer], :bool],
68
+ [:RenamePath, :SDL_RenamePath, [:pointer, :pointer], :bool],
69
+ [:CopyFile, :SDL_CopyFile, [:pointer, :pointer], :bool],
70
+ [:GetPathInfo, :SDL_GetPathInfo, [:pointer, :pointer], :bool],
71
+ [:GlobDirectory, :SDL_GlobDirectory, [:pointer, :pointer, :uint, :pointer], :pointer],
72
+ [:GetCurrentDirectory, :SDL_GetCurrentDirectory, [], :pointer],
73
+ ]
74
+ entries.each do |entry|
75
+ attach_function entry[0], entry[1], entry[2], entry[3]
76
+ rescue FFI::NotFoundError => e
77
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
78
+ end
79
+ end
80
+
81
+ end
82
+
@@ -0,0 +1,216 @@
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
+ require_relative 'sdl3_joystick'
9
+
10
+ module SDL
11
+ extend FFI::Library
12
+ # Define/Macro
13
+
14
+
15
+ # Enum
16
+
17
+ GAMEPAD_TYPE_UNKNOWN = 0
18
+ GAMEPAD_TYPE_STANDARD = 1
19
+ GAMEPAD_TYPE_XBOX360 = 2
20
+ GAMEPAD_TYPE_XBOXONE = 3
21
+ GAMEPAD_TYPE_PS3 = 4
22
+ GAMEPAD_TYPE_PS4 = 5
23
+ GAMEPAD_TYPE_PS5 = 6
24
+ GAMEPAD_TYPE_NINTENDO_SWITCH_PRO = 7
25
+ GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT = 8
26
+ GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT = 9
27
+ GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR = 10
28
+ GAMEPAD_TYPE_COUNT = 11
29
+ GAMEPAD_BUTTON_INVALID = -1
30
+ GAMEPAD_BUTTON_SOUTH = 0
31
+ GAMEPAD_BUTTON_EAST = 1
32
+ GAMEPAD_BUTTON_WEST = 2
33
+ GAMEPAD_BUTTON_NORTH = 3
34
+ GAMEPAD_BUTTON_BACK = 4
35
+ GAMEPAD_BUTTON_GUIDE = 5
36
+ GAMEPAD_BUTTON_START = 6
37
+ GAMEPAD_BUTTON_LEFT_STICK = 7
38
+ GAMEPAD_BUTTON_RIGHT_STICK = 8
39
+ GAMEPAD_BUTTON_LEFT_SHOULDER = 9
40
+ GAMEPAD_BUTTON_RIGHT_SHOULDER = 10
41
+ GAMEPAD_BUTTON_DPAD_UP = 11
42
+ GAMEPAD_BUTTON_DPAD_DOWN = 12
43
+ GAMEPAD_BUTTON_DPAD_LEFT = 13
44
+ GAMEPAD_BUTTON_DPAD_RIGHT = 14
45
+ GAMEPAD_BUTTON_MISC1 = 15
46
+ GAMEPAD_BUTTON_RIGHT_PADDLE1 = 16
47
+ GAMEPAD_BUTTON_LEFT_PADDLE1 = 17
48
+ GAMEPAD_BUTTON_RIGHT_PADDLE2 = 18
49
+ GAMEPAD_BUTTON_LEFT_PADDLE2 = 19
50
+ GAMEPAD_BUTTON_TOUCHPAD = 20
51
+ GAMEPAD_BUTTON_MISC2 = 21
52
+ GAMEPAD_BUTTON_MISC3 = 22
53
+ GAMEPAD_BUTTON_MISC4 = 23
54
+ GAMEPAD_BUTTON_MISC5 = 24
55
+ GAMEPAD_BUTTON_MISC6 = 25
56
+ GAMEPAD_BUTTON_COUNT = 26
57
+ GAMEPAD_BUTTON_LABEL_UNKNOWN = 0
58
+ GAMEPAD_BUTTON_LABEL_A = 1
59
+ GAMEPAD_BUTTON_LABEL_B = 2
60
+ GAMEPAD_BUTTON_LABEL_X = 3
61
+ GAMEPAD_BUTTON_LABEL_Y = 4
62
+ GAMEPAD_BUTTON_LABEL_CROSS = 5
63
+ GAMEPAD_BUTTON_LABEL_CIRCLE = 6
64
+ GAMEPAD_BUTTON_LABEL_SQUARE = 7
65
+ GAMEPAD_BUTTON_LABEL_TRIANGLE = 8
66
+ GAMEPAD_AXIS_INVALID = -1
67
+ GAMEPAD_AXIS_LEFTX = 0
68
+ GAMEPAD_AXIS_LEFTY = 1
69
+ GAMEPAD_AXIS_RIGHTX = 2
70
+ GAMEPAD_AXIS_RIGHTY = 3
71
+ GAMEPAD_AXIS_LEFT_TRIGGER = 4
72
+ GAMEPAD_AXIS_RIGHT_TRIGGER = 5
73
+ GAMEPAD_AXIS_COUNT = 6
74
+ GAMEPAD_BINDTYPE_NONE = 0
75
+ GAMEPAD_BINDTYPE_BUTTON = 1
76
+ GAMEPAD_BINDTYPE_AXIS = 2
77
+ GAMEPAD_BINDTYPE_HAT = 3
78
+
79
+ # Typedef
80
+
81
+
82
+ class GamepadBinding_value_axis < FFI::Struct
83
+ layout(
84
+ :axis, :int,
85
+ :axis_min, :int,
86
+ :axis_max, :int,
87
+ )
88
+ end
89
+
90
+ class GamepadBinding_value_hat < FFI::Struct
91
+ layout(
92
+ :hat, :int,
93
+ :hat_mask, :int,
94
+ )
95
+ end
96
+
97
+ class GamepadBinding_input < FFI::Struct
98
+ layout(
99
+ :button, :int,
100
+ :axis, GamepadBinding_value_axis,
101
+ :hat, GamepadBinding_value_hat,
102
+ )
103
+ end
104
+
105
+ class GamepadBinding_output < FFI::Struct
106
+ layout(
107
+ :button, :int,
108
+ :axis, GamepadBinding_value_axis,
109
+ )
110
+ end
111
+
112
+ class GamepadBinding < FFI::Struct
113
+ layout(
114
+ :input_type, :int,
115
+ :input, GamepadBinding_input,
116
+ :output_type, :int,
117
+ :output, GamepadBinding_output,
118
+ )
119
+ end
120
+
121
+ typedef :int, :SDL_GamepadType
122
+ typedef :int, :SDL_GamepadButton
123
+ typedef :int, :SDL_GamepadButtonLabel
124
+ typedef :int, :SDL_GamepadAxis
125
+ typedef :int, :SDL_GamepadBindingType
126
+
127
+ # Struct
128
+
129
+
130
+ # Function
131
+
132
+ def self.setup_gamepad_symbols(output_error = false)
133
+ entries = [
134
+ [:AddGamepadMapping, :SDL_AddGamepadMapping, [:pointer], :int],
135
+ [:AddGamepadMappingsFromIO, :SDL_AddGamepadMappingsFromIO, [:pointer, :bool], :int],
136
+ [:AddGamepadMappingsFromFile, :SDL_AddGamepadMappingsFromFile, [:pointer], :int],
137
+ [:ReloadGamepadMappings, :SDL_ReloadGamepadMappings, [], :bool],
138
+ [:GetGamepadMappings, :SDL_GetGamepadMappings, [:pointer], :pointer],
139
+ [:GetGamepadMappingForGUID, :SDL_GetGamepadMappingForGUID, [GUID.by_value], :pointer],
140
+ [:GetGamepadMapping, :SDL_GetGamepadMapping, [:pointer], :pointer],
141
+ [:SetGamepadMapping, :SDL_SetGamepadMapping, [:uint, :pointer], :bool],
142
+ [:HasGamepad, :SDL_HasGamepad, [], :bool],
143
+ [:GetGamepads, :SDL_GetGamepads, [:pointer], :pointer],
144
+ [:IsGamepad, :SDL_IsGamepad, [:uint], :bool],
145
+ [:GetGamepadNameForID, :SDL_GetGamepadNameForID, [:uint], :pointer],
146
+ [:GetGamepadPathForID, :SDL_GetGamepadPathForID, [:uint], :pointer],
147
+ [:GetGamepadPlayerIndexForID, :SDL_GetGamepadPlayerIndexForID, [:uint], :int],
148
+ [:GetGamepadGUIDForID, :SDL_GetGamepadGUIDForID, [:uint], GUID.by_value],
149
+ [:GetGamepadVendorForID, :SDL_GetGamepadVendorForID, [:uint], :ushort],
150
+ [:GetGamepadProductForID, :SDL_GetGamepadProductForID, [:uint], :ushort],
151
+ [:GetGamepadProductVersionForID, :SDL_GetGamepadProductVersionForID, [:uint], :ushort],
152
+ [:GetGamepadTypeForID, :SDL_GetGamepadTypeForID, [:uint], :int],
153
+ [:GetRealGamepadTypeForID, :SDL_GetRealGamepadTypeForID, [:uint], :int],
154
+ [:GetGamepadMappingForID, :SDL_GetGamepadMappingForID, [:uint], :pointer],
155
+ [:OpenGamepad, :SDL_OpenGamepad, [:uint], :pointer],
156
+ [:GetGamepadFromID, :SDL_GetGamepadFromID, [:uint], :pointer],
157
+ [:GetGamepadFromPlayerIndex, :SDL_GetGamepadFromPlayerIndex, [:int], :pointer],
158
+ [:GetGamepadProperties, :SDL_GetGamepadProperties, [:pointer], :uint],
159
+ [:GetGamepadID, :SDL_GetGamepadID, [:pointer], :uint],
160
+ [:GetGamepadName, :SDL_GetGamepadName, [:pointer], :pointer],
161
+ [:GetGamepadPath, :SDL_GetGamepadPath, [:pointer], :pointer],
162
+ [:GetGamepadType, :SDL_GetGamepadType, [:pointer], :int],
163
+ [:GetRealGamepadType, :SDL_GetRealGamepadType, [:pointer], :int],
164
+ [:GetGamepadPlayerIndex, :SDL_GetGamepadPlayerIndex, [:pointer], :int],
165
+ [:SetGamepadPlayerIndex, :SDL_SetGamepadPlayerIndex, [:pointer, :int], :bool],
166
+ [:GetGamepadVendor, :SDL_GetGamepadVendor, [:pointer], :ushort],
167
+ [:GetGamepadProduct, :SDL_GetGamepadProduct, [:pointer], :ushort],
168
+ [:GetGamepadProductVersion, :SDL_GetGamepadProductVersion, [:pointer], :ushort],
169
+ [:GetGamepadFirmwareVersion, :SDL_GetGamepadFirmwareVersion, [:pointer], :ushort],
170
+ [:GetGamepadSerial, :SDL_GetGamepadSerial, [:pointer], :pointer],
171
+ [:GetGamepadSteamHandle, :SDL_GetGamepadSteamHandle, [:pointer], :ulong_long],
172
+ [:GetGamepadConnectionState, :SDL_GetGamepadConnectionState, [:pointer], :int],
173
+ [:GetGamepadPowerInfo, :SDL_GetGamepadPowerInfo, [:pointer, :pointer], :int],
174
+ [:GamepadConnected, :SDL_GamepadConnected, [:pointer], :bool],
175
+ [:GetGamepadJoystick, :SDL_GetGamepadJoystick, [:pointer], :pointer],
176
+ [:SetGamepadEventsEnabled, :SDL_SetGamepadEventsEnabled, [:bool], :void],
177
+ [:GamepadEventsEnabled, :SDL_GamepadEventsEnabled, [], :bool],
178
+ [:GetGamepadBindings, :SDL_GetGamepadBindings, [:pointer, :pointer], :pointer],
179
+ [:UpdateGamepads, :SDL_UpdateGamepads, [], :void],
180
+ [:GetGamepadTypeFromString, :SDL_GetGamepadTypeFromString, [:pointer], :int],
181
+ [:GetGamepadStringForType, :SDL_GetGamepadStringForType, [:int], :pointer],
182
+ [:GetGamepadAxisFromString, :SDL_GetGamepadAxisFromString, [:pointer], :int],
183
+ [:GetGamepadStringForAxis, :SDL_GetGamepadStringForAxis, [:int], :pointer],
184
+ [:GamepadHasAxis, :SDL_GamepadHasAxis, [:pointer, :int], :bool],
185
+ [:GetGamepadAxis, :SDL_GetGamepadAxis, [:pointer, :int], :short],
186
+ [:GetGamepadButtonFromString, :SDL_GetGamepadButtonFromString, [:pointer], :int],
187
+ [:GetGamepadStringForButton, :SDL_GetGamepadStringForButton, [:int], :pointer],
188
+ [:GamepadHasButton, :SDL_GamepadHasButton, [:pointer, :int], :bool],
189
+ [:GetGamepadButton, :SDL_GetGamepadButton, [:pointer, :int], :bool],
190
+ [:GetGamepadButtonLabelForType, :SDL_GetGamepadButtonLabelForType, [:int, :int], :int],
191
+ [:GetGamepadButtonLabel, :SDL_GetGamepadButtonLabel, [:pointer, :int], :int],
192
+ [:GetNumGamepadTouchpads, :SDL_GetNumGamepadTouchpads, [:pointer], :int],
193
+ [:GetNumGamepadTouchpadFingers, :SDL_GetNumGamepadTouchpadFingers, [:pointer, :int], :int],
194
+ [:GetGamepadTouchpadFinger, :SDL_GetGamepadTouchpadFinger, [:pointer, :int, :int, :pointer, :pointer, :pointer, :pointer], :bool],
195
+ [:GamepadHasSensor, :SDL_GamepadHasSensor, [:pointer, :int], :bool],
196
+ [:SetGamepadSensorEnabled, :SDL_SetGamepadSensorEnabled, [:pointer, :int, :bool], :bool],
197
+ [:GamepadSensorEnabled, :SDL_GamepadSensorEnabled, [:pointer, :int], :bool],
198
+ [:GetGamepadSensorDataRate, :SDL_GetGamepadSensorDataRate, [:pointer, :int], :float],
199
+ [:GetGamepadSensorData, :SDL_GetGamepadSensorData, [:pointer, :int, :pointer, :int], :bool],
200
+ [:RumbleGamepad, :SDL_RumbleGamepad, [:pointer, :ushort, :ushort, :uint], :bool],
201
+ [:RumbleGamepadTriggers, :SDL_RumbleGamepadTriggers, [:pointer, :ushort, :ushort, :uint], :bool],
202
+ [:SetGamepadLED, :SDL_SetGamepadLED, [:pointer, :uchar, :uchar, :uchar], :bool],
203
+ [:SendGamepadEffect, :SDL_SendGamepadEffect, [:pointer, :pointer, :int], :bool],
204
+ [:CloseGamepad, :SDL_CloseGamepad, [:pointer], :void],
205
+ [:GetGamepadAppleSFSymbolsNameForButton, :SDL_GetGamepadAppleSFSymbolsNameForButton, [:pointer, :int], :pointer],
206
+ [:GetGamepadAppleSFSymbolsNameForAxis, :SDL_GetGamepadAppleSFSymbolsNameForAxis, [:pointer, :int], :pointer],
207
+ ]
208
+ entries.each do |entry|
209
+ attach_function entry[0], entry[1], entry[2], entry[3]
210
+ rescue FFI::NotFoundError => e
211
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
212
+ end
213
+ end
214
+
215
+ end
216
+