sdl3 0.1.0

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.

Potentially problematic release.


This version of sdl3 might be problematic. Click here for more details.

Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +7 -0
  3. data/LICENSE +21 -0
  4. data/README.md +188 -0
  5. data/Rakefile +12 -0
  6. data/examples/01_hello_window.rb +24 -0
  7. data/examples/02_basic_rendering.rb +45 -0
  8. data/examples/03_keyboard_input.rb +52 -0
  9. data/examples/04_mouse_input.rb +56 -0
  10. data/examples/05_simple_game.rb +107 -0
  11. data/lib/sdl3/high_level/audio_device.rb +202 -0
  12. data/lib/sdl3/high_level/camera.rb +118 -0
  13. data/lib/sdl3/high_level/clipboard.rb +59 -0
  14. data/lib/sdl3/high_level/event.rb +240 -0
  15. data/lib/sdl3/high_level/gamepad.rb +190 -0
  16. data/lib/sdl3/high_level/gpu.rb +194 -0
  17. data/lib/sdl3/high_level/haptic.rb +213 -0
  18. data/lib/sdl3/high_level/joystick.rb +165 -0
  19. data/lib/sdl3/high_level/renderer.rb +163 -0
  20. data/lib/sdl3/high_level/sensor.rb +105 -0
  21. data/lib/sdl3/high_level/surface.rb +143 -0
  22. data/lib/sdl3/high_level/texture.rb +111 -0
  23. data/lib/sdl3/high_level/timer.rb +88 -0
  24. data/lib/sdl3/high_level/window.rb +151 -0
  25. data/lib/sdl3/library_loader.rb +63 -0
  26. data/lib/sdl3/raw/assert.rb +32 -0
  27. data/lib/sdl3/raw/asyncio.rb +36 -0
  28. data/lib/sdl3/raw/atomic.rb +35 -0
  29. data/lib/sdl3/raw/audio.rb +88 -0
  30. data/lib/sdl3/raw/base.rb +12 -0
  31. data/lib/sdl3/raw/bits.rb +17 -0
  32. data/lib/sdl3/raw/blendmode.rb +36 -0
  33. data/lib/sdl3/raw/camera.rb +38 -0
  34. data/lib/sdl3/raw/clipboard.rb +20 -0
  35. data/lib/sdl3/raw/cpuinfo.rb +24 -0
  36. data/lib/sdl3/raw/dialog.rb +33 -0
  37. data/lib/sdl3/raw/endian.rb +8 -0
  38. data/lib/sdl3/raw/error.rb +10 -0
  39. data/lib/sdl3/raw/events.rb +558 -0
  40. data/lib/sdl3/raw/filesystem.rb +47 -0
  41. data/lib/sdl3/raw/gamepad.rb +135 -0
  42. data/lib/sdl3/raw/gpu.rb +716 -0
  43. data/lib/sdl3/raw/guid.rb +12 -0
  44. data/lib/sdl3/raw/haptic.rb +167 -0
  45. data/lib/sdl3/raw/hidapi.rb +57 -0
  46. data/lib/sdl3/raw/hints.rb +20 -0
  47. data/lib/sdl3/raw/init.rb +27 -0
  48. data/lib/sdl3/raw/iostream.rb +83 -0
  49. data/lib/sdl3/raw/joystick.rb +81 -0
  50. data/lib/sdl3/raw/keyboard.rb +30 -0
  51. data/lib/sdl3/raw/keycode.rb +132 -0
  52. data/lib/sdl3/raw/loadso.rb +9 -0
  53. data/lib/sdl3/raw/locale.rb +12 -0
  54. data/lib/sdl3/raw/log.rb +56 -0
  55. data/lib/sdl3/raw/messagebox.rb +50 -0
  56. data/lib/sdl3/raw/metal.rb +9 -0
  57. data/lib/sdl3/raw/misc.rb +7 -0
  58. data/lib/sdl3/raw/mouse.rb +65 -0
  59. data/lib/sdl3/raw/mutex.rb +34 -0
  60. data/lib/sdl3/raw/pen.rb +32 -0
  61. data/lib/sdl3/raw/pixels.rb +180 -0
  62. data/lib/sdl3/raw/platform.rb +7 -0
  63. data/lib/sdl3/raw/power.rb +14 -0
  64. data/lib/sdl3/raw/process.rb +15 -0
  65. data/lib/sdl3/raw/properties.rb +39 -0
  66. data/lib/sdl3/raw/rect.rb +41 -0
  67. data/lib/sdl3/raw/render.rb +107 -0
  68. data/lib/sdl3/raw/scancode.rb +112 -0
  69. data/lib/sdl3/raw/sensor.rb +31 -0
  70. data/lib/sdl3/raw/stdinc.rb +169 -0
  71. data/lib/sdl3/raw/storage.rb +50 -0
  72. data/lib/sdl3/raw/surface.rb +83 -0
  73. data/lib/sdl3/raw/system.rb +68 -0
  74. data/lib/sdl3/raw/thread.rb +33 -0
  75. data/lib/sdl3/raw/time.rb +36 -0
  76. data/lib/sdl3/raw/timer.rb +19 -0
  77. data/lib/sdl3/raw/touch.rb +22 -0
  78. data/lib/sdl3/raw/tray.rb +40 -0
  79. data/lib/sdl3/raw/types.rb +21 -0
  80. data/lib/sdl3/raw/version.rb +8 -0
  81. data/lib/sdl3/raw/video.rb +146 -0
  82. data/lib/sdl3/raw/vulkan.rb +13 -0
  83. data/lib/sdl3/version.rb +5 -0
  84. data/lib/sdl3.rb +126 -0
  85. data/sdl3.gemspec +30 -0
  86. metadata +141 -0
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ SDL_SCANCODE_UNKNOWN = 0
6
+ SDL_SCANCODE_A = 4
7
+ SDL_SCANCODE_B = 5
8
+ SDL_SCANCODE_C = 6
9
+ SDL_SCANCODE_D = 7
10
+ SDL_SCANCODE_E = 8
11
+ SDL_SCANCODE_F = 9
12
+ SDL_SCANCODE_G = 10
13
+ SDL_SCANCODE_H = 11
14
+ SDL_SCANCODE_I = 12
15
+ SDL_SCANCODE_J = 13
16
+ SDL_SCANCODE_K = 14
17
+ SDL_SCANCODE_L = 15
18
+ SDL_SCANCODE_M = 16
19
+ SDL_SCANCODE_N = 17
20
+ SDL_SCANCODE_O = 18
21
+ SDL_SCANCODE_P = 19
22
+ SDL_SCANCODE_Q = 20
23
+ SDL_SCANCODE_R = 21
24
+ SDL_SCANCODE_S = 22
25
+ SDL_SCANCODE_T = 23
26
+ SDL_SCANCODE_U = 24
27
+ SDL_SCANCODE_V = 25
28
+ SDL_SCANCODE_W = 26
29
+ SDL_SCANCODE_X = 27
30
+ SDL_SCANCODE_Y = 28
31
+ SDL_SCANCODE_Z = 29
32
+ SDL_SCANCODE_1 = 30
33
+ SDL_SCANCODE_2 = 31
34
+ SDL_SCANCODE_3 = 32
35
+ SDL_SCANCODE_4 = 33
36
+ SDL_SCANCODE_5 = 34
37
+ SDL_SCANCODE_6 = 35
38
+ SDL_SCANCODE_7 = 36
39
+ SDL_SCANCODE_8 = 37
40
+ SDL_SCANCODE_9 = 38
41
+ SDL_SCANCODE_0 = 39
42
+ SDL_SCANCODE_RETURN = 40
43
+ SDL_SCANCODE_ESCAPE = 41
44
+ SDL_SCANCODE_BACKSPACE = 42
45
+ SDL_SCANCODE_TAB = 43
46
+ SDL_SCANCODE_SPACE = 44
47
+ SDL_SCANCODE_MINUS = 45
48
+ SDL_SCANCODE_EQUALS = 46
49
+ SDL_SCANCODE_LEFTBRACKET = 47
50
+ SDL_SCANCODE_RIGHTBRACKET = 48
51
+ SDL_SCANCODE_BACKSLASH = 49
52
+ SDL_SCANCODE_NONUSHASH = 50
53
+ SDL_SCANCODE_SEMICOLON = 51
54
+ SDL_SCANCODE_APOSTROPHE = 52
55
+ SDL_SCANCODE_GRAVE = 53
56
+ SDL_SCANCODE_COMMA = 54
57
+ SDL_SCANCODE_PERIOD = 55
58
+ SDL_SCANCODE_SLASH = 56
59
+ SDL_SCANCODE_CAPSLOCK = 57
60
+ SDL_SCANCODE_F1 = 58
61
+ SDL_SCANCODE_F2 = 59
62
+ SDL_SCANCODE_F3 = 60
63
+ SDL_SCANCODE_F4 = 61
64
+ SDL_SCANCODE_F5 = 62
65
+ SDL_SCANCODE_F6 = 63
66
+ SDL_SCANCODE_F7 = 64
67
+ SDL_SCANCODE_F8 = 65
68
+ SDL_SCANCODE_F9 = 66
69
+ SDL_SCANCODE_F10 = 67
70
+ SDL_SCANCODE_F11 = 68
71
+ SDL_SCANCODE_F12 = 69
72
+ SDL_SCANCODE_PRINTSCREEN = 70
73
+ SDL_SCANCODE_SCROLLLOCK = 71
74
+ SDL_SCANCODE_PAUSE = 72
75
+ SDL_SCANCODE_INSERT = 73
76
+ SDL_SCANCODE_HOME = 74
77
+ SDL_SCANCODE_PAGEUP = 75
78
+ SDL_SCANCODE_DELETE = 76
79
+ SDL_SCANCODE_END = 77
80
+ SDL_SCANCODE_PAGEDOWN = 78
81
+ SDL_SCANCODE_RIGHT = 79
82
+ SDL_SCANCODE_LEFT = 80
83
+ SDL_SCANCODE_DOWN = 81
84
+ SDL_SCANCODE_UP = 82
85
+ SDL_SCANCODE_NUMLOCKCLEAR = 83
86
+ SDL_SCANCODE_KP_DIVIDE = 84
87
+ SDL_SCANCODE_KP_MULTIPLY = 85
88
+ SDL_SCANCODE_KP_MINUS = 86
89
+ SDL_SCANCODE_KP_PLUS = 87
90
+ SDL_SCANCODE_KP_ENTER = 88
91
+ SDL_SCANCODE_KP_1 = 89
92
+ SDL_SCANCODE_KP_2 = 90
93
+ SDL_SCANCODE_KP_3 = 91
94
+ SDL_SCANCODE_KP_4 = 92
95
+ SDL_SCANCODE_KP_5 = 93
96
+ SDL_SCANCODE_KP_6 = 94
97
+ SDL_SCANCODE_KP_7 = 95
98
+ SDL_SCANCODE_KP_8 = 96
99
+ SDL_SCANCODE_KP_9 = 97
100
+ SDL_SCANCODE_KP_0 = 98
101
+ SDL_SCANCODE_KP_PERIOD = 99
102
+ SDL_SCANCODE_LCTRL = 224
103
+ SDL_SCANCODE_LSHIFT = 225
104
+ SDL_SCANCODE_LALT = 226
105
+ SDL_SCANCODE_LGUI = 227
106
+ SDL_SCANCODE_RCTRL = 228
107
+ SDL_SCANCODE_RSHIFT = 229
108
+ SDL_SCANCODE_RALT = 230
109
+ SDL_SCANCODE_RGUI = 231
110
+ SDL_SCANCODE_COUNT = 512
111
+ end
112
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ SDL_STANDARD_GRAVITY = 9.80665
6
+
7
+ SDL_SensorType = enum :SDL_SENSOR_INVALID, -1,
8
+ :SDL_SENSOR_UNKNOWN, 0,
9
+ :SDL_SENSOR_ACCEL, 1,
10
+ :SDL_SENSOR_GYRO, 2,
11
+ :SDL_SENSOR_ACCEL_L, 3,
12
+ :SDL_SENSOR_GYRO_L, 4,
13
+ :SDL_SENSOR_ACCEL_R, 5,
14
+ :SDL_SENSOR_GYRO_R, 6
15
+
16
+ attach_function :SDL_GetSensors, [:pointer], :pointer
17
+ attach_function :SDL_GetSensorNameForID, [:SDL_SensorID], :string
18
+ attach_function :SDL_GetSensorTypeForID, [:SDL_SensorID], SDL_SensorType
19
+ attach_function :SDL_GetSensorNonPortableTypeForID, [:SDL_SensorID], :int
20
+ attach_function :SDL_OpenSensor, [:SDL_SensorID], :pointer
21
+ attach_function :SDL_GetSensorFromID, [:SDL_SensorID], :pointer
22
+ attach_function :SDL_GetSensorProperties, [:pointer], :SDL_PropertiesID
23
+ attach_function :SDL_GetSensorName, [:pointer], :string
24
+ attach_function :SDL_GetSensorType, [:pointer], SDL_SensorType
25
+ attach_function :SDL_GetSensorNonPortableType, [:pointer], :int
26
+ attach_function :SDL_GetSensorID, [:pointer], :SDL_SensorID
27
+ attach_function :SDL_GetSensorData, %i[pointer pointer int], :bool
28
+ attach_function :SDL_CloseSensor, [:pointer], :void
29
+ attach_function :SDL_UpdateSensors, [], :void
30
+ end
31
+ end
@@ -0,0 +1,169 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ typedef :int8, :Sint8
6
+ typedef :uint8, :Uint8
7
+ typedef :int16, :Sint16
8
+ typedef :uint16, :Uint16
9
+ typedef :int32, :Sint32
10
+ typedef :uint32, :Uint32
11
+ typedef :int64, :Sint64
12
+ typedef :uint64, :Uint64
13
+
14
+ attach_function :SDL_malloc, [:size_t], :pointer
15
+ attach_function :SDL_calloc, [:size_t, :size_t], :pointer
16
+ attach_function :SDL_realloc, [:pointer, :size_t], :pointer
17
+ attach_function :SDL_free, [:pointer], :void
18
+ attach_function :SDL_aligned_alloc, [:size_t, :size_t], :pointer
19
+ attach_function :SDL_aligned_free, [:pointer], :void
20
+
21
+ attach_function :SDL_GetNumAllocations, [], :int
22
+
23
+ attach_function :SDL_getenv, [:string], :string
24
+ attach_function :SDL_getenv_unsafe, [:string], :string
25
+ attach_function :SDL_setenv_unsafe, [:string, :string, :int], :int
26
+ attach_function :SDL_unsetenv_unsafe, [:string], :int
27
+
28
+ attach_function :SDL_qsort, [:pointer, :size_t, :size_t, :pointer], :void
29
+ attach_function :SDL_bsearch, [:pointer, :pointer, :size_t, :size_t, :pointer], :pointer
30
+ attach_function :SDL_qsort_r, [:pointer, :size_t, :size_t, :pointer, :pointer], :void
31
+ attach_function :SDL_bsearch_r, [:pointer, :pointer, :size_t, :size_t, :pointer, :pointer], :pointer
32
+
33
+ attach_function :SDL_abs, [:int], :int
34
+ attach_function :SDL_isalpha, [:int], :int
35
+ attach_function :SDL_isalnum, [:int], :int
36
+ attach_function :SDL_isblank, [:int], :int
37
+ attach_function :SDL_iscntrl, [:int], :int
38
+ attach_function :SDL_isdigit, [:int], :int
39
+ attach_function :SDL_isxdigit, [:int], :int
40
+ attach_function :SDL_ispunct, [:int], :int
41
+ attach_function :SDL_isspace, [:int], :int
42
+ attach_function :SDL_isupper, [:int], :int
43
+ attach_function :SDL_islower, [:int], :int
44
+ attach_function :SDL_isprint, [:int], :int
45
+ attach_function :SDL_isgraph, [:int], :int
46
+ attach_function :SDL_toupper, [:int], :int
47
+ attach_function :SDL_tolower, [:int], :int
48
+
49
+ attach_function :SDL_crc16, [:uint16, :pointer, :size_t], :uint16
50
+ attach_function :SDL_crc32, [:uint32, :pointer, :size_t], :uint32
51
+ attach_function :SDL_murmur3_32, [:pointer, :size_t, :uint32], :uint32
52
+
53
+ attach_function :SDL_memcpy, [:pointer, :pointer, :size_t], :pointer
54
+ attach_function :SDL_memmove, [:pointer, :pointer, :size_t], :pointer
55
+ attach_function :SDL_memset, [:pointer, :int, :size_t], :pointer
56
+ attach_function :SDL_memset4, [:pointer, :uint32, :size_t], :pointer
57
+ attach_function :SDL_memcmp, [:pointer, :pointer, :size_t], :int
58
+
59
+ attach_function :SDL_wcslen, [:pointer], :size_t
60
+ attach_function :SDL_wcsnlen, [:pointer, :size_t], :size_t
61
+ attach_function :SDL_wcslcpy, [:pointer, :pointer, :size_t], :size_t
62
+ attach_function :SDL_wcslcat, [:pointer, :pointer, :size_t], :size_t
63
+ attach_function :SDL_wcsdup, [:pointer], :pointer
64
+ attach_function :SDL_wcsstr, [:pointer, :pointer], :pointer
65
+ attach_function :SDL_wcsnstr, [:pointer, :pointer, :size_t], :pointer
66
+ attach_function :SDL_wcscmp, [:pointer, :pointer], :int
67
+ attach_function :SDL_wcsncmp, [:pointer, :pointer, :size_t], :int
68
+ attach_function :SDL_wcscasecmp, [:pointer, :pointer], :int
69
+ attach_function :SDL_wcsncasecmp, [:pointer, :pointer, :size_t], :int
70
+ attach_function :SDL_wcstol, [:pointer, :pointer, :int], :long
71
+
72
+ attach_function :SDL_strlen, [:string], :size_t
73
+ attach_function :SDL_strnlen, [:string, :size_t], :size_t
74
+ attach_function :SDL_strlcpy, [:pointer, :string, :size_t], :size_t
75
+ attach_function :SDL_utf8strlcpy, [:pointer, :string, :size_t], :size_t
76
+ attach_function :SDL_strlcat, [:pointer, :string, :size_t], :size_t
77
+ attach_function :SDL_strdup, [:string], :pointer
78
+ attach_function :SDL_strndup, [:string, :size_t], :pointer
79
+ attach_function :SDL_strrev, [:pointer], :pointer
80
+ attach_function :SDL_strupr, [:pointer], :pointer
81
+ attach_function :SDL_strlwr, [:pointer], :pointer
82
+ attach_function :SDL_strchr, [:string, :int], :pointer
83
+ attach_function :SDL_strrchr, [:string, :int], :pointer
84
+ attach_function :SDL_strstr, [:string, :string], :pointer
85
+ attach_function :SDL_strnstr, [:string, :string, :size_t], :pointer
86
+ attach_function :SDL_strcasestr, [:string, :string], :pointer
87
+ attach_function :SDL_strtok_r, [:pointer, :string, :pointer], :pointer
88
+ attach_function :SDL_utf8strlen, [:string], :size_t
89
+ attach_function :SDL_utf8strnlen, [:string, :size_t], :size_t
90
+
91
+ attach_function :SDL_itoa, [:int, :pointer, :int], :pointer
92
+ attach_function :SDL_uitoa, [:uint, :pointer, :int], :pointer
93
+ attach_function :SDL_ltoa, [:long, :pointer, :int], :pointer
94
+ attach_function :SDL_ultoa, [:ulong, :pointer, :int], :pointer
95
+ attach_function :SDL_lltoa, [:long_long, :pointer, :int], :pointer
96
+ attach_function :SDL_ulltoa, [:ulong_long, :pointer, :int], :pointer
97
+
98
+ attach_function :SDL_atoi, [:string], :int
99
+ attach_function :SDL_atof, [:string], :double
100
+ attach_function :SDL_strtol, [:string, :pointer, :int], :long
101
+ attach_function :SDL_strtoul, [:string, :pointer, :int], :ulong
102
+ attach_function :SDL_strtoll, [:string, :pointer, :int], :long_long
103
+ attach_function :SDL_strtoull, [:string, :pointer, :int], :ulong_long
104
+ attach_function :SDL_strtod, [:string, :pointer], :double
105
+
106
+ attach_function :SDL_strcmp, [:string, :string], :int
107
+ attach_function :SDL_strncmp, [:string, :string, :size_t], :int
108
+ attach_function :SDL_strcasecmp, [:string, :string], :int
109
+ attach_function :SDL_strncasecmp, [:string, :string, :size_t], :int
110
+ attach_function :SDL_strpbrk, [:string, :string], :pointer
111
+
112
+ attach_function :SDL_StepUTF8, [:pointer, :pointer], :uint32
113
+ attach_function :SDL_UCS4ToUTF8, [:uint32, :pointer], :pointer
114
+
115
+ attach_function :SDL_acos, [:double], :double
116
+ attach_function :SDL_acosf, [:float], :float
117
+ attach_function :SDL_asin, [:double], :double
118
+ attach_function :SDL_asinf, [:float], :float
119
+ attach_function :SDL_atan, [:double], :double
120
+ attach_function :SDL_atanf, [:float], :float
121
+ attach_function :SDL_atan2, [:double, :double], :double
122
+ attach_function :SDL_atan2f, [:float, :float], :float
123
+ attach_function :SDL_ceil, [:double], :double
124
+ attach_function :SDL_ceilf, [:float], :float
125
+ attach_function :SDL_copysign, [:double, :double], :double
126
+ attach_function :SDL_copysignf, [:float, :float], :float
127
+ attach_function :SDL_cos, [:double], :double
128
+ attach_function :SDL_cosf, [:float], :float
129
+ attach_function :SDL_exp, [:double], :double
130
+ attach_function :SDL_expf, [:float], :float
131
+ attach_function :SDL_fabs, [:double], :double
132
+ attach_function :SDL_fabsf, [:float], :float
133
+ attach_function :SDL_floor, [:double], :double
134
+ attach_function :SDL_floorf, [:float], :float
135
+ attach_function :SDL_trunc, [:double], :double
136
+ attach_function :SDL_truncf, [:float], :float
137
+ attach_function :SDL_fmod, [:double, :double], :double
138
+ attach_function :SDL_fmodf, [:float, :float], :float
139
+ attach_function :SDL_isinf, [:double], :int
140
+ attach_function :SDL_isinff, [:float], :int
141
+ attach_function :SDL_isnan, [:double], :int
142
+ attach_function :SDL_isnanf, [:float], :int
143
+ attach_function :SDL_log, [:double], :double
144
+ attach_function :SDL_logf, [:float], :float
145
+ attach_function :SDL_log10, [:double], :double
146
+ attach_function :SDL_log10f, [:float], :float
147
+ attach_function :SDL_modf, [:double, :pointer], :double
148
+ attach_function :SDL_modff, [:float, :pointer], :float
149
+ attach_function :SDL_pow, [:double, :double], :double
150
+ attach_function :SDL_powf, [:float, :float], :float
151
+ attach_function :SDL_round, [:double], :double
152
+ attach_function :SDL_roundf, [:float], :float
153
+ attach_function :SDL_lround, [:double], :long
154
+ attach_function :SDL_lroundf, [:float], :long
155
+ attach_function :SDL_scalbn, [:double, :int], :double
156
+ attach_function :SDL_scalbnf, [:float, :int], :float
157
+ attach_function :SDL_sin, [:double], :double
158
+ attach_function :SDL_sinf, [:float], :float
159
+ attach_function :SDL_sqrt, [:double], :double
160
+ attach_function :SDL_sqrtf, [:float], :float
161
+ attach_function :SDL_tan, [:double], :double
162
+ attach_function :SDL_tanf, [:float], :float
163
+
164
+ attach_function :SDL_iconv_open, [:string, :string], :pointer
165
+ attach_function :SDL_iconv_close, [:pointer], :int
166
+ attach_function :SDL_iconv, [:pointer, :pointer, :pointer, :pointer, :pointer], :size_t
167
+ attach_function :SDL_iconv_string, [:string, :string, :string, :size_t], :pointer
168
+ end
169
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ callback :SDL_StorageInterfaceCloseCallback, [:pointer], :bool
6
+ callback :SDL_StorageInterfaceReadyCallback, [:pointer], :bool
7
+ callback :SDL_StorageInterfaceEnumerateCallback, [:pointer, :string, :SDL_EnumerateDirectoryCallback, :pointer], :bool
8
+ callback :SDL_StorageInterfaceInfoCallback, [:pointer, :string, SDL_PathInfo.ptr], :bool
9
+ callback :SDL_StorageInterfaceReadFileCallback, %i[pointer string pointer uint64], :bool
10
+ callback :SDL_StorageInterfaceWriteFileCallback, %i[pointer string pointer uint64], :bool
11
+ callback :SDL_StorageInterfaceMkdirCallback, %i[pointer string], :bool
12
+ callback :SDL_StorageInterfaceRemoveCallback, %i[pointer string], :bool
13
+ callback :SDL_StorageInterfaceRenameCallback, %i[pointer string string], :bool
14
+ callback :SDL_StorageInterfaceCopyCallback, %i[pointer string string], :bool
15
+ callback :SDL_StorageInterfaceSpaceRemainingCallback, [:pointer], :uint64
16
+
17
+ class SDL_StorageInterface < FFI::Struct
18
+ layout :version, :uint32,
19
+ :close, :SDL_StorageInterfaceCloseCallback,
20
+ :ready, :SDL_StorageInterfaceReadyCallback,
21
+ :enumerate, :SDL_StorageInterfaceEnumerateCallback,
22
+ :info, :SDL_StorageInterfaceInfoCallback,
23
+ :read_file, :SDL_StorageInterfaceReadFileCallback,
24
+ :write_file, :SDL_StorageInterfaceWriteFileCallback,
25
+ :mkdir, :SDL_StorageInterfaceMkdirCallback,
26
+ :remove, :SDL_StorageInterfaceRemoveCallback,
27
+ :rename, :SDL_StorageInterfaceRenameCallback,
28
+ :copy, :SDL_StorageInterfaceCopyCallback,
29
+ :space_remaining, :SDL_StorageInterfaceSpaceRemainingCallback
30
+ end
31
+
32
+ attach_function :SDL_OpenTitleStorage, %i[string SDL_PropertiesID], :pointer
33
+ attach_function :SDL_OpenUserStorage, %i[string string SDL_PropertiesID], :pointer
34
+ attach_function :SDL_OpenFileStorage, [:string], :pointer
35
+ attach_function :SDL_OpenStorage, [SDL_StorageInterface.ptr, :pointer], :pointer
36
+ attach_function :SDL_CloseStorage, [:pointer], :bool
37
+ attach_function :SDL_StorageReady, [:pointer], :bool
38
+ attach_function :SDL_GetStorageFileSize, %i[pointer string pointer], :bool
39
+ attach_function :SDL_ReadStorageFile, %i[pointer string pointer uint64], :bool
40
+ attach_function :SDL_WriteStorageFile, %i[pointer string pointer uint64], :bool
41
+ attach_function :SDL_CreateStorageDirectory, %i[pointer string], :bool
42
+ attach_function :SDL_EnumerateStorageDirectory, [:pointer, :string, :SDL_EnumerateDirectoryCallback, :pointer], :bool
43
+ attach_function :SDL_RemoveStoragePath, %i[pointer string], :bool
44
+ attach_function :SDL_RenameStoragePath, %i[pointer string string], :bool
45
+ attach_function :SDL_CopyStorageFile, %i[pointer string string], :bool
46
+ attach_function :SDL_GetStoragePathInfo, [:pointer, :string, SDL_PathInfo.ptr], :bool
47
+ attach_function :SDL_GetStorageSpaceRemaining, [:pointer], :uint64
48
+ attach_function :SDL_GlobStorageDirectory, %i[pointer string string uint32 pointer], :pointer
49
+ end
50
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ SDL_SURFACE_PREALLOCATED = 0x00000001
6
+ SDL_SURFACE_LOCK_NEEDED = 0x00000002
7
+ SDL_SURFACE_LOCKED = 0x00000004
8
+ SDL_SURFACE_SIMD_ALIGNED = 0x00000008
9
+
10
+ SDL_ScaleMode = enum :SDL_SCALEMODE_NEAREST, 0,
11
+ :SDL_SCALEMODE_LINEAR, 1
12
+
13
+ SDL_FlipMode = enum :SDL_FLIP_NONE, 0,
14
+ :SDL_FLIP_HORIZONTAL, 1,
15
+ :SDL_FLIP_VERTICAL, 2
16
+
17
+ class SDL_Surface < FFI::Struct
18
+ layout :flags, :uint32,
19
+ :format, :uint32,
20
+ :w, :int,
21
+ :h, :int,
22
+ :pitch, :int,
23
+ :pixels, :pointer,
24
+ :refcount, :int,
25
+ :reserved, :pointer
26
+ end
27
+
28
+ attach_function :SDL_CreateSurface, %i[int int uint32], :pointer
29
+ attach_function :SDL_CreateSurfaceFrom, %i[int int uint32 pointer int], :pointer
30
+ attach_function :SDL_DestroySurface, [:pointer], :void
31
+ attach_function :SDL_GetSurfaceProperties, [:pointer], :SDL_PropertiesID
32
+ attach_function :SDL_SetSurfaceColorspace, %i[pointer uint32], :bool
33
+ attach_function :SDL_GetSurfaceColorspace, [:pointer], :uint32
34
+ attach_function :SDL_CreateSurfacePalette, [:pointer], :pointer
35
+ attach_function :SDL_SetSurfacePalette, %i[pointer pointer], :bool
36
+ attach_function :SDL_GetSurfacePalette, [:pointer], :pointer
37
+ attach_function :SDL_AddSurfaceAlternateImage, %i[pointer pointer], :bool
38
+ attach_function :SDL_SurfaceHasAlternateImages, [:pointer], :bool
39
+ attach_function :SDL_GetSurfaceImages, %i[pointer pointer], :pointer
40
+ attach_function :SDL_RemoveSurfaceAlternateImages, [:pointer], :void
41
+ attach_function :SDL_LockSurface, [:pointer], :bool
42
+ attach_function :SDL_UnlockSurface, [:pointer], :void
43
+ attach_function :SDL_SetSurfaceRLE, %i[pointer bool], :bool
44
+ attach_function :SDL_SurfaceHasRLE, [:pointer], :bool
45
+ attach_function :SDL_SetSurfaceColorKey, %i[pointer bool uint32], :bool
46
+ attach_function :SDL_SurfaceHasColorKey, [:pointer], :bool
47
+ attach_function :SDL_GetSurfaceColorKey, %i[pointer pointer], :bool
48
+ attach_function :SDL_SetSurfaceColorMod, %i[pointer uint8 uint8 uint8], :bool
49
+ attach_function :SDL_GetSurfaceColorMod, %i[pointer pointer pointer pointer], :bool
50
+ attach_function :SDL_SetSurfaceAlphaMod, %i[pointer uint8], :bool
51
+ attach_function :SDL_GetSurfaceAlphaMod, %i[pointer pointer], :bool
52
+ attach_function :SDL_SetSurfaceBlendMode, %i[pointer uint32], :bool
53
+ attach_function :SDL_GetSurfaceBlendMode, %i[pointer pointer], :bool
54
+ attach_function :SDL_SetSurfaceClipRect, [:pointer, SDL_Rect.ptr], :bool
55
+ attach_function :SDL_GetSurfaceClipRect, [:pointer, SDL_Rect.ptr], :bool
56
+ attach_function :SDL_FlipSurface, [:pointer, SDL_FlipMode], :bool
57
+ attach_function :SDL_DuplicateSurface, [:pointer], :pointer
58
+ attach_function :SDL_ScaleSurface, [:pointer, :int, :int, SDL_ScaleMode], :pointer
59
+ attach_function :SDL_ConvertSurface, %i[pointer uint32], :pointer
60
+ attach_function :SDL_ConvertSurfaceAndColorspace, [:pointer, :uint32, :pointer, :uint32, :SDL_PropertiesID], :pointer
61
+ attach_function :SDL_PremultiplySurfaceAlpha, %i[pointer bool], :bool
62
+ attach_function :SDL_ClearSurface, %i[pointer float float float float], :bool
63
+ attach_function :SDL_FillSurfaceRect, [:pointer, SDL_Rect.ptr, :uint32], :bool
64
+ attach_function :SDL_FillSurfaceRects, [:pointer, SDL_Rect.ptr, :int, :uint32], :bool
65
+ attach_function :SDL_BlitSurface, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr], :bool
66
+ attach_function :SDL_BlitSurfaceUnchecked, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr], :bool
67
+ attach_function :SDL_BlitSurfaceScaled, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr, SDL_ScaleMode], :bool
68
+ attach_function :SDL_BlitSurfaceUncheckedScaled, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr, SDL_ScaleMode], :bool
69
+ attach_function :SDL_BlitSurfaceTiled, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr], :bool
70
+ attach_function :SDL_BlitSurfaceTiledWithScale, [:pointer, SDL_Rect.ptr, :float, SDL_ScaleMode, :pointer, SDL_Rect.ptr], :bool
71
+ attach_function :SDL_BlitSurface9Grid, [:pointer, SDL_Rect.ptr, :int, :int, :int, :int, :float, SDL_ScaleMode, :pointer, SDL_Rect.ptr], :bool
72
+ attach_function :SDL_MapSurfaceRGB, %i[pointer uint8 uint8 uint8], :uint32
73
+ attach_function :SDL_MapSurfaceRGBA, %i[pointer uint8 uint8 uint8 uint8], :uint32
74
+ attach_function :SDL_ReadSurfacePixel, %i[pointer int int pointer pointer pointer pointer], :bool
75
+ attach_function :SDL_ReadSurfacePixelFloat, %i[pointer int int pointer pointer pointer pointer], :bool
76
+ attach_function :SDL_WriteSurfacePixel, %i[pointer int int uint8 uint8 uint8 uint8], :bool
77
+ attach_function :SDL_WriteSurfacePixelFloat, %i[pointer int int float float float float], :bool
78
+ attach_function :SDL_LoadBMP_IO, %i[pointer bool], :pointer
79
+ attach_function :SDL_LoadBMP, [:string], :pointer
80
+ attach_function :SDL_SaveBMP_IO, %i[pointer pointer bool], :bool
81
+ attach_function :SDL_SaveBMP, %i[pointer string], :bool
82
+ end
83
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ SDL_Sandbox = enum :SDL_Sandbox, [
6
+ :SDL_SANDBOX_NONE, 0,
7
+ :SDL_SANDBOX_UNKNOWN_CONTAINER, 1,
8
+ :SDL_SANDBOX_FLATPAK, 2,
9
+ :SDL_SANDBOX_SNAP, 3,
10
+ :SDL_SANDBOX_MACOS, 4
11
+ ]
12
+
13
+ attach_function :SDL_IsTablet, [], :bool
14
+ attach_function :SDL_IsTV, [], :bool
15
+ attach_function :SDL_GetSandbox, [], :SDL_Sandbox
16
+
17
+ callback :SDL_WindowsMessageHook, [:pointer, :pointer, :uint, :uint64, :int64], :bool
18
+
19
+ begin
20
+ attach_function :SDL_SetWindowsMessageHook, [:SDL_WindowsMessageHook, :pointer], :void
21
+ attach_function :SDL_GetDirect3D9AdapterIndex, [:pointer], :int
22
+ attach_function :SDL_GetDXGIOutputInfo, [:pointer, :pointer, :pointer], :bool
23
+ rescue FFI::NotFoundError
24
+ end
25
+
26
+ begin
27
+ attach_function :SDL_GetAndroidJNIEnv, [], :pointer
28
+ attach_function :SDL_GetAndroidActivity, [], :pointer
29
+ attach_function :SDL_GetAndroidSDKVersion, [], :int
30
+ attach_function :SDL_IsChromebook, [], :bool
31
+ attach_function :SDL_IsDeXMode, [], :bool
32
+ attach_function :SDL_SendAndroidBackButton, [], :void
33
+ attach_function :SDL_GetAndroidInternalStoragePath, [], :string
34
+ attach_function :SDL_GetAndroidExternalStorageState, [], :uint32
35
+ attach_function :SDL_GetAndroidExternalStoragePath, [], :string
36
+ attach_function :SDL_GetAndroidCachePath, [], :string
37
+ callback :SDL_RequestAndroidPermissionCallback, [:pointer, :string, :bool], :void
38
+ attach_function :SDL_RequestAndroidPermission, [:string, :SDL_RequestAndroidPermissionCallback, :pointer], :bool
39
+ attach_function :SDL_ShowAndroidToast, [:string, :int, :int, :int, :int], :bool
40
+ attach_function :SDL_SendAndroidMessage, [:uint32, :int], :bool
41
+ rescue FFI::NotFoundError
42
+ end
43
+
44
+ begin
45
+ callback :SDL_iOSAnimationCallback, [:pointer], :void
46
+ attach_function :SDL_SetiOSAnimationCallback, [:pointer, :int, :SDL_iOSAnimationCallback, :pointer], :bool
47
+ attach_function :SDL_SetiOSEventPump, [:bool], :void
48
+ rescue FFI::NotFoundError
49
+ end
50
+
51
+ begin
52
+ attach_function :SDL_OnApplicationWillTerminate, [], :void
53
+ attach_function :SDL_OnApplicationDidReceiveMemoryWarning, [], :void
54
+ attach_function :SDL_OnApplicationWillEnterBackground, [], :void
55
+ attach_function :SDL_OnApplicationDidEnterBackground, [], :void
56
+ attach_function :SDL_OnApplicationWillEnterForeground, [], :void
57
+ attach_function :SDL_OnApplicationDidEnterForeground, [], :void
58
+ attach_function :SDL_OnApplicationDidChangeStatusBarOrientation, [], :void
59
+ rescue FFI::NotFoundError
60
+ end
61
+
62
+ begin
63
+ attach_function :SDL_GetGDKTaskQueue, [:pointer], :bool
64
+ attach_function :SDL_GetGDKDefaultUser, [:pointer], :bool
65
+ rescue FFI::NotFoundError
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ typedef :uint64, :SDL_ThreadID
6
+
7
+ SDL_ThreadPriority = enum :SDL_THREAD_PRIORITY_LOW, 0,
8
+ :SDL_THREAD_PRIORITY_NORMAL, 1,
9
+ :SDL_THREAD_PRIORITY_HIGH, 2,
10
+ :SDL_THREAD_PRIORITY_TIME_CRITICAL, 3
11
+
12
+ SDL_ThreadState = enum :SDL_THREAD_UNKNOWN, 0,
13
+ :SDL_THREAD_ALIVE, 1,
14
+ :SDL_THREAD_DETACHED, 2,
15
+ :SDL_THREAD_COMPLETE, 3
16
+
17
+ callback :SDL_ThreadFunction, [:pointer], :int
18
+ callback :SDL_TLSDestructorCallback, [:pointer], :void
19
+
20
+ attach_function :SDL_CreateThreadRuntime, [:SDL_ThreadFunction, :string, :pointer, :pointer, :pointer], :pointer
21
+ attach_function :SDL_CreateThreadWithPropertiesRuntime, [:SDL_PropertiesID, :pointer, :pointer], :pointer
22
+ attach_function :SDL_GetThreadName, [:pointer], :string
23
+ attach_function :SDL_GetCurrentThreadID, [], :SDL_ThreadID
24
+ attach_function :SDL_GetThreadID, [:pointer], :SDL_ThreadID
25
+ attach_function :SDL_SetCurrentThreadPriority, [SDL_ThreadPriority], :bool
26
+ attach_function :SDL_WaitThread, %i[pointer pointer], :void
27
+ attach_function :SDL_GetThreadState, [:pointer], SDL_ThreadState
28
+ attach_function :SDL_DetachThread, [:pointer], :void
29
+ attach_function :SDL_GetTLS, [:pointer], :pointer
30
+ attach_function :SDL_SetTLS, [:pointer, :pointer, :SDL_TLSDestructorCallback], :bool
31
+ attach_function :SDL_CleanupTLS, [], :void
32
+ end
33
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ typedef :int64, :SDL_Time
6
+
7
+ SDL_DateFormat = enum :SDL_DATE_FORMAT_YYYYMMDD, 0,
8
+ :SDL_DATE_FORMAT_DDMMYYYY, 1,
9
+ :SDL_DATE_FORMAT_MMDDYYYY, 2
10
+
11
+ SDL_TimeFormat = enum :SDL_TIME_FORMAT_24HR, 0,
12
+ :SDL_TIME_FORMAT_12HR, 1
13
+
14
+ class SDL_DateTime < FFI::Struct
15
+ layout :year, :int,
16
+ :month, :int,
17
+ :day, :int,
18
+ :hour, :int,
19
+ :minute, :int,
20
+ :second, :int,
21
+ :nanosecond, :int,
22
+ :day_of_week, :int,
23
+ :utc_offset, :int
24
+ end
25
+
26
+ attach_function :SDL_GetDateTimeLocalePreferences, %i[pointer pointer], :bool
27
+ attach_function :SDL_GetCurrentTime, [:pointer], :bool
28
+ attach_function :SDL_TimeToDateTime, [:SDL_Time, SDL_DateTime.ptr, :bool], :bool
29
+ attach_function :SDL_DateTimeToTime, [SDL_DateTime.ptr, :pointer], :bool
30
+ attach_function :SDL_TimeToWindows, [:SDL_Time, :pointer, :pointer], :void
31
+ attach_function :SDL_TimeFromWindows, %i[uint32 uint32], :SDL_Time
32
+ attach_function :SDL_GetDaysInMonth, %i[int int], :int
33
+ attach_function :SDL_GetDayOfYear, %i[int int int], :int
34
+ attach_function :SDL_GetDayOfWeek, %i[int int int], :int
35
+ end
36
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ callback :SDL_TimerCallback, %i[pointer SDL_TimerID uint32], :uint32
6
+ callback :SDL_NSTimerCallback, %i[pointer SDL_TimerID uint64], :uint64
7
+
8
+ attach_function :SDL_GetTicks, [], :uint64
9
+ attach_function :SDL_GetTicksNS, [], :uint64
10
+ attach_function :SDL_GetPerformanceCounter, [], :uint64
11
+ attach_function :SDL_GetPerformanceFrequency, [], :uint64
12
+ attach_function :SDL_Delay, [:uint32], :void
13
+ attach_function :SDL_DelayNS, [:uint64], :void
14
+ attach_function :SDL_DelayPrecise, [:uint64], :void
15
+ attach_function :SDL_AddTimer, [:uint32, :SDL_TimerCallback, :pointer], :SDL_TimerID
16
+ attach_function :SDL_AddTimerNS, [:uint64, :SDL_NSTimerCallback, :pointer], :SDL_TimerID
17
+ attach_function :SDL_RemoveTimer, [:SDL_TimerID], :bool
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ SDL_TouchDeviceType = enum :SDL_TOUCH_DEVICE_INVALID, -1,
6
+ :SDL_TOUCH_DEVICE_DIRECT, 0,
7
+ :SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, 1,
8
+ :SDL_TOUCH_DEVICE_INDIRECT_RELATIVE, 2
9
+
10
+ class SDL_Finger < FFI::Struct
11
+ layout :id, :SDL_FingerID,
12
+ :x, :float,
13
+ :y, :float,
14
+ :pressure, :float
15
+ end
16
+
17
+ attach_function :SDL_GetTouchDevices, [:pointer], :pointer
18
+ attach_function :SDL_GetTouchDeviceName, [:SDL_TouchID], :string
19
+ attach_function :SDL_GetTouchDeviceType, [:SDL_TouchID], SDL_TouchDeviceType
20
+ attach_function :SDL_GetTouchFingers, [:SDL_TouchID, :pointer], :pointer
21
+ end
22
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ SDL_TrayEntryFlags = enum :SDL_TRAYENTRY_BUTTON, 0x00000001,
6
+ :SDL_TRAYENTRY_CHECKBOX, 0x00000002,
7
+ :SDL_TRAYENTRY_SUBMENU, 0x00000004,
8
+ :SDL_TRAYENTRY_DISABLED, 0x80000000,
9
+ :SDL_TRAYENTRY_CHECKED, 0x40000000
10
+
11
+ callback :SDL_TrayCallback, %i[pointer pointer], :void
12
+
13
+ begin
14
+ attach_function :SDL_CreateTray, %i[pointer string], :pointer
15
+ attach_function :SDL_SetTrayIcon, %i[pointer pointer], :void
16
+ attach_function :SDL_SetTrayTooltip, %i[pointer string], :void
17
+ attach_function :SDL_CreateTrayMenu, [:pointer], :pointer
18
+ attach_function :SDL_CreateTraySubmenu, [:pointer], :pointer
19
+ attach_function :SDL_GetTrayMenu, [:pointer], :pointer
20
+ attach_function :SDL_GetTraySubmenu, [:pointer], :pointer
21
+ attach_function :SDL_GetTrayEntries, %i[pointer pointer], :pointer
22
+ attach_function :SDL_RemoveTrayEntry, [:pointer], :void
23
+ attach_function :SDL_InsertTrayEntryAt, %i[pointer int string uint32], :pointer
24
+ attach_function :SDL_SetTrayEntryLabel, %i[pointer string], :void
25
+ attach_function :SDL_GetTrayEntryLabel, [:pointer], :string
26
+ attach_function :SDL_SetTrayEntryChecked, %i[pointer bool], :void
27
+ attach_function :SDL_GetTrayEntryChecked, [:pointer], :bool
28
+ attach_function :SDL_SetTrayEntryEnabled, %i[pointer bool], :void
29
+ attach_function :SDL_GetTrayEntryEnabled, [:pointer], :bool
30
+ attach_function :SDL_SetTrayEntryCallback, [:pointer, :SDL_TrayCallback, :pointer], :void
31
+ attach_function :SDL_ClickTrayEntry, [:pointer], :void
32
+ attach_function :SDL_DestroyTray, [:pointer], :void
33
+ attach_function :SDL_GetTrayEntryParent, [:pointer], :pointer
34
+ attach_function :SDL_GetTrayMenuParentEntry, [:pointer], :pointer
35
+ attach_function :SDL_GetTrayMenuParentTray, [:pointer], :pointer
36
+ rescue FFI::NotFoundError
37
+ # Tray API may not be available in all SDL3 versions
38
+ end
39
+ end
40
+ end