sdl3 1.0.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.
Files changed (88) 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 +40 -0
  29. data/lib/sdl3/raw/audio.rb +95 -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 +29 -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 +15 -0
  39. data/lib/sdl3/raw/events.rb +563 -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 +734 -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 +88 -0
  49. data/lib/sdl3/raw/joystick.rb +101 -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 +61 -0
  55. data/lib/sdl3/raw/main.rb +23 -0
  56. data/lib/sdl3/raw/messagebox.rb +50 -0
  57. data/lib/sdl3/raw/metal.rb +9 -0
  58. data/lib/sdl3/raw/misc.rb +7 -0
  59. data/lib/sdl3/raw/mouse.rb +82 -0
  60. data/lib/sdl3/raw/mutex.rb +48 -0
  61. data/lib/sdl3/raw/openxr.rb +21 -0
  62. data/lib/sdl3/raw/pen.rb +38 -0
  63. data/lib/sdl3/raw/pixels.rb +180 -0
  64. data/lib/sdl3/raw/platform.rb +7 -0
  65. data/lib/sdl3/raw/power.rb +14 -0
  66. data/lib/sdl3/raw/process.rb +15 -0
  67. data/lib/sdl3/raw/properties.rb +39 -0
  68. data/lib/sdl3/raw/rect.rb +41 -0
  69. data/lib/sdl3/raw/render.rb +153 -0
  70. data/lib/sdl3/raw/scancode.rb +112 -0
  71. data/lib/sdl3/raw/sensor.rb +31 -0
  72. data/lib/sdl3/raw/stdinc.rb +209 -0
  73. data/lib/sdl3/raw/storage.rb +50 -0
  74. data/lib/sdl3/raw/surface.rb +106 -0
  75. data/lib/sdl3/raw/system.rb +77 -0
  76. data/lib/sdl3/raw/thread.rb +40 -0
  77. data/lib/sdl3/raw/time.rb +36 -0
  78. data/lib/sdl3/raw/timer.rb +19 -0
  79. data/lib/sdl3/raw/touch.rb +22 -0
  80. data/lib/sdl3/raw/tray.rb +42 -0
  81. data/lib/sdl3/raw/types.rb +21 -0
  82. data/lib/sdl3/raw/version.rb +8 -0
  83. data/lib/sdl3/raw/video.rb +208 -0
  84. data/lib/sdl3/raw/vulkan.rb +13 -0
  85. data/lib/sdl3/version.rb +5 -0
  86. data/lib/sdl3.rb +128 -0
  87. data/sdl3.gemspec +30 -0
  88. metadata +143 -0
