sdl3-bindings 1.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +159 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +132 -0
  5. data/lib/sdl3.rb +150 -0
  6. data/lib/sdl3_assert.rb +61 -0
  7. data/lib/sdl3_asyncio.rb +68 -0
  8. data/lib/sdl3_atomic.rb +64 -0
  9. data/lib/sdl3_audio.rb +120 -0
  10. data/lib/sdl3_bits.rb +38 -0
  11. data/lib/sdl3_blendmode.rb +63 -0
  12. data/lib/sdl3_camera.rb +67 -0
  13. data/lib/sdl3_clipboard.rb +49 -0
  14. data/lib/sdl3_cpuinfo.rb +55 -0
  15. data/lib/sdl3_dialog.rb +60 -0
  16. data/lib/sdl3_endian.rb +39 -0
  17. data/lib/sdl3_error.rb +41 -0
  18. data/lib/sdl3_events.rb +680 -0
  19. data/lib/sdl3_filesystem.rb +82 -0
  20. data/lib/sdl3_gamepad.rb +216 -0
  21. data/lib/sdl3_gpu.rb +836 -0
  22. data/lib/sdl3_guid.rb +44 -0
  23. data/lib/sdl3_haptic.rb +209 -0
  24. data/lib/sdl3_hidapi.rb +84 -0
  25. data/lib/sdl3_hints.rb +285 -0
  26. data/lib/sdl3_image.rb +108 -0
  27. data/lib/sdl3_init.rb +71 -0
  28. data/lib/sdl3_iostream.rb +115 -0
  29. data/lib/sdl3_joystick.rb +174 -0
  30. data/lib/sdl3_keyboard.rb +81 -0
  31. data/lib/sdl3_keycode.rb +310 -0
  32. data/lib/sdl3_loadso.rb +39 -0
  33. data/lib/sdl3_locale.rb +44 -0
  34. data/lib/sdl3_log.rb +85 -0
  35. data/lib/sdl3_messagebox.rb +88 -0
  36. data/lib/sdl3_misc.rb +37 -0
  37. data/lib/sdl3_mixer.rb +179 -0
  38. data/lib/sdl3_mouse.rb +90 -0
  39. data/lib/sdl3_mutex.rb +77 -0
  40. data/lib/sdl3_pen.rb +56 -0
  41. data/lib/sdl3_pixels.rb +296 -0
  42. data/lib/sdl3_platform.rb +37 -0
  43. data/lib/sdl3_power.rb +44 -0
  44. data/lib/sdl3_process.rb +65 -0
  45. data/lib/sdl3_properties.rb +67 -0
  46. data/lib/sdl3_rect.rb +98 -0
  47. data/lib/sdl3_render.rb +240 -0
  48. data/lib/sdl3_revision.rb +37 -0
  49. data/lib/sdl3_scancode.rb +286 -0
  50. data/lib/sdl3_sensor.rb +61 -0
  51. data/lib/sdl3_sound.rb +98 -0
  52. data/lib/sdl3_stdinc.rb +229 -0
  53. data/lib/sdl3_storage.rb +70 -0
  54. data/lib/sdl3_surface.rb +122 -0
  55. data/lib/sdl3_thread.rb +65 -0
  56. data/lib/sdl3_time.rb +66 -0
  57. data/lib/sdl3_timer.rb +54 -0
  58. data/lib/sdl3_touch.rb +56 -0
  59. data/lib/sdl3_tray.rb +66 -0
  60. data/lib/sdl3_ttf.rb +216 -0
  61. data/lib/sdl3_version.rb +41 -0
  62. data/lib/sdl3_video.rb +341 -0
  63. data/lib/sdl3_vulkan.rb +46 -0
  64. metadata +118 -0
