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
data/lib/sdl3_ttf.rb ADDED
@@ -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_pixels'
9
+
10
+ module SDL
11
+ extend FFI::Library
12
+ # Define/Macro
13
+
14
+ TTF_MAJOR_VERSION = 3
15
+ TTF_MINOR_VERSION = 1
16
+ TTF_MICRO_VERSION = 0
17
+ TTF_PROP_FONT_CREATE_FILENAME_STRING = "SDL_ttf.font.create.filename"
18
+ TTF_PROP_FONT_CREATE_IOSTREAM_POINTER = "SDL_ttf.font.create.iostream"
19
+ TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER = "SDL_ttf.font.create.iostream.offset"
20
+ TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN = "SDL_ttf.font.create.iostream.autoclose"
21
+ TTF_PROP_FONT_CREATE_SIZE_FLOAT = "SDL_ttf.font.create.size"
22
+ TTF_PROP_FONT_CREATE_FACE_NUMBER = "SDL_ttf.font.create.face"
23
+ TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER = "SDL_ttf.font.create.hdpi"
24
+ TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER = "SDL_ttf.font.create.vdpi"
25
+ TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER = "SDL_ttf.font.outline.line_cap"
26
+ TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER = "SDL_ttf.font.outline.line_join"
27
+ TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER = "SDL_ttf.font.outline.miter_limit"
28
+ TTF_STYLE_NORMAL = 0x00
29
+ TTF_STYLE_BOLD = 0x01
30
+ TTF_STYLE_ITALIC = 0x02
31
+ TTF_STYLE_UNDERLINE = 0x04
32
+ TTF_STYLE_STRIKETHROUGH = 0x08
33
+ TTF_SUBSTRING_TEXT_START = 0x00000001
34
+ TTF_SUBSTRING_LINE_START = 0x00000002
35
+ TTF_SUBSTRING_LINE_END = 0x00000004
36
+ TTF_SUBSTRING_TEXT_END = 0x00000008
37
+
38
+ # Enum
39
+
40
+ TTF_HINTING_NORMAL = 0
41
+ TTF_HINTING_LIGHT = 1
42
+ TTF_HINTING_MONO = 2
43
+ TTF_HINTING_NONE = 3
44
+ TTF_HINTING_LIGHT_SUBPIXEL = 4
45
+ TTF_HORIZONTAL_ALIGN_INVALID = -1
46
+ TTF_HORIZONTAL_ALIGN_LEFT = 0
47
+ TTF_HORIZONTAL_ALIGN_CENTER = 1
48
+ TTF_HORIZONTAL_ALIGN_RIGHT = 2
49
+ TTF_DIRECTION_LTR = 0
50
+ TTF_DIRECTION_RTL = 1
51
+ TTF_DIRECTION_TTB = 2
52
+ TTF_DIRECTION_BTT = 3
53
+ TTF_GPU_TEXTENGINE_WINDING_INVALID = -1
54
+ TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE = 0
55
+ TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE = 1
56
+
57
+ # Typedef
58
+
59
+ typedef :uint, :TTF_FontStyleFlags
60
+ typedef :int, :TTF_HintingFlags
61
+ typedef :int, :TTF_HorizontalAlignment
62
+ typedef :int, :TTF_Direction
63
+ typedef :int, :TTF_GPUTextEngineWinding
64
+ typedef :uint, :TTF_SubStringFlags
65
+
66
+ # Struct
67
+
68
+ class TTF_Text < FFI::Struct
69
+ layout(
70
+ :text, :pointer,
71
+ :num_lines, :int,
72
+ :refcount, :int,
73
+ :internal, :pointer,
74
+ )
75
+ end
76
+
77
+ class TTF_GPUAtlasDrawSequence < FFI::Struct
78
+ layout(
79
+ :atlas_texture, :pointer,
80
+ :xy, :pointer,
81
+ :uv, :pointer,
82
+ :num_vertices, :int,
83
+ :indices, :pointer,
84
+ :num_indices, :int,
85
+ :next, :pointer,
86
+ )
87
+ end
88
+
89
+ class TTF_SubString < FFI::Struct
90
+ layout(
91
+ :flags, :uint,
92
+ :offset, :int,
93
+ :length, :int,
94
+ :line_index, :int,
95
+ :cluster_index, :int,
96
+ :rect, Rect,
97
+ )
98
+ end
99
+
100
+
101
+ # Function
102
+
103
+ def self.setup_ttf_symbols(output_error = false)
104
+ entries = [
105
+ [:TTF_Version, :TTF_Version, [], :int],
106
+ [:TTF_GetFreeTypeVersion, :TTF_GetFreeTypeVersion, [:pointer, :pointer, :pointer], :void],
107
+ [:TTF_GetHarfBuzzVersion, :TTF_GetHarfBuzzVersion, [:pointer, :pointer, :pointer], :void],
108
+ [:TTF_Init, :TTF_Init, [], :bool],
109
+ [:TTF_OpenFont, :TTF_OpenFont, [:pointer, :float], :pointer],
110
+ [:TTF_OpenFontIO, :TTF_OpenFontIO, [:pointer, :bool, :float], :pointer],
111
+ [:TTF_OpenFontWithProperties, :TTF_OpenFontWithProperties, [:uint], :pointer],
112
+ [:TTF_GetFontProperties, :TTF_GetFontProperties, [:pointer], :uint],
113
+ [:TTF_GetFontGeneration, :TTF_GetFontGeneration, [:pointer], :uint],
114
+ [:TTF_SetFontSize, :TTF_SetFontSize, [:pointer, :float], :bool],
115
+ [:TTF_SetFontSizeDPI, :TTF_SetFontSizeDPI, [:pointer, :float, :int, :int], :bool],
116
+ [:TTF_GetFontSize, :TTF_GetFontSize, [:pointer], :float],
117
+ [:TTF_GetFontDPI, :TTF_GetFontDPI, [:pointer, :pointer, :pointer], :bool],
118
+ [:TTF_SetFontStyle, :TTF_SetFontStyle, [:pointer, :uint], :void],
119
+ [:TTF_GetFontStyle, :TTF_GetFontStyle, [:pointer], :uint],
120
+ [:TTF_SetFontOutline, :TTF_SetFontOutline, [:pointer, :int], :bool],
121
+ [:TTF_GetFontOutline, :TTF_GetFontOutline, [:pointer], :int],
122
+ [:TTF_SetFontHinting, :TTF_SetFontHinting, [:pointer, :int], :void],
123
+ [:TTF_GetFontHinting, :TTF_GetFontHinting, [:pointer], :int],
124
+ [:TTF_SetFontSDF, :TTF_SetFontSDF, [:pointer, :bool], :bool],
125
+ [:TTF_GetFontSDF, :TTF_GetFontSDF, [:pointer], :bool],
126
+ [:TTF_SetFontWrapAlignment, :TTF_SetFontWrapAlignment, [:pointer, :int], :void],
127
+ [:TTF_GetFontWrapAlignment, :TTF_GetFontWrapAlignment, [:pointer], :int],
128
+ [:TTF_GetFontHeight, :TTF_GetFontHeight, [:pointer], :int],
129
+ [:TTF_GetFontAscent, :TTF_GetFontAscent, [:pointer], :int],
130
+ [:TTF_GetFontDescent, :TTF_GetFontDescent, [:pointer], :int],
131
+ [:TTF_SetFontLineSkip, :TTF_SetFontLineSkip, [:pointer, :int], :void],
132
+ [:TTF_GetFontLineSkip, :TTF_GetFontLineSkip, [:pointer], :int],
133
+ [:TTF_SetFontKerning, :TTF_SetFontKerning, [:pointer, :bool], :void],
134
+ [:TTF_GetFontKerning, :TTF_GetFontKerning, [:pointer], :bool],
135
+ [:TTF_FontIsFixedWidth, :TTF_FontIsFixedWidth, [:pointer], :bool],
136
+ [:TTF_FontIsScalable, :TTF_FontIsScalable, [:pointer], :bool],
137
+ [:TTF_GetFontFamilyName, :TTF_GetFontFamilyName, [:pointer], :pointer],
138
+ [:TTF_GetFontStyleName, :TTF_GetFontStyleName, [:pointer], :pointer],
139
+ [:TTF_RenderText_Solid, :TTF_RenderText_Solid, [:pointer, :pointer, :ulong_long, Color.by_value], :pointer],
140
+ [:TTF_RenderText_Solid_Wrapped, :TTF_RenderText_Solid_Wrapped, [:pointer, :pointer, :ulong_long, Color.by_value, :int], :pointer],
141
+ [:TTF_RenderGlyph_Solid, :TTF_RenderGlyph_Solid, [:pointer, :uint, Color.by_value], :pointer],
142
+ [:TTF_SetFontDirection, :TTF_SetFontDirection, [:pointer, :int], :bool],
143
+ [:TTF_GetFontDirection, :TTF_GetFontDirection, [:pointer], :int],
144
+ [:TTF_SetFontScript, :TTF_SetFontScript, [:pointer, :pointer], :bool],
145
+ [:TTF_GetGlyphScript, :TTF_GetGlyphScript, [:uint, :pointer, :ulong_long], :bool],
146
+ [:TTF_SetFontLanguage, :TTF_SetFontLanguage, [:pointer, :pointer], :bool],
147
+ [:TTF_FontHasGlyph, :TTF_FontHasGlyph, [:pointer, :uint], :bool],
148
+ [:TTF_GetGlyphImage, :TTF_GetGlyphImage, [:pointer, :uint], :pointer],
149
+ [:TTF_GetGlyphImageForIndex, :TTF_GetGlyphImageForIndex, [:pointer, :uint], :pointer],
150
+ [:TTF_GetGlyphMetrics, :TTF_GetGlyphMetrics, [:pointer, :uint, :pointer, :pointer, :pointer, :pointer, :pointer], :bool],
151
+ [:TTF_GetGlyphKerning, :TTF_GetGlyphKerning, [:pointer, :uint, :uint, :pointer], :bool],
152
+ [:TTF_GetStringSize, :TTF_GetStringSize, [:pointer, :pointer, :ulong_long, :pointer, :pointer], :bool],
153
+ [:TTF_GetStringSizeWrapped, :TTF_GetStringSizeWrapped, [:pointer, :pointer, :ulong_long, :int, :pointer, :pointer], :bool],
154
+ [:TTF_MeasureString, :TTF_MeasureString, [:pointer, :pointer, :ulong_long, :int, :pointer, :pointer], :bool],
155
+ [:TTF_RenderText_Shaded, :TTF_RenderText_Shaded, [:pointer, :pointer, :ulong_long, Color.by_value, Color.by_value], :pointer],
156
+ [:TTF_RenderText_Shaded_Wrapped, :TTF_RenderText_Shaded_Wrapped, [:pointer, :pointer, :ulong_long, Color.by_value, Color.by_value, :int], :pointer],
157
+ [:TTF_RenderGlyph_Shaded, :TTF_RenderGlyph_Shaded, [:pointer, :uint, Color.by_value, Color.by_value], :pointer],
158
+ [:TTF_RenderText_Blended, :TTF_RenderText_Blended, [:pointer, :pointer, :ulong_long, Color.by_value], :pointer],
159
+ [:TTF_RenderText_Blended_Wrapped, :TTF_RenderText_Blended_Wrapped, [:pointer, :pointer, :ulong_long, Color.by_value, :int], :pointer],
160
+ [:TTF_RenderGlyph_Blended, :TTF_RenderGlyph_Blended, [:pointer, :uint, Color.by_value], :pointer],
161
+ [:TTF_RenderText_LCD, :TTF_RenderText_LCD, [:pointer, :pointer, :ulong_long, Color.by_value, Color.by_value], :pointer],
162
+ [:TTF_RenderText_LCD_Wrapped, :TTF_RenderText_LCD_Wrapped, [:pointer, :pointer, :ulong_long, Color.by_value, Color.by_value, :int], :pointer],
163
+ [:TTF_RenderGlyph_LCD, :TTF_RenderGlyph_LCD, [:pointer, :uint, Color.by_value, Color.by_value], :pointer],
164
+ [:TTF_CreateSurfaceTextEngine, :TTF_CreateSurfaceTextEngine, [], :pointer],
165
+ [:TTF_DrawSurfaceText, :TTF_DrawSurfaceText, [:pointer, :int, :int, :pointer], :bool],
166
+ [:TTF_DestroySurfaceTextEngine, :TTF_DestroySurfaceTextEngine, [:pointer], :void],
167
+ [:TTF_CreateRendererTextEngine, :TTF_CreateRendererTextEngine, [:pointer], :pointer],
168
+ [:TTF_DrawRendererText, :TTF_DrawRendererText, [:pointer, :float, :float], :bool],
169
+ [:TTF_DestroyRendererTextEngine, :TTF_DestroyRendererTextEngine, [:pointer], :void],
170
+ [:TTF_CreateGPUTextEngine, :TTF_CreateGPUTextEngine, [:pointer], :pointer],
171
+ [:TTF_GetGPUTextDrawData, :TTF_GetGPUTextDrawData, [:pointer], :pointer],
172
+ [:TTF_DestroyGPUTextEngine, :TTF_DestroyGPUTextEngine, [:pointer], :void],
173
+ [:TTF_SetGPUTextEngineWinding, :TTF_SetGPUTextEngineWinding, [:pointer, :int], :void],
174
+ [:TTF_GetGPUTextEngineWinding, :TTF_GetGPUTextEngineWinding, [:pointer], :int],
175
+ [:TTF_CreateText, :TTF_CreateText, [:pointer, :pointer, :pointer, :ulong_long], :pointer],
176
+ [:TTF_GetTextProperties, :TTF_GetTextProperties, [:pointer], :uint],
177
+ [:TTF_SetTextEngine, :TTF_SetTextEngine, [:pointer, :pointer], :bool],
178
+ [:TTF_GetTextEngine, :TTF_GetTextEngine, [:pointer], :pointer],
179
+ [:TTF_SetTextFont, :TTF_SetTextFont, [:pointer, :pointer], :bool],
180
+ [:TTF_GetTextFont, :TTF_GetTextFont, [:pointer], :pointer],
181
+ [:TTF_SetTextColor, :TTF_SetTextColor, [:pointer, :uchar, :uchar, :uchar, :uchar], :bool],
182
+ [:TTF_SetTextColorFloat, :TTF_SetTextColorFloat, [:pointer, :float, :float, :float, :float], :bool],
183
+ [:TTF_GetTextColor, :TTF_GetTextColor, [:pointer, :pointer, :pointer, :pointer, :pointer], :bool],
184
+ [:TTF_GetTextColorFloat, :TTF_GetTextColorFloat, [:pointer, :pointer, :pointer, :pointer, :pointer], :bool],
185
+ [:TTF_SetTextPosition, :TTF_SetTextPosition, [:pointer, :int, :int], :bool],
186
+ [:TTF_GetTextPosition, :TTF_GetTextPosition, [:pointer, :pointer, :pointer], :bool],
187
+ [:TTF_SetTextWrapWidth, :TTF_SetTextWrapWidth, [:pointer, :int], :bool],
188
+ [:TTF_GetTextWrapWidth, :TTF_GetTextWrapWidth, [:pointer, :pointer], :bool],
189
+ [:TTF_SetTextWrapWhitespaceVisible, :TTF_SetTextWrapWhitespaceVisible, [:pointer, :bool], :bool],
190
+ [:TTF_TextWrapWhitespaceVisible, :TTF_TextWrapWhitespaceVisible, [:pointer], :bool],
191
+ [:TTF_SetTextString, :TTF_SetTextString, [:pointer, :pointer, :ulong_long], :bool],
192
+ [:TTF_InsertTextString, :TTF_InsertTextString, [:pointer, :int, :pointer, :ulong_long], :bool],
193
+ [:TTF_AppendTextString, :TTF_AppendTextString, [:pointer, :pointer, :ulong_long], :bool],
194
+ [:TTF_DeleteTextString, :TTF_DeleteTextString, [:pointer, :int, :int], :bool],
195
+ [:TTF_GetTextSize, :TTF_GetTextSize, [:pointer, :pointer, :pointer], :bool],
196
+ [:TTF_GetTextSubString, :TTF_GetTextSubString, [:pointer, :int, :pointer], :bool],
197
+ [:TTF_GetTextSubStringForLine, :TTF_GetTextSubStringForLine, [:pointer, :int, :pointer], :bool],
198
+ [:TTF_GetTextSubStringsForRange, :TTF_GetTextSubStringsForRange, [:pointer, :int, :int, :pointer], :pointer],
199
+ [:TTF_GetTextSubStringForPoint, :TTF_GetTextSubStringForPoint, [:pointer, :int, :int, :pointer], :bool],
200
+ [:TTF_GetPreviousTextSubString, :TTF_GetPreviousTextSubString, [:pointer, :pointer, :pointer], :bool],
201
+ [:TTF_GetNextTextSubString, :TTF_GetNextTextSubString, [:pointer, :pointer, :pointer], :bool],
202
+ [:TTF_UpdateText, :TTF_UpdateText, [:pointer], :bool],
203
+ [:TTF_DestroyText, :TTF_DestroyText, [:pointer], :void],
204
+ [:TTF_CloseFont, :TTF_CloseFont, [:pointer], :void],
205
+ [:TTF_Quit, :TTF_Quit, [], :void],
206
+ [:TTF_WasInit, :TTF_WasInit, [], :int],
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
+
@@ -0,0 +1,41 @@
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
+ MAJOR_VERSION = 3
14
+ MINOR_VERSION = 2
15
+ MICRO_VERSION = 0
16
+
17
+ # Enum
18
+
19
+
20
+ # Typedef
21
+
22
+
23
+ # Struct
24
+
25
+
26
+ # Function
27
+
28
+ def self.setup_version_symbols(output_error = false)
29
+ entries = [
30
+ [:GetVersion, :SDL_GetVersion, [], :int],
31
+ [:GetRevision, :SDL_GetRevision, [], :pointer],
32
+ ]
33
+ entries.each do |entry|
34
+ attach_function entry[0], entry[1], entry[2], entry[3]
35
+ rescue FFI::NotFoundError => e
36
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
37
+ end
38
+ end
39
+
40
+ end
41
+
data/lib/sdl3_video.rb ADDED
@@ -0,0 +1,341 @@
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
+ PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER = "SDL.video.wayland.wl_display"
14
+ WINDOW_FULLSCREEN = 0x0000000000000001
15
+ WINDOW_OPENGL = 0x0000000000000002
16
+ WINDOW_OCCLUDED = 0x0000000000000004
17
+ WINDOW_HIDDEN = 0x0000000000000008
18
+ WINDOW_BORDERLESS = 0x0000000000000010
19
+ WINDOW_RESIZABLE = 0x0000000000000020
20
+ WINDOW_MINIMIZED = 0x0000000000000040
21
+ WINDOW_MAXIMIZED = 0x0000000000000080
22
+ WINDOW_MOUSE_GRABBED = 0x0000000000000100
23
+ WINDOW_INPUT_FOCUS = 0x0000000000000200
24
+ WINDOW_MOUSE_FOCUS = 0x0000000000000400
25
+ WINDOW_EXTERNAL = 0x0000000000000800
26
+ WINDOW_MODAL = 0x0000000000001000
27
+ WINDOW_HIGH_PIXEL_DENSITY = 0x0000000000002000
28
+ WINDOW_MOUSE_CAPTURE = 0x0000000000004000
29
+ WINDOW_MOUSE_RELATIVE_MODE = 0x0000000000008000
30
+ WINDOW_ALWAYS_ON_TOP = 0x0000000000010000
31
+ WINDOW_UTILITY = 0x0000000000020000
32
+ WINDOW_TOOLTIP = 0x0000000000040000
33
+ WINDOW_POPUP_MENU = 0x0000000000080000
34
+ WINDOW_KEYBOARD_GRABBED = 0x0000000000100000
35
+ WINDOW_VULKAN = 0x0000000010000000
36
+ WINDOW_METAL = 0x0000000020000000
37
+ WINDOW_TRANSPARENT = 0x0000000040000000
38
+ WINDOW_NOT_FOCUSABLE = 0x0000000080000000
39
+ WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000
40
+ WINDOWPOS_CENTERED_MASK = 0x2FFF0000
41
+ GL_CONTEXT_PROFILE_CORE = 0x0001
42
+ GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002
43
+ GL_CONTEXT_PROFILE_ES = 0x0004
44
+ GL_CONTEXT_DEBUG_FLAG = 0x0001
45
+ GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002
46
+ GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004
47
+ GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
48
+ GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000
49
+ GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
50
+ GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000
51
+ GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001
52
+ PROP_DISPLAY_HDR_ENABLED_BOOLEAN = "SDL.display.HDR_enabled"
53
+ PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER = "SDL.display.KMSDRM.panel_orientation"
54
+ PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN = "SDL.window.create.always_on_top"
55
+ PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN = "SDL.window.create.borderless"
56
+ PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN = "SDL.window.create.focusable"
57
+ PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN = "SDL.window.create.external_graphics_context"
58
+ PROP_WINDOW_CREATE_FLAGS_NUMBER = "SDL.window.create.flags"
59
+ PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN = "SDL.window.create.fullscreen"
60
+ PROP_WINDOW_CREATE_HEIGHT_NUMBER = "SDL.window.create.height"
61
+ PROP_WINDOW_CREATE_HIDDEN_BOOLEAN = "SDL.window.create.hidden"
62
+ PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN = "SDL.window.create.high_pixel_density"
63
+ PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN = "SDL.window.create.maximized"
64
+ PROP_WINDOW_CREATE_MENU_BOOLEAN = "SDL.window.create.menu"
65
+ PROP_WINDOW_CREATE_METAL_BOOLEAN = "SDL.window.create.metal"
66
+ PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN = "SDL.window.create.minimized"
67
+ PROP_WINDOW_CREATE_MODAL_BOOLEAN = "SDL.window.create.modal"
68
+ PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN = "SDL.window.create.mouse_grabbed"
69
+ PROP_WINDOW_CREATE_OPENGL_BOOLEAN = "SDL.window.create.opengl"
70
+ PROP_WINDOW_CREATE_PARENT_POINTER = "SDL.window.create.parent"
71
+ PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN = "SDL.window.create.resizable"
72
+ PROP_WINDOW_CREATE_TITLE_STRING = "SDL.window.create.title"
73
+ PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN = "SDL.window.create.transparent"
74
+ PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN = "SDL.window.create.tooltip"
75
+ PROP_WINDOW_CREATE_UTILITY_BOOLEAN = "SDL.window.create.utility"
76
+ PROP_WINDOW_CREATE_VULKAN_BOOLEAN = "SDL.window.create.vulkan"
77
+ PROP_WINDOW_CREATE_WIDTH_NUMBER = "SDL.window.create.width"
78
+ PROP_WINDOW_CREATE_X_NUMBER = "SDL.window.create.x"
79
+ PROP_WINDOW_CREATE_Y_NUMBER = "SDL.window.create.y"
80
+ PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER = "SDL.window.create.cocoa.window"
81
+ PROP_WINDOW_CREATE_COCOA_VIEW_POINTER = "SDL.window.create.cocoa.view"
82
+ PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN = "SDL.window.create.wayland.surface_role_custom"
83
+ PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN = "SDL.window.create.wayland.create_egl_window"
84
+ PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER = "SDL.window.create.wayland.wl_surface"
85
+ PROP_WINDOW_CREATE_WIN32_HWND_POINTER = "SDL.window.create.win32.hwnd"
86
+ PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER = "SDL.window.create.win32.pixel_format_hwnd"
87
+ PROP_WINDOW_CREATE_X11_WINDOW_NUMBER = "SDL.window.create.x11.window"
88
+ PROP_WINDOW_SHAPE_POINTER = "SDL.window.shape"
89
+ PROP_WINDOW_HDR_ENABLED_BOOLEAN = "SDL.window.HDR_enabled"
90
+ PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT = "SDL.window.SDR_white_level"
91
+ PROP_WINDOW_HDR_HEADROOM_FLOAT = "SDL.window.HDR_headroom"
92
+ PROP_WINDOW_ANDROID_WINDOW_POINTER = "SDL.window.android.window"
93
+ PROP_WINDOW_ANDROID_SURFACE_POINTER = "SDL.window.android.surface"
94
+ PROP_WINDOW_UIKIT_WINDOW_POINTER = "SDL.window.uikit.window"
95
+ PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER = "SDL.window.uikit.metal_view_tag"
96
+ PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER = "SDL.window.uikit.opengl.framebuffer"
97
+ PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER = "SDL.window.uikit.opengl.renderbuffer"
98
+ PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER = "SDL.window.uikit.opengl.resolve_framebuffer"
99
+ PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER = "SDL.window.kmsdrm.dev_index"
100
+ PROP_WINDOW_KMSDRM_DRM_FD_NUMBER = "SDL.window.kmsdrm.drm_fd"
101
+ PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER = "SDL.window.kmsdrm.gbm_dev"
102
+ PROP_WINDOW_COCOA_WINDOW_POINTER = "SDL.window.cocoa.window"
103
+ PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER = "SDL.window.cocoa.metal_view_tag"
104
+ PROP_WINDOW_OPENVR_OVERLAY_ID = "SDL.window.openvr.overlay_id"
105
+ PROP_WINDOW_VIVANTE_DISPLAY_POINTER = "SDL.window.vivante.display"
106
+ PROP_WINDOW_VIVANTE_WINDOW_POINTER = "SDL.window.vivante.window"
107
+ PROP_WINDOW_VIVANTE_SURFACE_POINTER = "SDL.window.vivante.surface"
108
+ PROP_WINDOW_WIN32_HWND_POINTER = "SDL.window.win32.hwnd"
109
+ PROP_WINDOW_WIN32_HDC_POINTER = "SDL.window.win32.hdc"
110
+ PROP_WINDOW_WIN32_INSTANCE_POINTER = "SDL.window.win32.instance"
111
+ PROP_WINDOW_WAYLAND_DISPLAY_POINTER = "SDL.window.wayland.display"
112
+ PROP_WINDOW_WAYLAND_SURFACE_POINTER = "SDL.window.wayland.surface"
113
+ PROP_WINDOW_WAYLAND_VIEWPORT_POINTER = "SDL.window.wayland.viewport"
114
+ PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER = "SDL.window.wayland.egl_window"
115
+ PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER = "SDL.window.wayland.xdg_surface"
116
+ PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER = "SDL.window.wayland.xdg_toplevel"
117
+ PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING = "SDL.window.wayland.xdg_toplevel_export_handle"
118
+ PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER = "SDL.window.wayland.xdg_popup"
119
+ PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER = "SDL.window.wayland.xdg_positioner"
120
+ PROP_WINDOW_X11_DISPLAY_POINTER = "SDL.window.x11.display"
121
+ PROP_WINDOW_X11_SCREEN_NUMBER = "SDL.window.x11.screen"
122
+ PROP_WINDOW_X11_WINDOW_NUMBER = "SDL.window.x11.window"
123
+ WINDOW_SURFACE_VSYNC_DISABLED = 0
124
+ WINDOW_SURFACE_VSYNC_ADAPTIVE = -1
125
+
126
+ # Enum
127
+
128
+ SYSTEM_THEME_UNKNOWN = 0
129
+ SYSTEM_THEME_LIGHT = 1
130
+ SYSTEM_THEME_DARK = 2
131
+ ORIENTATION_UNKNOWN = 0
132
+ ORIENTATION_LANDSCAPE = 1
133
+ ORIENTATION_LANDSCAPE_FLIPPED = 2
134
+ ORIENTATION_PORTRAIT = 3
135
+ ORIENTATION_PORTRAIT_FLIPPED = 4
136
+ FLASH_CANCEL = 0
137
+ FLASH_BRIEFLY = 1
138
+ FLASH_UNTIL_FOCUSED = 2
139
+ GL_RED_SIZE = 0
140
+ GL_GREEN_SIZE = 1
141
+ GL_BLUE_SIZE = 2
142
+ GL_ALPHA_SIZE = 3
143
+ GL_BUFFER_SIZE = 4
144
+ GL_DOUBLEBUFFER = 5
145
+ GL_DEPTH_SIZE = 6
146
+ GL_STENCIL_SIZE = 7
147
+ GL_ACCUM_RED_SIZE = 8
148
+ GL_ACCUM_GREEN_SIZE = 9
149
+ GL_ACCUM_BLUE_SIZE = 10
150
+ GL_ACCUM_ALPHA_SIZE = 11
151
+ GL_STEREO = 12
152
+ GL_MULTISAMPLEBUFFERS = 13
153
+ GL_MULTISAMPLESAMPLES = 14
154
+ GL_ACCELERATED_VISUAL = 15
155
+ GL_RETAINED_BACKING = 16
156
+ GL_CONTEXT_MAJOR_VERSION = 17
157
+ GL_CONTEXT_MINOR_VERSION = 18
158
+ GL_CONTEXT_FLAGS = 19
159
+ GL_CONTEXT_PROFILE_MASK = 20
160
+ GL_SHARE_WITH_CURRENT_CONTEXT = 21
161
+ GL_FRAMEBUFFER_SRGB_CAPABLE = 22
162
+ GL_CONTEXT_RELEASE_BEHAVIOR = 23
163
+ GL_CONTEXT_RESET_NOTIFICATION = 24
164
+ GL_CONTEXT_NO_ERROR = 25
165
+ GL_FLOATBUFFERS = 26
166
+ GL_EGL_PLATFORM = 27
167
+ HITTEST_NORMAL = 0
168
+ HITTEST_DRAGGABLE = 1
169
+ HITTEST_RESIZE_TOPLEFT = 2
170
+ HITTEST_RESIZE_TOP = 3
171
+ HITTEST_RESIZE_TOPRIGHT = 4
172
+ HITTEST_RESIZE_RIGHT = 5
173
+ HITTEST_RESIZE_BOTTOMRIGHT = 6
174
+ HITTEST_RESIZE_BOTTOM = 7
175
+ HITTEST_RESIZE_BOTTOMLEFT = 8
176
+ HITTEST_RESIZE_LEFT = 9
177
+
178
+ # Typedef
179
+
180
+ typedef :uint, :SDL_DisplayID
181
+ typedef :uint, :SDL_WindowID
182
+ typedef :int, :SDL_SystemTheme
183
+ typedef :int, :SDL_DisplayOrientation
184
+ typedef :ulong_long, :SDL_WindowFlags
185
+ typedef :int, :SDL_FlashOperation
186
+ typedef :pointer, :SDL_GLContext
187
+ typedef :pointer, :SDL_EGLDisplay
188
+ typedef :pointer, :SDL_EGLConfig
189
+ typedef :pointer, :SDL_EGLSurface
190
+ typedef :long_long, :SDL_EGLAttrib
191
+ typedef :int, :SDL_EGLint
192
+ callback :SDL_EGLAttribArrayCallback, [:pointer], :pointer
193
+ callback :SDL_EGLIntArrayCallback, [:pointer, :pointer, :pointer], :pointer
194
+ typedef :int, :SDL_GLAttr
195
+ typedef :uint, :SDL_GLProfile
196
+ typedef :uint, :SDL_GLContextFlag
197
+ typedef :uint, :SDL_GLContextReleaseFlag
198
+ typedef :uint, :SDL_GLContextResetNotification
199
+ typedef :int, :SDL_HitTestResult
200
+ callback :SDL_HitTest, [:pointer, :pointer, :pointer], :int
201
+
202
+ # Struct
203
+
204
+ class DisplayMode < FFI::Struct
205
+ layout(
206
+ :displayID, :uint,
207
+ :format, :int,
208
+ :w, :int,
209
+ :h, :int,
210
+ :pixel_density, :float,
211
+ :refresh_rate, :float,
212
+ :refresh_rate_numerator, :int,
213
+ :refresh_rate_denominator, :int,
214
+ :internal, :pointer,
215
+ )
216
+ end
217
+
218
+
219
+ # Function
220
+
221
+ def self.setup_video_symbols(output_error = false)
222
+ entries = [
223
+ [:GetNumVideoDrivers, :SDL_GetNumVideoDrivers, [], :int],
224
+ [:GetVideoDriver, :SDL_GetVideoDriver, [:int], :pointer],
225
+ [:GetCurrentVideoDriver, :SDL_GetCurrentVideoDriver, [], :pointer],
226
+ [:GetSystemTheme, :SDL_GetSystemTheme, [], :int],
227
+ [:GetDisplays, :SDL_GetDisplays, [:pointer], :pointer],
228
+ [:GetPrimaryDisplay, :SDL_GetPrimaryDisplay, [], :uint],
229
+ [:GetDisplayProperties, :SDL_GetDisplayProperties, [:uint], :uint],
230
+ [:GetDisplayName, :SDL_GetDisplayName, [:uint], :pointer],
231
+ [:GetDisplayBounds, :SDL_GetDisplayBounds, [:uint, :pointer], :bool],
232
+ [:GetDisplayUsableBounds, :SDL_GetDisplayUsableBounds, [:uint, :pointer], :bool],
233
+ [:GetNaturalDisplayOrientation, :SDL_GetNaturalDisplayOrientation, [:uint], :int],
234
+ [:GetCurrentDisplayOrientation, :SDL_GetCurrentDisplayOrientation, [:uint], :int],
235
+ [:GetDisplayContentScale, :SDL_GetDisplayContentScale, [:uint], :float],
236
+ [:GetFullscreenDisplayModes, :SDL_GetFullscreenDisplayModes, [:uint, :pointer], :pointer],
237
+ [:GetClosestFullscreenDisplayMode, :SDL_GetClosestFullscreenDisplayMode, [:uint, :int, :int, :float, :bool, :pointer], :bool],
238
+ [:GetDesktopDisplayMode, :SDL_GetDesktopDisplayMode, [:uint], :pointer],
239
+ [:GetCurrentDisplayMode, :SDL_GetCurrentDisplayMode, [:uint], :pointer],
240
+ [:GetDisplayForPoint, :SDL_GetDisplayForPoint, [:pointer], :uint],
241
+ [:GetDisplayForRect, :SDL_GetDisplayForRect, [:pointer], :uint],
242
+ [:GetDisplayForWindow, :SDL_GetDisplayForWindow, [:pointer], :uint],
243
+ [:GetWindowPixelDensity, :SDL_GetWindowPixelDensity, [:pointer], :float],
244
+ [:GetWindowDisplayScale, :SDL_GetWindowDisplayScale, [:pointer], :float],
245
+ [:SetWindowFullscreenMode, :SDL_SetWindowFullscreenMode, [:pointer, :pointer], :bool],
246
+ [:GetWindowFullscreenMode, :SDL_GetWindowFullscreenMode, [:pointer], :pointer],
247
+ [:GetWindowICCProfile, :SDL_GetWindowICCProfile, [:pointer, :pointer], :pointer],
248
+ [:GetWindowPixelFormat, :SDL_GetWindowPixelFormat, [:pointer], :int],
249
+ [:GetWindows, :SDL_GetWindows, [:pointer], :pointer],
250
+ [:CreateWindow, :SDL_CreateWindow, [:pointer, :int, :int, :ulong_long], :pointer],
251
+ [:CreatePopupWindow, :SDL_CreatePopupWindow, [:pointer, :int, :int, :int, :int, :ulong_long], :pointer],
252
+ [:CreateWindowWithProperties, :SDL_CreateWindowWithProperties, [:uint], :pointer],
253
+ [:GetWindowID, :SDL_GetWindowID, [:pointer], :uint],
254
+ [:GetWindowFromID, :SDL_GetWindowFromID, [:uint], :pointer],
255
+ [:GetWindowParent, :SDL_GetWindowParent, [:pointer], :pointer],
256
+ [:GetWindowProperties, :SDL_GetWindowProperties, [:pointer], :uint],
257
+ [:GetWindowFlags, :SDL_GetWindowFlags, [:pointer], :ulong_long],
258
+ [:SetWindowTitle, :SDL_SetWindowTitle, [:pointer, :pointer], :bool],
259
+ [:GetWindowTitle, :SDL_GetWindowTitle, [:pointer], :pointer],
260
+ [:SetWindowIcon, :SDL_SetWindowIcon, [:pointer, :pointer], :bool],
261
+ [:SetWindowPosition, :SDL_SetWindowPosition, [:pointer, :int, :int], :bool],
262
+ [:GetWindowPosition, :SDL_GetWindowPosition, [:pointer, :pointer, :pointer], :bool],
263
+ [:SetWindowSize, :SDL_SetWindowSize, [:pointer, :int, :int], :bool],
264
+ [:GetWindowSize, :SDL_GetWindowSize, [:pointer, :pointer, :pointer], :bool],
265
+ [:GetWindowSafeArea, :SDL_GetWindowSafeArea, [:pointer, :pointer], :bool],
266
+ [:SetWindowAspectRatio, :SDL_SetWindowAspectRatio, [:pointer, :float, :float], :bool],
267
+ [:GetWindowAspectRatio, :SDL_GetWindowAspectRatio, [:pointer, :pointer, :pointer], :bool],
268
+ [:GetWindowBordersSize, :SDL_GetWindowBordersSize, [:pointer, :pointer, :pointer, :pointer, :pointer], :bool],
269
+ [:GetWindowSizeInPixels, :SDL_GetWindowSizeInPixels, [:pointer, :pointer, :pointer], :bool],
270
+ [:SetWindowMinimumSize, :SDL_SetWindowMinimumSize, [:pointer, :int, :int], :bool],
271
+ [:GetWindowMinimumSize, :SDL_GetWindowMinimumSize, [:pointer, :pointer, :pointer], :bool],
272
+ [:SetWindowMaximumSize, :SDL_SetWindowMaximumSize, [:pointer, :int, :int], :bool],
273
+ [:GetWindowMaximumSize, :SDL_GetWindowMaximumSize, [:pointer, :pointer, :pointer], :bool],
274
+ [:SetWindowBordered, :SDL_SetWindowBordered, [:pointer, :bool], :bool],
275
+ [:SetWindowResizable, :SDL_SetWindowResizable, [:pointer, :bool], :bool],
276
+ [:SetWindowAlwaysOnTop, :SDL_SetWindowAlwaysOnTop, [:pointer, :bool], :bool],
277
+ [:ShowWindow, :SDL_ShowWindow, [:pointer], :bool],
278
+ [:HideWindow, :SDL_HideWindow, [:pointer], :bool],
279
+ [:RaiseWindow, :SDL_RaiseWindow, [:pointer], :bool],
280
+ [:MaximizeWindow, :SDL_MaximizeWindow, [:pointer], :bool],
281
+ [:MinimizeWindow, :SDL_MinimizeWindow, [:pointer], :bool],
282
+ [:RestoreWindow, :SDL_RestoreWindow, [:pointer], :bool],
283
+ [:SetWindowFullscreen, :SDL_SetWindowFullscreen, [:pointer, :bool], :bool],
284
+ [:SyncWindow, :SDL_SyncWindow, [:pointer], :bool],
285
+ [:WindowHasSurface, :SDL_WindowHasSurface, [:pointer], :bool],
286
+ [:GetWindowSurface, :SDL_GetWindowSurface, [:pointer], :pointer],
287
+ [:SetWindowSurfaceVSync, :SDL_SetWindowSurfaceVSync, [:pointer, :int], :bool],
288
+ [:GetWindowSurfaceVSync, :SDL_GetWindowSurfaceVSync, [:pointer, :pointer], :bool],
289
+ [:UpdateWindowSurface, :SDL_UpdateWindowSurface, [:pointer], :bool],
290
+ [:UpdateWindowSurfaceRects, :SDL_UpdateWindowSurfaceRects, [:pointer, :pointer, :int], :bool],
291
+ [:DestroyWindowSurface, :SDL_DestroyWindowSurface, [:pointer], :bool],
292
+ [:SetWindowKeyboardGrab, :SDL_SetWindowKeyboardGrab, [:pointer, :bool], :bool],
293
+ [:SetWindowMouseGrab, :SDL_SetWindowMouseGrab, [:pointer, :bool], :bool],
294
+ [:GetWindowKeyboardGrab, :SDL_GetWindowKeyboardGrab, [:pointer], :bool],
295
+ [:GetWindowMouseGrab, :SDL_GetWindowMouseGrab, [:pointer], :bool],
296
+ [:GetGrabbedWindow, :SDL_GetGrabbedWindow, [], :pointer],
297
+ [:SetWindowMouseRect, :SDL_SetWindowMouseRect, [:pointer, :pointer], :bool],
298
+ [:GetWindowMouseRect, :SDL_GetWindowMouseRect, [:pointer], :pointer],
299
+ [:SetWindowOpacity, :SDL_SetWindowOpacity, [:pointer, :float], :bool],
300
+ [:GetWindowOpacity, :SDL_GetWindowOpacity, [:pointer], :float],
301
+ [:SetWindowParent, :SDL_SetWindowParent, [:pointer, :pointer], :bool],
302
+ [:SetWindowModal, :SDL_SetWindowModal, [:pointer, :bool], :bool],
303
+ [:SetWindowFocusable, :SDL_SetWindowFocusable, [:pointer, :bool], :bool],
304
+ [:ShowWindowSystemMenu, :SDL_ShowWindowSystemMenu, [:pointer, :int, :int], :bool],
305
+ [:SetWindowHitTest, :SDL_SetWindowHitTest, [:pointer, :SDL_HitTest, :pointer], :bool],
306
+ [:SetWindowShape, :SDL_SetWindowShape, [:pointer, :pointer], :bool],
307
+ [:FlashWindow, :SDL_FlashWindow, [:pointer, :int], :bool],
308
+ [:DestroyWindow, :SDL_DestroyWindow, [:pointer], :void],
309
+ [:ScreenSaverEnabled, :SDL_ScreenSaverEnabled, [], :bool],
310
+ [:EnableScreenSaver, :SDL_EnableScreenSaver, [], :bool],
311
+ [:DisableScreenSaver, :SDL_DisableScreenSaver, [], :bool],
312
+ [:GL_LoadLibrary, :SDL_GL_LoadLibrary, [:pointer], :bool],
313
+ [:GL_GetProcAddress, :SDL_GL_GetProcAddress, [:pointer], :pointer],
314
+ [:EGL_GetProcAddress, :SDL_EGL_GetProcAddress, [:pointer], :pointer],
315
+ [:GL_UnloadLibrary, :SDL_GL_UnloadLibrary, [], :void],
316
+ [:GL_ExtensionSupported, :SDL_GL_ExtensionSupported, [:pointer], :bool],
317
+ [:GL_ResetAttributes, :SDL_GL_ResetAttributes, [], :void],
318
+ [:GL_SetAttribute, :SDL_GL_SetAttribute, [:int, :int], :bool],
319
+ [:GL_GetAttribute, :SDL_GL_GetAttribute, [:int, :pointer], :bool],
320
+ [:GL_CreateContext, :SDL_GL_CreateContext, [:pointer], :pointer],
321
+ [:GL_MakeCurrent, :SDL_GL_MakeCurrent, [:pointer, :pointer], :bool],
322
+ [:GL_GetCurrentWindow, :SDL_GL_GetCurrentWindow, [], :pointer],
323
+ [:GL_GetCurrentContext, :SDL_GL_GetCurrentContext, [], :pointer],
324
+ [:EGL_GetCurrentDisplay, :SDL_EGL_GetCurrentDisplay, [], :pointer],
325
+ [:EGL_GetCurrentConfig, :SDL_EGL_GetCurrentConfig, [], :pointer],
326
+ [:EGL_GetWindowSurface, :SDL_EGL_GetWindowSurface, [:pointer], :pointer],
327
+ [:EGL_SetAttributeCallbacks, :SDL_EGL_SetAttributeCallbacks, [:SDL_EGLAttribArrayCallback, :SDL_EGLIntArrayCallback, :SDL_EGLIntArrayCallback, :pointer], :void],
328
+ [:GL_SetSwapInterval, :SDL_GL_SetSwapInterval, [:int], :bool],
329
+ [:GL_GetSwapInterval, :SDL_GL_GetSwapInterval, [:pointer], :bool],
330
+ [:GL_SwapWindow, :SDL_GL_SwapWindow, [:pointer], :bool],
331
+ [:GL_DestroyContext, :SDL_GL_DestroyContext, [:pointer], :bool],
332
+ ]
333
+ entries.each do |entry|
334
+ attach_function entry[0], entry[1], entry[2], entry[3]
335
+ rescue FFI::NotFoundError => e
336
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
337
+ end
338
+ end
339
+
340
+ end
341
+
@@ -0,0 +1,46 @@
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
+ typedef :pointer, :VkInstance
20
+ typedef :pointer, :VkPhysicalDevice
21
+ typedef :pointer, :VkSurfaceKHR
22
+
23
+ # Struct
24
+
25
+
26
+ # Function
27
+
28
+ def self.setup_vulkan_symbols(output_error = false)
29
+ entries = [
30
+ [:Vulkan_LoadLibrary, :SDL_Vulkan_LoadLibrary, [:pointer], :bool],
31
+ [:Vulkan_GetVkGetInstanceProcAddr, :SDL_Vulkan_GetVkGetInstanceProcAddr, [], :pointer],
32
+ [:Vulkan_UnloadLibrary, :SDL_Vulkan_UnloadLibrary, [], :void],
33
+ [:Vulkan_GetInstanceExtensions, :SDL_Vulkan_GetInstanceExtensions, [:pointer], :pointer],
34
+ [:Vulkan_CreateSurface, :SDL_Vulkan_CreateSurface, [:pointer, :pointer, :pointer, :pointer], :bool],
35
+ [:Vulkan_DestroySurface, :SDL_Vulkan_DestroySurface, [:pointer, :pointer, :pointer], :void],
36
+ [:Vulkan_GetPresentationSupport, :SDL_Vulkan_GetPresentationSupport, [:pointer, :pointer, :uint], :bool],
37
+ ]
38
+ entries.each do |entry|
39
+ attach_function entry[0], entry[1], entry[2], entry[3]
40
+ rescue FFI::NotFoundError => e
41
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
42
+ end
43
+ end
44
+
45
+ end
46
+