@@ -0,0 +1,153 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ SDL_TextureAccess = enum :SDL_TEXTUREACCESS_STATIC, 0,
6
+ :SDL_TEXTUREACCESS_STREAMING, 1,
7
+ :SDL_TEXTUREACCESS_TARGET, 2
8
+
9
+ SDL_TextureAddressMode = enum :SDL_TEXTURE_ADDRESS_INVALID, -1,
10
+ :SDL_TEXTURE_ADDRESS_AUTO, 0,
11
+ :SDL_TEXTURE_ADDRESS_CLAMP, 1,
12
+ :SDL_TEXTURE_ADDRESS_WRAP, 2
13
+
14
+ SDL_RendererLogicalPresentation = enum :SDL_LOGICAL_PRESENTATION_DISABLED, 0,
15
+ :SDL_LOGICAL_PRESENTATION_STRETCH, 1,
16
+ :SDL_LOGICAL_PRESENTATION_LETTERBOX, 2,
17
+ :SDL_LOGICAL_PRESENTATION_OVERSCAN, 3,
18
+ :SDL_LOGICAL_PRESENTATION_INTEGER_SCALE, 4
19
+
20
+ class SDL_Vertex < FFI::Struct
21
+ layout :position, SDL_FPoint,
22
+ :color, SDL_FColor,
23
+ :tex_coord, SDL_FPoint
24
+ end
25
+
26
+ attach_function :SDL_GetNumRenderDrivers, [], :int
27
+ attach_function :SDL_GetRenderDriver, [:int], :string
28
+ begin
29
+ attach_function :SDL_CreateWindowAndRenderer, %i[string int int uint64 pointer pointer], :bool
30
+ rescue FFI::NotFoundError
31
+ # Added in newer SDL3 versions.
32
+ end
33
+ attach_function :SDL_CreateRenderer, %i[pointer string], :pointer
34
+ attach_function :SDL_CreateRendererWithProperties, [:SDL_PropertiesID], :pointer
35
+ begin
36
+ attach_function :SDL_CreateGPURenderer, %i[pointer pointer], :pointer
37
+ attach_function :SDL_GetGPURendererDevice, [:pointer], :pointer
38
+ rescue FFI::NotFoundError
39
+ # Added in newer SDL3 versions.
40
+ end
41
+ attach_function :SDL_CreateSoftwareRenderer, [SDL_Surface.ptr], :pointer
42
+ attach_function :SDL_GetRenderer, [:pointer], :pointer
43
+ attach_function :SDL_GetRenderWindow, [:pointer], :pointer
44
+ attach_function :SDL_GetRendererName, [:pointer], :string
45
+ attach_function :SDL_GetRendererProperties, [:pointer], :SDL_PropertiesID
46
+ attach_function :SDL_GetRenderOutputSize, %i[pointer pointer pointer], :bool
47
+ attach_function :SDL_GetCurrentRenderOutputSize, %i[pointer pointer pointer], :bool
48
+ attach_function :SDL_CreateTexture, %i[pointer uint32 int int int], :pointer
49
+ attach_function :SDL_CreateTextureFromSurface, [:pointer, SDL_Surface.ptr], :pointer
50
+ attach_function :SDL_CreateTextureWithProperties, [:pointer, :SDL_PropertiesID], :pointer
51
+ attach_function :SDL_GetTextureProperties, [:pointer], :SDL_PropertiesID
52
+ attach_function :SDL_GetRendererFromTexture, [:pointer], :pointer
53
+ attach_function :SDL_GetTextureSize, %i[pointer pointer pointer], :bool
54
+ attach_function :SDL_SetTextureColorMod, %i[pointer uint8 uint8 uint8], :bool
55
+ attach_function :SDL_SetTextureColorModFloat, %i[pointer float float float], :bool
56
+ attach_function :SDL_GetTextureColorMod, %i[pointer pointer pointer pointer], :bool
57
+ attach_function :SDL_GetTextureColorModFloat, %i[pointer pointer pointer pointer], :bool
58
+ attach_function :SDL_SetTextureAlphaMod, %i[pointer uint8], :bool
59
+ attach_function :SDL_SetTextureAlphaModFloat, %i[pointer float], :bool
60
+ attach_function :SDL_GetTextureAlphaMod, %i[pointer pointer], :bool
61
+ attach_function :SDL_GetTextureAlphaModFloat, %i[pointer pointer], :bool
62
+ attach_function :SDL_SetTextureBlendMode, %i[pointer uint32], :bool
63
+ attach_function :SDL_GetTextureBlendMode, %i[pointer pointer], :bool
64
+ attach_function :SDL_SetTextureScaleMode, [:pointer, SDL_ScaleMode], :bool
65
+ attach_function :SDL_GetTextureScaleMode, [:pointer, :pointer], :bool
66
+ begin
67
+ attach_function :SDL_SetTexturePalette, %i[pointer pointer], :bool
68
+ attach_function :SDL_GetTexturePalette, [:pointer], :pointer
69
+ rescue FFI::NotFoundError
70
+ # Added in newer SDL3 versions.
71
+ end
72
+ attach_function :SDL_UpdateTexture, [:pointer, SDL_Rect.ptr, :pointer, :int], :bool
73
+ attach_function :SDL_UpdateYUVTexture, [:pointer, SDL_Rect.ptr, :pointer, :int, :pointer, :int, :pointer, :int], :bool
74
+ attach_function :SDL_UpdateNVTexture, [:pointer, SDL_Rect.ptr, :pointer, :int, :pointer, :int], :bool
75
+ attach_function :SDL_LockTexture, [:pointer, SDL_Rect.ptr, :pointer, :pointer], :bool
76
+ attach_function :SDL_LockTextureToSurface, [:pointer, SDL_Rect.ptr, :pointer], :bool
77
+ attach_function :SDL_UnlockTexture, [:pointer], :void
78
+ attach_function :SDL_SetRenderTarget, %i[pointer pointer], :bool
79
+ attach_function :SDL_GetRenderTarget, [:pointer], :pointer
80
+ attach_function :SDL_SetRenderLogicalPresentation, [:pointer, :int, :int, SDL_RendererLogicalPresentation, SDL_ScaleMode], :bool
81
+ attach_function :SDL_GetRenderLogicalPresentation, %i[pointer pointer pointer pointer pointer], :bool
82
+ attach_function :SDL_GetRenderLogicalPresentationRect, [:pointer, SDL_FRect.ptr], :bool
83
+ attach_function :SDL_RenderCoordinatesFromWindow, %i[pointer float float pointer pointer], :bool
84
+ attach_function :SDL_RenderCoordinatesToWindow, %i[pointer float float pointer pointer], :bool
85
+ attach_function :SDL_ConvertEventToRenderCoordinates, %i[pointer pointer], :bool
86
+ attach_function :SDL_SetRenderViewport, [:pointer, SDL_Rect.ptr], :bool
87
+ attach_function :SDL_GetRenderViewport, [:pointer, SDL_Rect.ptr], :bool
88
+ attach_function :SDL_RenderViewportSet, [:pointer], :bool
89
+ attach_function :SDL_GetRenderSafeArea, [:pointer, SDL_Rect.ptr], :bool
90
+ attach_function :SDL_SetRenderClipRect, [:pointer, SDL_Rect.ptr], :bool
91
+ attach_function :SDL_GetRenderClipRect, [:pointer, SDL_Rect.ptr], :bool
92
+ attach_function :SDL_RenderClipEnabled, [:pointer], :bool
93
+ attach_function :SDL_SetRenderScale, %i[pointer float float], :bool
94
+ attach_function :SDL_GetRenderScale, %i[pointer pointer pointer], :bool
95
+ attach_function :SDL_SetRenderDrawColor, %i[pointer uint8 uint8 uint8 uint8], :bool
96
+ attach_function :SDL_SetRenderDrawColorFloat, %i[pointer float float float float], :bool
97
+ attach_function :SDL_GetRenderDrawColor, %i[pointer pointer pointer pointer pointer], :bool
98
+ attach_function :SDL_GetRenderDrawColorFloat, %i[pointer pointer pointer pointer pointer], :bool
99
+ attach_function :SDL_SetRenderColorScale, %i[pointer float], :bool
100
+ attach_function :SDL_GetRenderColorScale, %i[pointer pointer], :bool
101
+ attach_function :SDL_SetRenderDrawBlendMode, %i[pointer uint32], :bool
102
+ attach_function :SDL_GetRenderDrawBlendMode, %i[pointer pointer], :bool
103
+ attach_function :SDL_RenderClear, [:pointer], :bool
104
+ attach_function :SDL_RenderPoint, %i[pointer float float], :bool
105
+ attach_function :SDL_RenderPoints, [:pointer, SDL_FPoint.ptr, :int], :bool
106
+ attach_function :SDL_RenderLine, %i[pointer float float float float], :bool
107
+ attach_function :SDL_RenderLines, [:pointer, SDL_FPoint.ptr, :int], :bool
108
+ attach_function :SDL_RenderRect, [:pointer, SDL_FRect.ptr], :bool
109
+ attach_function :SDL_RenderRects, [:pointer, SDL_FRect.ptr, :int], :bool
110
+ attach_function :SDL_RenderFillRect, [:pointer, SDL_FRect.ptr], :bool
111
+ attach_function :SDL_RenderFillRects, [:pointer, SDL_FRect.ptr, :int], :bool
112
+ attach_function :SDL_RenderTexture, [:pointer, :pointer, SDL_FRect.ptr, SDL_FRect.ptr], :bool
113
+ attach_function :SDL_RenderTextureRotated, [:pointer, :pointer, SDL_FRect.ptr, SDL_FRect.ptr, :double, SDL_FPoint.ptr, SDL_FlipMode], :bool
114
+ begin
115
+ attach_function :SDL_RenderTextureAffine, %i[pointer pointer pointer pointer pointer pointer], :bool
116
+ rescue FFI::NotFoundError
117
+ # Added in newer SDL3 versions.
118
+ end
119
+ attach_function :SDL_RenderTextureTiled, [:pointer, :pointer, SDL_FRect.ptr, :float, SDL_FRect.ptr], :bool
120
+ attach_function :SDL_RenderTexture9Grid, [:pointer, :pointer, SDL_FRect.ptr, :float, :float, :float, :float, :float, SDL_FRect.ptr], :bool
121
+ begin
122
+ attach_function :SDL_RenderTexture9GridTiled, %i[pointer pointer pointer float float float float float pointer float], :bool
123
+ attach_function :SDL_SetRenderTextureAddressMode, [:pointer, SDL_TextureAddressMode, SDL_TextureAddressMode], :bool
124
+ attach_function :SDL_GetRenderTextureAddressMode, %i[pointer pointer pointer], :bool
125
+ rescue FFI::NotFoundError
126
+ # Added in newer SDL3 versions.
127
+ end
128
+ attach_function :SDL_RenderGeometry, [:pointer, :pointer, SDL_Vertex.ptr, :int, :pointer, :int], :bool
129
+ attach_function :SDL_RenderGeometryRaw, [:pointer, :pointer, :pointer, :int, SDL_FColor.ptr, :int, :pointer, :int, :int, :pointer, :int, :int], :bool
130
+ attach_function :SDL_RenderReadPixels, [:pointer, SDL_Rect.ptr], SDL_Surface.ptr
131
+ attach_function :SDL_RenderPresent, [:pointer], :bool
132
+ attach_function :SDL_DestroyTexture, [:pointer], :void
133
+ attach_function :SDL_DestroyRenderer, [:pointer], :void
134
+ attach_function :SDL_FlushRenderer, [:pointer], :bool
135
+ attach_function :SDL_GetRenderMetalLayer, [:pointer], :pointer
136
+ attach_function :SDL_GetRenderMetalCommandEncoder, [:pointer], :pointer
137
+ attach_function :SDL_AddVulkanRenderSemaphores, %i[pointer uint32 int64 int64], :bool
138
+ attach_function :SDL_SetRenderVSync, %i[pointer int], :bool
139
+ attach_function :SDL_GetRenderVSync, %i[pointer pointer], :bool
140
+ begin
141
+ attach_function :SDL_RenderDebugText, %i[pointer float float string], :bool
142
+ attach_function :SDL_RenderDebugTextFormat, [:pointer, :float, :float, :string, :varargs], :bool
143
+ attach_function :SDL_SetDefaultTextureScaleMode, [:pointer, SDL_ScaleMode], :bool
144
+ attach_function :SDL_GetDefaultTextureScaleMode, [:pointer, :pointer], :bool
145
+ attach_function :SDL_CreateGPURenderState, %i[pointer pointer], :pointer
146
+ attach_function :SDL_SetGPURenderStateFragmentUniforms, %i[pointer uint32 pointer uint32], :bool
147
+ attach_function :SDL_SetGPURenderState, %i[pointer pointer], :bool
148
+ attach_function :SDL_DestroyGPURenderState, [:pointer], :void
149
+ rescue FFI::NotFoundError
150
+ # Added in newer SDL3 versions.
151
+ end
152
+ end
153
+ end
@@ -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,209 @@
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
+ begin
28
+ attach_function :SDL_CreateEnvironment, [:bool], :pointer
29
+ attach_function :SDL_DestroyEnvironment, [:pointer], :void
30
+ attach_function :SDL_GetEnvironment, [], :pointer
31
+ attach_function :SDL_GetEnvironmentVariable, %i[pointer string], :string
32
+ attach_function :SDL_GetEnvironmentVariables, [:pointer], :pointer
33
+ attach_function :SDL_SetEnvironmentVariable, %i[pointer string string bool], :bool
34
+ attach_function :SDL_UnsetEnvironmentVariable, %i[pointer string], :bool
35
+ attach_function :SDL_GetMemoryFunctions, %i[pointer pointer pointer pointer], :void
36
+ attach_function :SDL_GetOriginalMemoryFunctions, %i[pointer pointer pointer pointer], :void
37
+ attach_function :SDL_SetMemoryFunctions, %i[pointer pointer pointer pointer], :bool
38
+ rescue FFI::NotFoundError
39
+ # Added in newer SDL3 versions.
40
+ end
41
+
42
+ attach_function :SDL_qsort, [:pointer, :size_t, :size_t, :pointer], :void
43
+ attach_function :SDL_bsearch, [:pointer, :pointer, :size_t, :size_t, :pointer], :pointer
44
+ attach_function :SDL_qsort_r, [:pointer, :size_t, :size_t, :pointer, :pointer], :void
45
+ attach_function :SDL_bsearch_r, [:pointer, :pointer, :size_t, :size_t, :pointer, :pointer], :pointer
46
+
47
+ attach_function :SDL_abs, [:int], :int
48
+ attach_function :SDL_isalpha, [:int], :int
49
+ attach_function :SDL_isalnum, [:int], :int
50
+ attach_function :SDL_isblank, [:int], :int
51
+ attach_function :SDL_iscntrl, [:int], :int
52
+ attach_function :SDL_isdigit, [:int], :int
53
+ attach_function :SDL_isxdigit, [:int], :int
54
+ attach_function :SDL_ispunct, [:int], :int
55
+ attach_function :SDL_isspace, [:int], :int
56
+ attach_function :SDL_isupper, [:int], :int
57
+ attach_function :SDL_islower, [:int], :int
58
+ attach_function :SDL_isprint, [:int], :int
59
+ attach_function :SDL_isgraph, [:int], :int
60
+ attach_function :SDL_toupper, [:int], :int
61
+ attach_function :SDL_tolower, [:int], :int
62
+
63
+ attach_function :SDL_crc16, [:uint16, :pointer, :size_t], :uint16
64
+ attach_function :SDL_crc32, [:uint32, :pointer, :size_t], :uint32
65
+ attach_function :SDL_murmur3_32, [:pointer, :size_t, :uint32], :uint32
66
+
67
+ attach_function :SDL_memcpy, [:pointer, :pointer, :size_t], :pointer
68
+ attach_function :SDL_memmove, [:pointer, :pointer, :size_t], :pointer
69
+ attach_function :SDL_memset, [:pointer, :int, :size_t], :pointer
70
+ attach_function :SDL_memset4, [:pointer, :uint32, :size_t], :pointer
71
+ attach_function :SDL_memcmp, [:pointer, :pointer, :size_t], :int
72
+
73
+ attach_function :SDL_wcslen, [:pointer], :size_t
74
+ attach_function :SDL_wcsnlen, [:pointer, :size_t], :size_t
75
+ attach_function :SDL_wcslcpy, [:pointer, :pointer, :size_t], :size_t
76
+ attach_function :SDL_wcslcat, [:pointer, :pointer, :size_t], :size_t
77
+ attach_function :SDL_wcsdup, [:pointer], :pointer
78
+ attach_function :SDL_wcsstr, [:pointer, :pointer], :pointer
79
+ attach_function :SDL_wcsnstr, [:pointer, :pointer, :size_t], :pointer
80
+ attach_function :SDL_wcscmp, [:pointer, :pointer], :int
81
+ attach_function :SDL_wcsncmp, [:pointer, :pointer, :size_t], :int
82
+ attach_function :SDL_wcscasecmp, [:pointer, :pointer], :int
83
+ attach_function :SDL_wcsncasecmp, [:pointer, :pointer, :size_t], :int
84
+ attach_function :SDL_wcstol, [:pointer, :pointer, :int], :long
85
+
86
+ attach_function :SDL_strlen, [:string], :size_t
87
+ attach_function :SDL_strnlen, [:string, :size_t], :size_t
88
+ attach_function :SDL_strlcpy, [:pointer, :string, :size_t], :size_t
89
+ attach_function :SDL_utf8strlcpy, [:pointer, :string, :size_t], :size_t
90
+ attach_function :SDL_strlcat, [:pointer, :string, :size_t], :size_t
91
+ attach_function :SDL_strdup, [:string], :pointer
92
+ attach_function :SDL_strndup, [:string, :size_t], :pointer
93
+ attach_function :SDL_strrev, [:pointer], :pointer
94
+ attach_function :SDL_strupr, [:pointer], :pointer
95
+ attach_function :SDL_strlwr, [:pointer], :pointer
96
+ attach_function :SDL_strchr, [:string, :int], :pointer
97
+ attach_function :SDL_strrchr, [:string, :int], :pointer
98
+ attach_function :SDL_strstr, [:string, :string], :pointer
99
+ attach_function :SDL_strnstr, [:string, :string, :size_t], :pointer
100
+ attach_function :SDL_strcasestr, [:string, :string], :pointer
101
+ attach_function :SDL_strtok_r, [:pointer, :string, :pointer], :pointer
102
+ attach_function :SDL_utf8strlen, [:string], :size_t
103
+ attach_function :SDL_utf8strnlen, [:string, :size_t], :size_t
104
+
105
+ attach_function :SDL_itoa, [:int, :pointer, :int], :pointer
106
+ attach_function :SDL_uitoa, [:uint, :pointer, :int], :pointer
107
+ attach_function :SDL_ltoa, [:long, :pointer, :int], :pointer
108
+ attach_function :SDL_ultoa, [:ulong, :pointer, :int], :pointer
109
+ attach_function :SDL_lltoa, [:long_long, :pointer, :int], :pointer
110
+ attach_function :SDL_ulltoa, [:ulong_long, :pointer, :int], :pointer
111
+
112
+ attach_function :SDL_atoi, [:string], :int
113
+ attach_function :SDL_atof, [:string], :double
114
+ attach_function :SDL_strtol, [:string, :pointer, :int], :long
115
+ attach_function :SDL_strtoul, [:string, :pointer, :int], :ulong
116
+ attach_function :SDL_strtoll, [:string, :pointer, :int], :long_long
117
+ attach_function :SDL_strtoull, [:string, :pointer, :int], :ulong_long
118
+ attach_function :SDL_strtod, [:string, :pointer], :double
119
+
120
+ attach_function :SDL_strcmp, [:string, :string], :int
121
+ attach_function :SDL_strncmp, [:string, :string, :size_t], :int
122
+ attach_function :SDL_strcasecmp, [:string, :string], :int
123
+ attach_function :SDL_strncasecmp, [:string, :string, :size_t], :int
124
+ attach_function :SDL_strpbrk, [:string, :string], :pointer
125
+
126
+ begin
127
+ attach_function :SDL_srand, [:uint64], :void
128
+ attach_function :SDL_rand, [:int32], :int32
129
+ attach_function :SDL_rand_bits, [], :uint32
130
+ attach_function :SDL_rand_bits_r, [:pointer], :uint32
131
+ attach_function :SDL_rand_r, %i[pointer int32], :int32
132
+ attach_function :SDL_randf, [], :float
133
+ attach_function :SDL_randf_r, [:pointer], :float
134
+
135
+ attach_function :SDL_sscanf, [:string, :string, :varargs], :int
136
+ attach_function :SDL_vsscanf, %i[string string pointer], :int
137
+ attach_function :SDL_snprintf, [:pointer, :size_t, :string, :varargs], :int
138
+ attach_function :SDL_swprintf, [:pointer, :size_t, :pointer, :varargs], :int
139
+ attach_function :SDL_vsnprintf, %i[pointer size_t string pointer], :int
140
+ attach_function :SDL_vswprintf, %i[pointer size_t pointer pointer], :int
141
+ attach_function :SDL_asprintf, [:pointer, :string, :varargs], :int
142
+ attach_function :SDL_vasprintf, %i[pointer string pointer], :int
143
+ rescue FFI::NotFoundError
144
+ # Added in newer SDL3 versions.
145
+ end
146
+
147
+ attach_function :SDL_StepUTF8, [:pointer, :pointer], :uint32
148
+ begin
149
+ attach_function :SDL_StepBackUTF8, %i[string pointer], :uint32
150
+ rescue FFI::NotFoundError
151
+ # Added in newer SDL3 versions.
152
+ end
153
+ attach_function :SDL_UCS4ToUTF8, [:uint32, :pointer], :pointer
154
+
155
+ attach_function :SDL_acos, [:double], :double
156
+ attach_function :SDL_acosf, [:float], :float
157
+ attach_function :SDL_asin, [:double], :double
158
+ attach_function :SDL_asinf, [:float], :float
159
+ attach_function :SDL_atan, [:double], :double
160
+ attach_function :SDL_atanf, [:float], :float
161
+ attach_function :SDL_atan2, [:double, :double], :double
162
+ attach_function :SDL_atan2f, [:float, :float], :float
163
+ attach_function :SDL_ceil, [:double], :double
164
+ attach_function :SDL_ceilf, [:float], :float
165
+ attach_function :SDL_copysign, [:double, :double], :double
166
+ attach_function :SDL_copysignf, [:float, :float], :float
167
+ attach_function :SDL_cos, [:double], :double
168
+ attach_function :SDL_cosf, [:float], :float
169
+ attach_function :SDL_exp, [:double], :double
170
+ attach_function :SDL_expf, [:float], :float
171
+ attach_function :SDL_fabs, [:double], :double
172
+ attach_function :SDL_fabsf, [:float], :float
173
+ attach_function :SDL_floor, [:double], :double
174
+ attach_function :SDL_floorf, [:float], :float
175
+ attach_function :SDL_trunc, [:double], :double
176
+ attach_function :SDL_truncf, [:float], :float
177
+ attach_function :SDL_fmod, [:double, :double], :double
178
+ attach_function :SDL_fmodf, [:float, :float], :float
179
+ attach_function :SDL_isinf, [:double], :int
180
+ attach_function :SDL_isinff, [:float], :int
181
+ attach_function :SDL_isnan, [:double], :int
182
+ attach_function :SDL_isnanf, [:float], :int
183
+ attach_function :SDL_log, [:double], :double
184
+ attach_function :SDL_logf, [:float], :float
185
+ attach_function :SDL_log10, [:double], :double
186
+ attach_function :SDL_log10f, [:float], :float
187
+ attach_function :SDL_modf, [:double, :pointer], :double
188
+ attach_function :SDL_modff, [:float, :pointer], :float
189
+ attach_function :SDL_pow, [:double, :double], :double
190
+ attach_function :SDL_powf, [:float, :float], :float
191
+ attach_function :SDL_round, [:double], :double
192
+ attach_function :SDL_roundf, [:float], :float
193
+ attach_function :SDL_lround, [:double], :long
194
+ attach_function :SDL_lroundf, [:float], :long
195
+ attach_function :SDL_scalbn, [:double, :int], :double
196
+ attach_function :SDL_scalbnf, [:float, :int], :float
197
+ attach_function :SDL_sin, [:double], :double
198
+ attach_function :SDL_sinf, [:float], :float
199
+ attach_function :SDL_sqrt, [:double], :double
200
+ attach_function :SDL_sqrtf, [:float], :float
201
+ attach_function :SDL_tan, [:double], :double
202
+ attach_function :SDL_tanf, [:float], :float
203
+
204
+ attach_function :SDL_iconv_open, [:string, :string], :pointer
205
+ attach_function :SDL_iconv_close, [:pointer], :int
206
+ attach_function :SDL_iconv, [:pointer, :pointer, :pointer, :pointer, :pointer], :size_t
207
+ attach_function :SDL_iconv_string, [:string, :string, :string, :size_t], :pointer
208
+ end
209
+ 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,106 @@
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
+ begin
63
+ attach_function :SDL_ConvertPixels, %i[int int uint32 pointer int uint32 pointer int], :bool
64
+ attach_function :SDL_ConvertPixelsAndColorspace, %i[int int uint32 uint32 SDL_PropertiesID pointer int uint32 uint32 SDL_PropertiesID pointer int], :bool
65
+ attach_function :SDL_PremultiplyAlpha, %i[int int uint32 pointer int uint32 pointer int bool], :bool
66
+ rescue FFI::NotFoundError
67
+ # Added in newer SDL3 versions.
68
+ end
69
+ attach_function :SDL_ClearSurface, %i[pointer float float float float], :bool
70
+ attach_function :SDL_FillSurfaceRect, [:pointer, SDL_Rect.ptr, :uint32], :bool
71
+ attach_function :SDL_FillSurfaceRects, [:pointer, SDL_Rect.ptr, :int, :uint32], :bool
72
+ attach_function :SDL_BlitSurface, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr], :bool
73
+ attach_function :SDL_BlitSurfaceUnchecked, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr], :bool
74
+ attach_function :SDL_BlitSurfaceScaled, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr, SDL_ScaleMode], :bool
75
+ attach_function :SDL_BlitSurfaceUncheckedScaled, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr, SDL_ScaleMode], :bool
76
+ attach_function :SDL_BlitSurfaceTiled, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr], :bool
77
+ attach_function :SDL_BlitSurfaceTiledWithScale, [:pointer, SDL_Rect.ptr, :float, SDL_ScaleMode, :pointer, SDL_Rect.ptr], :bool
78
+ attach_function :SDL_BlitSurface9Grid, [:pointer, SDL_Rect.ptr, :int, :int, :int, :int, :float, SDL_ScaleMode, :pointer, SDL_Rect.ptr], :bool
79
+ attach_function :SDL_MapSurfaceRGB, %i[pointer uint8 uint8 uint8], :uint32
80
+ attach_function :SDL_MapSurfaceRGBA, %i[pointer uint8 uint8 uint8 uint8], :uint32
81
+ attach_function :SDL_ReadSurfacePixel, %i[pointer int int pointer pointer pointer pointer], :bool
82
+ attach_function :SDL_ReadSurfacePixelFloat, %i[pointer int int pointer pointer pointer pointer], :bool
83
+ attach_function :SDL_WriteSurfacePixel, %i[pointer int int uint8 uint8 uint8 uint8], :bool
84
+ attach_function :SDL_WriteSurfacePixelFloat, %i[pointer int int float float float float], :bool
85
+ attach_function :SDL_LoadBMP_IO, %i[pointer bool], :pointer
86
+ attach_function :SDL_LoadBMP, [:string], :pointer
87
+ begin
88
+ attach_function :SDL_LoadSurface_IO, %i[pointer bool], :pointer
89
+ attach_function :SDL_LoadSurface, [:string], :pointer
90
+ attach_function :SDL_LoadPNG_IO, %i[pointer bool], :pointer
91
+ attach_function :SDL_LoadPNG, [:string], :pointer
92
+ rescue FFI::NotFoundError
93
+ # Added in newer SDL3 versions.
94
+ end
95
+ attach_function :SDL_SaveBMP_IO, %i[pointer pointer bool], :bool
96
+ attach_function :SDL_SaveBMP, %i[pointer string], :bool
97
+ begin
98
+ attach_function :SDL_SavePNG_IO, %i[pointer pointer bool], :bool
99
+ attach_function :SDL_SavePNG, %i[pointer string], :bool
100
+ attach_function :SDL_RotateSurface, %i[pointer float], :pointer
101
+ attach_function :SDL_StretchSurface, [:pointer, SDL_Rect.ptr, :pointer, SDL_Rect.ptr, SDL_ScaleMode], :bool
102
+ rescue FFI::NotFoundError
103
+ # Added in newer SDL3 versions.
104
+ end
105
+ end
106
+ end