@@ -0,0 +1,37 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+
23
+ # Function
24
+
25
+ def self.setup_platform_symbols(output_error = false)
26
+ entries = [
27
+ [:GetPlatform, :SDL_GetPlatform, [], :pointer],
28
+ ]
29
+ entries.each do |entry|
30
+ attach_function entry[0], entry[1], entry[2], entry[3]
31
+ rescue FFI::NotFoundError => e
32
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
33
+ end
34
+ end
35
+
36
+ end
37
+
data/lib/sdl3_power.rb ADDED
@@ -0,0 +1,44 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+ POWERSTATE_ERROR = -1
17
+ POWERSTATE_UNKNOWN = 0
18
+ POWERSTATE_ON_BATTERY = 1
19
+ POWERSTATE_NO_BATTERY = 2
20
+ POWERSTATE_CHARGING = 3
21
+ POWERSTATE_CHARGED = 4
22
+
23
+ # Typedef
24
+
25
+ typedef :int, :SDL_PowerState
26
+
27
+ # Struct
28
+
29
+
30
+ # Function
31
+
32
+ def self.setup_power_symbols(output_error = false)
33
+ entries = [
34
+ [:GetPowerInfo, :SDL_GetPowerInfo, [:pointer, :pointer], :int],
35
+ ]
36
+ entries.each do |entry|
37
+ attach_function entry[0], entry[1], entry[2], entry[3]
38
+ rescue FFI::NotFoundError => e
39
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
40
+ end
41
+ end
42
+
43
+ end
44
+
@@ -0,0 +1,65 @@
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_PROCESS_CREATE_ARGS_POINTER = "SDL.process.create.args"
14
+ PROP_PROCESS_CREATE_ENVIRONMENT_POINTER = "SDL.process.create.environment"
15
+ PROP_PROCESS_CREATE_STDIN_NUMBER = "SDL.process.create.stdin_option"
16
+ PROP_PROCESS_CREATE_STDIN_POINTER = "SDL.process.create.stdin_source"
17
+ PROP_PROCESS_CREATE_STDOUT_NUMBER = "SDL.process.create.stdout_option"
18
+ PROP_PROCESS_CREATE_STDOUT_POINTER = "SDL.process.create.stdout_source"
19
+ PROP_PROCESS_CREATE_STDERR_NUMBER = "SDL.process.create.stderr_option"
20
+ PROP_PROCESS_CREATE_STDERR_POINTER = "SDL.process.create.stderr_source"
21
+ PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN = "SDL.process.create.stderr_to_stdout"
22
+ PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN = "SDL.process.create.background"
23
+ PROP_PROCESS_PID_NUMBER = "SDL.process.pid"
24
+ PROP_PROCESS_STDIN_POINTER = "SDL.process.stdin"
25
+ PROP_PROCESS_STDOUT_POINTER = "SDL.process.stdout"
26
+ PROP_PROCESS_STDERR_POINTER = "SDL.process.stderr"
27
+ PROP_PROCESS_BACKGROUND_BOOLEAN = "SDL.process.background"
28
+
29
+ # Enum
30
+
31
+ PROCESS_STDIO_INHERITED = 0
32
+ PROCESS_STDIO_NULL = 1
33
+ PROCESS_STDIO_APP = 2
34
+ PROCESS_STDIO_REDIRECT = 3
35
+
36
+ # Typedef
37
+
38
+ typedef :int, :SDL_ProcessIO
39
+
40
+ # Struct
41
+
42
+
43
+ # Function
44
+
45
+ def self.setup_process_symbols(output_error = false)
46
+ entries = [
47
+ [:CreateProcess, :SDL_CreateProcess, [:pointer, :bool], :pointer],
48
+ [:CreateProcessWithProperties, :SDL_CreateProcessWithProperties, [:uint], :pointer],
49
+ [:GetProcessProperties, :SDL_GetProcessProperties, [:pointer], :uint],
50
+ [:ReadProcess, :SDL_ReadProcess, [:pointer, :pointer, :pointer], :pointer],
51
+ [:GetProcessInput, :SDL_GetProcessInput, [:pointer], :pointer],
52
+ [:GetProcessOutput, :SDL_GetProcessOutput, [:pointer], :pointer],
53
+ [:KillProcess, :SDL_KillProcess, [:pointer, :bool], :bool],
54
+ [:WaitProcess, :SDL_WaitProcess, [:pointer, :bool, :pointer], :bool],
55
+ [:DestroyProcess, :SDL_DestroyProcess, [:pointer], :void],
56
+ ]
57
+ entries.each do |entry|
58
+ attach_function entry[0], entry[1], entry[2], entry[3]
59
+ rescue FFI::NotFoundError => e
60
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
61
+ end
62
+ end
63
+
64
+ end
65
+
@@ -0,0 +1,67 @@
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
+ PROPERTY_TYPE_INVALID = 0
17
+ PROPERTY_TYPE_POINTER = 1
18
+ PROPERTY_TYPE_STRING = 2
19
+ PROPERTY_TYPE_NUMBER = 3
20
+ PROPERTY_TYPE_FLOAT = 4
21
+ PROPERTY_TYPE_BOOLEAN = 5
22
+
23
+ # Typedef
24
+
25
+ typedef :uint, :SDL_PropertiesID
26
+ typedef :int, :SDL_PropertyType
27
+ callback :SDL_CleanupPropertyCallback, [:pointer, :pointer], :void
28
+ callback :SDL_EnumeratePropertiesCallback, [:pointer, :uint, :pointer], :void
29
+
30
+ # Struct
31
+
32
+
33
+ # Function
34
+
35
+ def self.setup_properties_symbols(output_error = false)
36
+ entries = [
37
+ [:GetGlobalProperties, :SDL_GetGlobalProperties, [], :uint],
38
+ [:CreateProperties, :SDL_CreateProperties, [], :uint],
39
+ [:CopyProperties, :SDL_CopyProperties, [:uint, :uint], :bool],
40
+ [:LockProperties, :SDL_LockProperties, [:uint], :bool],
41
+ [:UnlockProperties, :SDL_UnlockProperties, [:uint], :void],
42
+ [:SetPointerPropertyWithCleanup, :SDL_SetPointerPropertyWithCleanup, [:uint, :pointer, :pointer, :SDL_CleanupPropertyCallback, :pointer], :bool],
43
+ [:SetPointerProperty, :SDL_SetPointerProperty, [:uint, :pointer, :pointer], :bool],
44
+ [:SetStringProperty, :SDL_SetStringProperty, [:uint, :pointer, :pointer], :bool],
45
+ [:SetNumberProperty, :SDL_SetNumberProperty, [:uint, :pointer, :long_long], :bool],
46
+ [:SetFloatProperty, :SDL_SetFloatProperty, [:uint, :pointer, :float], :bool],
47
+ [:SetBooleanProperty, :SDL_SetBooleanProperty, [:uint, :pointer, :bool], :bool],
48
+ [:HasProperty, :SDL_HasProperty, [:uint, :pointer], :bool],
49
+ [:GetPropertyType, :SDL_GetPropertyType, [:uint, :pointer], :int],
50
+ [:GetPointerProperty, :SDL_GetPointerProperty, [:uint, :pointer, :pointer], :pointer],
51
+ [:GetStringProperty, :SDL_GetStringProperty, [:uint, :pointer, :pointer], :pointer],
52
+ [:GetNumberProperty, :SDL_GetNumberProperty, [:uint, :pointer, :long_long], :long_long],
53
+ [:GetFloatProperty, :SDL_GetFloatProperty, [:uint, :pointer, :float], :float],
54
+ [:GetBooleanProperty, :SDL_GetBooleanProperty, [:uint, :pointer, :bool], :bool],
55
+ [:ClearProperty, :SDL_ClearProperty, [:uint, :pointer], :bool],
56
+ [:EnumerateProperties, :SDL_EnumerateProperties, [:uint, :SDL_EnumeratePropertiesCallback, :pointer], :bool],
57
+ [:DestroyProperties, :SDL_DestroyProperties, [:uint], :void],
58
+ ]
59
+ entries.each do |entry|
60
+ attach_function entry[0], entry[1], entry[2], entry[3]
61
+ rescue FFI::NotFoundError => e
62
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
63
+ end
64
+ end
65
+
66
+ end
67
+
data/lib/sdl3_rect.rb ADDED
@@ -0,0 +1,98 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ def self.RectToFRect(rect, frect)
21
+ frect.x = rect.x
22
+ frect.y = rect.y
23
+ frect.w = rect.w
24
+ frect.y = rect.h
25
+ end
26
+
27
+ def self.PointInRectFloat(p, r)
28
+ return ( (p.x >= r.x) && (p.x < (r.x + r.w)) && (p.y >= r.y) && (p.y < (r.y + r.h)) ) ? 1 : 0
29
+ end
30
+
31
+ def self.RectEmpty(r)
32
+ return (!r.null? || (r.w <= 0) || (r.h <= 0)) ? 1 : 0
33
+ end
34
+
35
+ def self.RectsEqual(a, b)
36
+ return (!a.null? && !b.null? && (a.x == b.x) && (a.y == b.y) && (a.w == b.w) && (a.h == b.h)) ? 1 : 0
37
+ end
38
+
39
+
40
+ # Struct
41
+
42
+ class Point < FFI::Struct
43
+ layout(
44
+ :x, :int,
45
+ :y, :int,
46
+ )
47
+ end
48
+
49
+ class FPoint < FFI::Struct
50
+ layout(
51
+ :x, :float,
52
+ :y, :float,
53
+ )
54
+ end
55
+
56
+ class Rect < FFI::Struct
57
+ layout(
58
+ :x, :int,
59
+ :y, :int,
60
+ :w, :int,
61
+ :h, :int,
62
+ )
63
+ end
64
+
65
+ class FRect < FFI::Struct
66
+ layout(
67
+ :x, :float,
68
+ :y, :float,
69
+ :w, :float,
70
+ :h, :float,
71
+ )
72
+ end
73
+
74
+
75
+ # Function
76
+
77
+ def self.setup_rect_symbols(output_error = false)
78
+ entries = [
79
+ [:HasRectIntersection, :SDL_HasRectIntersection, [:pointer, :pointer], :bool],
80
+ [:GetRectIntersection, :SDL_GetRectIntersection, [:pointer, :pointer, :pointer], :bool],
81
+ [:GetRectUnion, :SDL_GetRectUnion, [:pointer, :pointer, :pointer], :bool],
82
+ [:GetRectEnclosingPoints, :SDL_GetRectEnclosingPoints, [:pointer, :int, :pointer, :pointer], :bool],
83
+ [:GetRectAndLineIntersection, :SDL_GetRectAndLineIntersection, [:pointer, :pointer, :pointer, :pointer, :pointer], :bool],
84
+ [:HasRectIntersectionFloat, :SDL_HasRectIntersectionFloat, [:pointer, :pointer], :bool],
85
+ [:GetRectIntersectionFloat, :SDL_GetRectIntersectionFloat, [:pointer, :pointer, :pointer], :bool],
86
+ [:GetRectUnionFloat, :SDL_GetRectUnionFloat, [:pointer, :pointer, :pointer], :bool],
87
+ [:GetRectEnclosingPointsFloat, :SDL_GetRectEnclosingPointsFloat, [:pointer, :int, :pointer, :pointer], :bool],
88
+ [:GetRectAndLineIntersectionFloat, :SDL_GetRectAndLineIntersectionFloat, [:pointer, :pointer, :pointer, :pointer, :pointer], :bool],
89
+ ]
90
+ entries.each do |entry|
91
+ attach_function entry[0], entry[1], entry[2], entry[3]
92
+ rescue FFI::NotFoundError => e
93
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
94
+ end
95
+ end
96
+
97
+ end
98
+
@@ -0,0 +1,240 @@
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
+ SOFTWARE_RENDERER = "software"
14
+ PROP_RENDERER_CREATE_NAME_STRING = "SDL.renderer.create.name"
15
+ PROP_RENDERER_CREATE_WINDOW_POINTER = "SDL.renderer.create.window"
16
+ PROP_RENDERER_CREATE_SURFACE_POINTER = "SDL.renderer.create.surface"
17
+ PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER = "SDL.renderer.create.output_colorspace"
18
+ PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER = "SDL.renderer.create.present_vsync"
19
+ PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER = "SDL.renderer.create.vulkan.instance"
20
+ PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER = "SDL.renderer.create.vulkan.surface"
21
+ PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER = "SDL.renderer.create.vulkan.physical_device"
22
+ PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER = "SDL.renderer.create.vulkan.device"
23
+ PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER = "SDL.renderer.create.vulkan.graphics_queue_family_index"
24
+ PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER = "SDL.renderer.create.vulkan.present_queue_family_index"
25
+ PROP_RENDERER_NAME_STRING = "SDL.renderer.name"
26
+ PROP_RENDERER_WINDOW_POINTER = "SDL.renderer.window"
27
+ PROP_RENDERER_SURFACE_POINTER = "SDL.renderer.surface"
28
+ PROP_RENDERER_VSYNC_NUMBER = "SDL.renderer.vsync"
29
+ PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER = "SDL.renderer.max_texture_size"
30
+ PROP_RENDERER_TEXTURE_FORMATS_POINTER = "SDL.renderer.texture_formats"
31
+ PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER = "SDL.renderer.output_colorspace"
32
+ PROP_RENDERER_HDR_ENABLED_BOOLEAN = "SDL.renderer.HDR_enabled"
33
+ PROP_RENDERER_SDR_WHITE_POINT_FLOAT = "SDL.renderer.SDR_white_point"
34
+ PROP_RENDERER_HDR_HEADROOM_FLOAT = "SDL.renderer.HDR_headroom"
35
+ PROP_RENDERER_D3D9_DEVICE_POINTER = "SDL.renderer.d3d9.device"
36
+ PROP_RENDERER_D3D11_DEVICE_POINTER = "SDL.renderer.d3d11.device"
37
+ PROP_RENDERER_D3D11_SWAPCHAIN_POINTER = "SDL.renderer.d3d11.swap_chain"
38
+ PROP_RENDERER_D3D12_DEVICE_POINTER = "SDL.renderer.d3d12.device"
39
+ PROP_RENDERER_D3D12_SWAPCHAIN_POINTER = "SDL.renderer.d3d12.swap_chain"
40
+ PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER = "SDL.renderer.d3d12.command_queue"
41
+ PROP_RENDERER_VULKAN_INSTANCE_POINTER = "SDL.renderer.vulkan.instance"
42
+ PROP_RENDERER_VULKAN_SURFACE_NUMBER = "SDL.renderer.vulkan.surface"
43
+ PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER = "SDL.renderer.vulkan.physical_device"
44
+ PROP_RENDERER_VULKAN_DEVICE_POINTER = "SDL.renderer.vulkan.device"
45
+ PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER = "SDL.renderer.vulkan.graphics_queue_family_index"
46
+ PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER = "SDL.renderer.vulkan.present_queue_family_index"
47
+ PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER = "SDL.renderer.vulkan.swapchain_image_count"
48
+ PROP_RENDERER_GPU_DEVICE_POINTER = "SDL.renderer.gpu.device"
49
+ PROP_TEXTURE_CREATE_COLORSPACE_NUMBER = "SDL.texture.create.colorspace"
50
+ PROP_TEXTURE_CREATE_FORMAT_NUMBER = "SDL.texture.create.format"
51
+ PROP_TEXTURE_CREATE_ACCESS_NUMBER = "SDL.texture.create.access"
52
+ PROP_TEXTURE_CREATE_WIDTH_NUMBER = "SDL.texture.create.width"
53
+ PROP_TEXTURE_CREATE_HEIGHT_NUMBER = "SDL.texture.create.height"
54
+ PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT = "SDL.texture.create.SDR_white_point"
55
+ PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT = "SDL.texture.create.HDR_headroom"
56
+ PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER = "SDL.texture.create.d3d11.texture"
57
+ PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER = "SDL.texture.create.d3d11.texture_u"
58
+ PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER = "SDL.texture.create.d3d11.texture_v"
59
+ PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER = "SDL.texture.create.d3d12.texture"
60
+ PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER = "SDL.texture.create.d3d12.texture_u"
61
+ PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER = "SDL.texture.create.d3d12.texture_v"
62
+ PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER = "SDL.texture.create.metal.pixelbuffer"
63
+ PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER = "SDL.texture.create.opengl.texture"
64
+ PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER = "SDL.texture.create.opengl.texture_uv"
65
+ PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER = "SDL.texture.create.opengl.texture_u"
66
+ PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER = "SDL.texture.create.opengl.texture_v"
67
+ PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER = "SDL.texture.create.opengles2.texture"
68
+ PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER = "SDL.texture.create.opengles2.texture_uv"
69
+ PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER = "SDL.texture.create.opengles2.texture_u"
70
+ PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER = "SDL.texture.create.opengles2.texture_v"
71
+ PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER = "SDL.texture.create.vulkan.texture"
72
+ PROP_TEXTURE_COLORSPACE_NUMBER = "SDL.texture.colorspace"
73
+ PROP_TEXTURE_FORMAT_NUMBER = "SDL.texture.format"
74
+ PROP_TEXTURE_ACCESS_NUMBER = "SDL.texture.access"
75
+ PROP_TEXTURE_WIDTH_NUMBER = "SDL.texture.width"
76
+ PROP_TEXTURE_HEIGHT_NUMBER = "SDL.texture.height"
77
+ PROP_TEXTURE_SDR_WHITE_POINT_FLOAT = "SDL.texture.SDR_white_point"
78
+ PROP_TEXTURE_HDR_HEADROOM_FLOAT = "SDL.texture.HDR_headroom"
79
+ PROP_TEXTURE_D3D11_TEXTURE_POINTER = "SDL.texture.d3d11.texture"
80
+ PROP_TEXTURE_D3D11_TEXTURE_U_POINTER = "SDL.texture.d3d11.texture_u"
81
+ PROP_TEXTURE_D3D11_TEXTURE_V_POINTER = "SDL.texture.d3d11.texture_v"
82
+ PROP_TEXTURE_D3D12_TEXTURE_POINTER = "SDL.texture.d3d12.texture"
83
+ PROP_TEXTURE_D3D12_TEXTURE_U_POINTER = "SDL.texture.d3d12.texture_u"
84
+ PROP_TEXTURE_D3D12_TEXTURE_V_POINTER = "SDL.texture.d3d12.texture_v"
85
+ PROP_TEXTURE_OPENGL_TEXTURE_NUMBER = "SDL.texture.opengl.texture"
86
+ PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER = "SDL.texture.opengl.texture_uv"
87
+ PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER = "SDL.texture.opengl.texture_u"
88
+ PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER = "SDL.texture.opengl.texture_v"
89
+ PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER = "SDL.texture.opengl.target"
90
+ PROP_TEXTURE_OPENGL_TEX_W_FLOAT = "SDL.texture.opengl.tex_w"
91
+ PROP_TEXTURE_OPENGL_TEX_H_FLOAT = "SDL.texture.opengl.tex_h"
92
+ PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER = "SDL.texture.opengles2.texture"
93
+ PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER = "SDL.texture.opengles2.texture_uv"
94
+ PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER = "SDL.texture.opengles2.texture_u"
95
+ PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER = "SDL.texture.opengles2.texture_v"
96
+ PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER = "SDL.texture.opengles2.target"
97
+ PROP_TEXTURE_VULKAN_TEXTURE_NUMBER = "SDL.texture.vulkan.texture"
98
+ RENDERER_VSYNC_DISABLED = 0
99
+ RENDERER_VSYNC_ADAPTIVE = -1
100
+ DEBUG_TEXT_FONT_CHARACTER_SIZE = 8
101
+
102
+ # Enum
103
+
104
+ TEXTUREACCESS_STATIC = 0
105
+ TEXTUREACCESS_STREAMING = 1
106
+ TEXTUREACCESS_TARGET = 2
107
+ LOGICAL_PRESENTATION_DISABLED = 0
108
+ LOGICAL_PRESENTATION_STRETCH = 1
109
+ LOGICAL_PRESENTATION_LETTERBOX = 2
110
+ LOGICAL_PRESENTATION_OVERSCAN = 3
111
+ LOGICAL_PRESENTATION_INTEGER_SCALE = 4
112
+
113
+ # Typedef
114
+
115
+ typedef :int, :SDL_TextureAccess
116
+ typedef :int, :SDL_RendererLogicalPresentation
117
+
118
+ # Struct
119
+
120
+ class Vertex < FFI::Struct
121
+ layout(
122
+ :position, FPoint,
123
+ :color, FColor,
124
+ :tex_coord, FPoint,
125
+ )
126
+ end
127
+
128
+ class Texture < FFI::Struct
129
+ layout(
130
+ :format, :int,
131
+ :w, :int,
132
+ :h, :int,
133
+ :refcount, :int,
134
+ )
135
+ end
136
+
137
+
138
+ # Function
139
+
140
+ def self.setup_render_symbols(output_error = false)
141
+ entries = [
142
+ [:GetNumRenderDrivers, :SDL_GetNumRenderDrivers, [], :int],
143
+ [:GetRenderDriver, :SDL_GetRenderDriver, [:int], :pointer],
144
+ [:CreateWindowAndRenderer, :SDL_CreateWindowAndRenderer, [:pointer, :int, :int, :ulong_long, :pointer, :pointer], :bool],
145
+ [:CreateRenderer, :SDL_CreateRenderer, [:pointer, :pointer], :pointer],
146
+ [:CreateRendererWithProperties, :SDL_CreateRendererWithProperties, [:uint], :pointer],
147
+ [:CreateSoftwareRenderer, :SDL_CreateSoftwareRenderer, [:pointer], :pointer],
148
+ [:GetRenderer, :SDL_GetRenderer, [:pointer], :pointer],
149
+ [:GetRenderWindow, :SDL_GetRenderWindow, [:pointer], :pointer],
150
+ [:GetRendererName, :SDL_GetRendererName, [:pointer], :pointer],
151
+ [:GetRendererProperties, :SDL_GetRendererProperties, [:pointer], :uint],
152
+ [:GetRenderOutputSize, :SDL_GetRenderOutputSize, [:pointer, :pointer, :pointer], :bool],
153
+ [:GetCurrentRenderOutputSize, :SDL_GetCurrentRenderOutputSize, [:pointer, :pointer, :pointer], :bool],
154
+ [:CreateTexture, :SDL_CreateTexture, [:pointer, :int, :int, :int, :int], :pointer],
155
+ [:CreateTextureFromSurface, :SDL_CreateTextureFromSurface, [:pointer, :pointer], :pointer],
156
+ [:CreateTextureWithProperties, :SDL_CreateTextureWithProperties, [:pointer, :uint], :pointer],
157
+ [:GetTextureProperties, :SDL_GetTextureProperties, [:pointer], :uint],
158
+ [:GetRendererFromTexture, :SDL_GetRendererFromTexture, [:pointer], :pointer],
159
+ [:GetTextureSize, :SDL_GetTextureSize, [:pointer, :pointer, :pointer], :bool],
160
+ [:SetTextureColorMod, :SDL_SetTextureColorMod, [:pointer, :uchar, :uchar, :uchar], :bool],
161
+ [:SetTextureColorModFloat, :SDL_SetTextureColorModFloat, [:pointer, :float, :float, :float], :bool],
162
+ [:GetTextureColorMod, :SDL_GetTextureColorMod, [:pointer, :pointer, :pointer, :pointer], :bool],
163
+ [:GetTextureColorModFloat, :SDL_GetTextureColorModFloat, [:pointer, :pointer, :pointer, :pointer], :bool],
164
+ [:SetTextureAlphaMod, :SDL_SetTextureAlphaMod, [:pointer, :uchar], :bool],
165
+ [:SetTextureAlphaModFloat, :SDL_SetTextureAlphaModFloat, [:pointer, :float], :bool],
166
+ [:GetTextureAlphaMod, :SDL_GetTextureAlphaMod, [:pointer, :pointer], :bool],
167
+ [:GetTextureAlphaModFloat, :SDL_GetTextureAlphaModFloat, [:pointer, :pointer], :bool],
168
+ [:SetTextureBlendMode, :SDL_SetTextureBlendMode, [:pointer, :uint], :bool],
169
+ [:GetTextureBlendMode, :SDL_GetTextureBlendMode, [:pointer, :pointer], :bool],
170
+ [:SetTextureScaleMode, :SDL_SetTextureScaleMode, [:pointer, :int], :bool],
171
+ [:GetTextureScaleMode, :SDL_GetTextureScaleMode, [:pointer, :pointer], :bool],
172
+ [:UpdateTexture, :SDL_UpdateTexture, [:pointer, :pointer, :pointer, :int], :bool],
173
+ [:UpdateYUVTexture, :SDL_UpdateYUVTexture, [:pointer, :pointer, :pointer, :int, :pointer, :int, :pointer, :int], :bool],
174
+ [:UpdateNVTexture, :SDL_UpdateNVTexture, [:pointer, :pointer, :pointer, :int, :pointer, :int], :bool],
175
+ [:LockTexture, :SDL_LockTexture, [:pointer, :pointer, :pointer, :pointer], :bool],
176
+ [:LockTextureToSurface, :SDL_LockTextureToSurface, [:pointer, :pointer, :pointer], :bool],
177
+ [:UnlockTexture, :SDL_UnlockTexture, [:pointer], :void],
178
+ [:SetRenderTarget, :SDL_SetRenderTarget, [:pointer, :pointer], :bool],
179
+ [:GetRenderTarget, :SDL_GetRenderTarget, [:pointer], :pointer],
180
+ [:SetRenderLogicalPresentation, :SDL_SetRenderLogicalPresentation, [:pointer, :int, :int, :int], :bool],
181
+ [:GetRenderLogicalPresentation, :SDL_GetRenderLogicalPresentation, [:pointer, :pointer, :pointer, :pointer], :bool],
182
+ [:GetRenderLogicalPresentationRect, :SDL_GetRenderLogicalPresentationRect, [:pointer, :pointer], :bool],
183
+ [:RenderCoordinatesFromWindow, :SDL_RenderCoordinatesFromWindow, [:pointer, :float, :float, :pointer, :pointer], :bool],
184
+ [:RenderCoordinatesToWindow, :SDL_RenderCoordinatesToWindow, [:pointer, :float, :float, :pointer, :pointer], :bool],
185
+ [:ConvertEventToRenderCoordinates, :SDL_ConvertEventToRenderCoordinates, [:pointer, :pointer], :bool],
186
+ [:SetRenderViewport, :SDL_SetRenderViewport, [:pointer, :pointer], :bool],
187
+ [:GetRenderViewport, :SDL_GetRenderViewport, [:pointer, :pointer], :bool],
188
+ [:RenderViewportSet, :SDL_RenderViewportSet, [:pointer], :bool],
189
+ [:GetRenderSafeArea, :SDL_GetRenderSafeArea, [:pointer, :pointer], :bool],
190
+ [:SetRenderClipRect, :SDL_SetRenderClipRect, [:pointer, :pointer], :bool],
191
+ [:GetRenderClipRect, :SDL_GetRenderClipRect, [:pointer, :pointer], :bool],
192
+ [:RenderClipEnabled, :SDL_RenderClipEnabled, [:pointer], :bool],
193
+ [:SetRenderScale, :SDL_SetRenderScale, [:pointer, :float, :float], :bool],
194
+ [:GetRenderScale, :SDL_GetRenderScale, [:pointer, :pointer, :pointer], :bool],
195
+ [:SetRenderDrawColor, :SDL_SetRenderDrawColor, [:pointer, :uchar, :uchar, :uchar, :uchar], :bool],
196
+ [:SetRenderDrawColorFloat, :SDL_SetRenderDrawColorFloat, [:pointer, :float, :float, :float, :float], :bool],
197
+ [:GetRenderDrawColor, :SDL_GetRenderDrawColor, [:pointer, :pointer, :pointer, :pointer, :pointer], :bool],
198
+ [:GetRenderDrawColorFloat, :SDL_GetRenderDrawColorFloat, [:pointer, :pointer, :pointer, :pointer, :pointer], :bool],
199
+ [:SetRenderColorScale, :SDL_SetRenderColorScale, [:pointer, :float], :bool],
200
+ [:GetRenderColorScale, :SDL_GetRenderColorScale, [:pointer, :pointer], :bool],
201
+ [:SetRenderDrawBlendMode, :SDL_SetRenderDrawBlendMode, [:pointer, :uint], :bool],
202
+ [:GetRenderDrawBlendMode, :SDL_GetRenderDrawBlendMode, [:pointer, :pointer], :bool],
203
+ [:RenderClear, :SDL_RenderClear, [:pointer], :bool],
204
+ [:RenderPoint, :SDL_RenderPoint, [:pointer, :float, :float], :bool],
205
+ [:RenderPoints, :SDL_RenderPoints, [:pointer, :pointer, :int], :bool],
206
+ [:RenderLine, :SDL_RenderLine, [:pointer, :float, :float, :float, :float], :bool],
207
+ [:RenderLines, :SDL_RenderLines, [:pointer, :pointer, :int], :bool],
208
+ [:RenderRect, :SDL_RenderRect, [:pointer, :pointer], :bool],
209
+ [:RenderRects, :SDL_RenderRects, [:pointer, :pointer, :int], :bool],
210
+ [:RenderFillRect, :SDL_RenderFillRect, [:pointer, :pointer], :bool],
211
+ [:RenderFillRects, :SDL_RenderFillRects, [:pointer, :pointer, :int], :bool],
212
+ [:RenderTexture, :SDL_RenderTexture, [:pointer, :pointer, :pointer, :pointer], :bool],
213
+ [:RenderTextureRotated, :SDL_RenderTextureRotated, [:pointer, :pointer, :pointer, :pointer, :double, :pointer, :int], :bool],
214
+ [:RenderTextureAffine, :SDL_RenderTextureAffine, [:pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :bool],
215
+ [:RenderTextureTiled, :SDL_RenderTextureTiled, [:pointer, :pointer, :pointer, :float, :pointer], :bool],
216
+ [:RenderTexture9Grid, :SDL_RenderTexture9Grid, [:pointer, :pointer, :pointer, :float, :float, :float, :float, :float, :pointer], :bool],
217
+ [:RenderGeometry, :SDL_RenderGeometry, [:pointer, :pointer, :pointer, :int, :pointer, :int], :bool],
218
+ [:RenderGeometryRaw, :SDL_RenderGeometryRaw, [:pointer, :pointer, :pointer, :int, :pointer, :int, :pointer, :int, :int, :pointer, :int, :int], :bool],
219
+ [:RenderReadPixels, :SDL_RenderReadPixels, [:pointer, :pointer], :pointer],
220
+ [:RenderPresent, :SDL_RenderPresent, [:pointer], :bool],
221
+ [:DestroyTexture, :SDL_DestroyTexture, [:pointer], :void],
222
+ [:DestroyRenderer, :SDL_DestroyRenderer, [:pointer], :void],
223
+ [:FlushRenderer, :SDL_FlushRenderer, [:pointer], :bool],
224
+ [:GetRenderMetalLayer, :SDL_GetRenderMetalLayer, [:pointer], :pointer],
225
+ [:GetRenderMetalCommandEncoder, :SDL_GetRenderMetalCommandEncoder, [:pointer], :pointer],
226
+ [:AddVulkanRenderSemaphores, :SDL_AddVulkanRenderSemaphores, [:pointer, :uint, :long_long, :long_long], :bool],
227
+ [:SetRenderVSync, :SDL_SetRenderVSync, [:pointer, :int], :bool],
228
+ [:GetRenderVSync, :SDL_GetRenderVSync, [:pointer, :pointer], :bool],
229
+ [:RenderDebugText, :SDL_RenderDebugText, [:pointer, :float, :float, :pointer], :bool],
230
+ [:RenderDebugTextFormat, :SDL_RenderDebugTextFormat, [:pointer, :float, :float, :pointer], :bool],
231
+ ]
232
+ entries.each do |entry|
233
+ attach_function entry[0], entry[1], entry[2], entry[3]
234
+ rescue FFI::NotFoundError => e
235
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
236
+ end
237
+ end
238
+
239
+ end
240
+
@@ -0,0 +1,37 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ REVISION = "release-3.2.0-0-g535d80bad"
14
+
15
+ # Enum
16
+
17
+
18
+ # Typedef
19
+
20
+
21
+ # Struct
22
+
23
+
24
+ # Function
25
+
26
+ def self.setup_revision_symbols(output_error = false)
27
+ entries = [
28
+ ]
29
+ entries.each do |entry|
30
+ attach_function entry[0], entry[1], entry[2], entry[3]
31
+ rescue FFI::NotFoundError => e
32
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
33
+ end
34
+ end
35
+
36
+ end
37
+