sdl3 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +7 -0
  3. data/LICENSE +21 -0
  4. data/README.md +188 -0
  5. data/Rakefile +12 -0
  6. data/examples/01_hello_window.rb +24 -0
  7. data/examples/02_basic_rendering.rb +45 -0
  8. data/examples/03_keyboard_input.rb +52 -0
  9. data/examples/04_mouse_input.rb +56 -0
  10. data/examples/05_simple_game.rb +107 -0
  11. data/lib/sdl3/high_level/audio_device.rb +202 -0
  12. data/lib/sdl3/high_level/camera.rb +118 -0
  13. data/lib/sdl3/high_level/clipboard.rb +59 -0
  14. data/lib/sdl3/high_level/event.rb +240 -0
  15. data/lib/sdl3/high_level/gamepad.rb +190 -0
  16. data/lib/sdl3/high_level/gpu.rb +194 -0
  17. data/lib/sdl3/high_level/haptic.rb +213 -0
  18. data/lib/sdl3/high_level/joystick.rb +165 -0
  19. data/lib/sdl3/high_level/renderer.rb +163 -0
  20. data/lib/sdl3/high_level/sensor.rb +105 -0
  21. data/lib/sdl3/high_level/surface.rb +143 -0
  22. data/lib/sdl3/high_level/texture.rb +111 -0
  23. data/lib/sdl3/high_level/timer.rb +88 -0
  24. data/lib/sdl3/high_level/window.rb +151 -0
  25. data/lib/sdl3/library_loader.rb +63 -0
  26. data/lib/sdl3/raw/assert.rb +32 -0
  27. data/lib/sdl3/raw/asyncio.rb +36 -0
  28. data/lib/sdl3/raw/atomic.rb +35 -0
  29. data/lib/sdl3/raw/audio.rb +88 -0
  30. data/lib/sdl3/raw/base.rb +12 -0
  31. data/lib/sdl3/raw/bits.rb +17 -0
  32. data/lib/sdl3/raw/blendmode.rb +36 -0
  33. data/lib/sdl3/raw/camera.rb +38 -0
  34. data/lib/sdl3/raw/clipboard.rb +20 -0
  35. data/lib/sdl3/raw/cpuinfo.rb +24 -0
  36. data/lib/sdl3/raw/dialog.rb +33 -0
  37. data/lib/sdl3/raw/endian.rb +8 -0
  38. data/lib/sdl3/raw/error.rb +10 -0
  39. data/lib/sdl3/raw/events.rb +558 -0
  40. data/lib/sdl3/raw/filesystem.rb +47 -0
  41. data/lib/sdl3/raw/gamepad.rb +135 -0
  42. data/lib/sdl3/raw/gpu.rb +716 -0
  43. data/lib/sdl3/raw/guid.rb +12 -0
  44. data/lib/sdl3/raw/haptic.rb +167 -0
  45. data/lib/sdl3/raw/hidapi.rb +57 -0
  46. data/lib/sdl3/raw/hints.rb +20 -0
  47. data/lib/sdl3/raw/init.rb +27 -0
  48. data/lib/sdl3/raw/iostream.rb +83 -0
  49. data/lib/sdl3/raw/joystick.rb +81 -0
  50. data/lib/sdl3/raw/keyboard.rb +30 -0
  51. data/lib/sdl3/raw/keycode.rb +132 -0
  52. data/lib/sdl3/raw/loadso.rb +9 -0
  53. data/lib/sdl3/raw/locale.rb +12 -0
  54. data/lib/sdl3/raw/log.rb +56 -0
  55. data/lib/sdl3/raw/messagebox.rb +50 -0
  56. data/lib/sdl3/raw/metal.rb +9 -0
  57. data/lib/sdl3/raw/misc.rb +7 -0
  58. data/lib/sdl3/raw/mouse.rb +65 -0
  59. data/lib/sdl3/raw/mutex.rb +34 -0
  60. data/lib/sdl3/raw/pen.rb +32 -0
  61. data/lib/sdl3/raw/pixels.rb +180 -0
  62. data/lib/sdl3/raw/platform.rb +7 -0
  63. data/lib/sdl3/raw/power.rb +14 -0
  64. data/lib/sdl3/raw/process.rb +15 -0
  65. data/lib/sdl3/raw/properties.rb +39 -0
  66. data/lib/sdl3/raw/rect.rb +41 -0
  67. data/lib/sdl3/raw/render.rb +107 -0
  68. data/lib/sdl3/raw/scancode.rb +112 -0
  69. data/lib/sdl3/raw/sensor.rb +31 -0
  70. data/lib/sdl3/raw/stdinc.rb +169 -0
  71. data/lib/sdl3/raw/storage.rb +50 -0
  72. data/lib/sdl3/raw/surface.rb +83 -0
  73. data/lib/sdl3/raw/system.rb +68 -0
  74. data/lib/sdl3/raw/thread.rb +33 -0
  75. data/lib/sdl3/raw/time.rb +36 -0
  76. data/lib/sdl3/raw/timer.rb +19 -0
  77. data/lib/sdl3/raw/touch.rb +22 -0
  78. data/lib/sdl3/raw/tray.rb +40 -0
  79. data/lib/sdl3/raw/types.rb +21 -0
  80. data/lib/sdl3/raw/version.rb +8 -0
  81. data/lib/sdl3/raw/video.rb +146 -0
  82. data/lib/sdl3/raw/vulkan.rb +13 -0
  83. data/lib/sdl3/version.rb +5 -0
  84. data/lib/sdl3.rb +126 -0
  85. data/sdl3.gemspec +30 -0
  86. metadata +141 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ typedef :uint32, :SDL_WindowID
6
+ typedef :uint32, :SDL_AudioDeviceID
7
+ typedef :uint32, :SDL_JoystickID
8
+ typedef :uint32, :SDL_GamepadID
9
+ typedef :uint32, :SDL_SensorID
10
+ typedef :uint32, :SDL_CameraID
11
+ typedef :uint32, :SDL_PropertiesID
12
+ typedef :uint64, :SDL_TouchID
13
+ typedef :uint64, :SDL_FingerID
14
+ typedef :uint32, :SDL_MouseID
15
+ typedef :uint32, :SDL_KeyboardID
16
+ typedef :uint32, :SDL_PenID
17
+ typedef :uint32, :SDL_TimerID
18
+ typedef :uint32, :SDL_Keycode
19
+ typedef :uint32, :SDL_Scancode
20
+ end
21
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ attach_function :SDL_GetVersion, [], :int
6
+ attach_function :SDL_GetRevision, [], :string
7
+ end
8
+ end
@@ -0,0 +1,146 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ typedef :uint32, :SDL_DisplayID
6
+
7
+ SDL_SystemTheme = enum :SDL_SYSTEM_THEME_UNKNOWN, 0,
8
+ :SDL_SYSTEM_THEME_LIGHT, 1,
9
+ :SDL_SYSTEM_THEME_DARK, 2
10
+
11
+ SDL_WINDOW_FULLSCREEN = 0x0000000000000001
12
+ SDL_WINDOW_OPENGL = 0x0000000000000002
13
+ SDL_WINDOW_OCCLUDED = 0x0000000000000004
14
+ SDL_WINDOW_HIDDEN = 0x0000000000000008
15
+ SDL_WINDOW_BORDERLESS = 0x0000000000000010
16
+ SDL_WINDOW_RESIZABLE = 0x0000000000000020
17
+ SDL_WINDOW_MINIMIZED = 0x0000000000000040
18
+ SDL_WINDOW_MAXIMIZED = 0x0000000000000080
19
+ SDL_WINDOW_MOUSE_GRABBED = 0x0000000000000100
20
+ SDL_WINDOW_INPUT_FOCUS = 0x0000000000000200
21
+ SDL_WINDOW_MOUSE_FOCUS = 0x0000000000000400
22
+ SDL_WINDOW_EXTERNAL = 0x0000000000000800
23
+ SDL_WINDOW_MODAL = 0x0000000000001000
24
+ SDL_WINDOW_HIGH_PIXEL_DENSITY = 0x0000000000002000
25
+ SDL_WINDOW_MOUSE_CAPTURE = 0x0000000000004000
26
+ SDL_WINDOW_MOUSE_RELATIVE_MODE = 0x0000000000008000
27
+ SDL_WINDOW_ALWAYS_ON_TOP = 0x0000000000010000
28
+ SDL_WINDOW_UTILITY = 0x0000000000020000
29
+ SDL_WINDOW_TOOLTIP = 0x0000000000040000
30
+ SDL_WINDOW_POPUP_MENU = 0x0000000000080000
31
+ SDL_WINDOW_KEYBOARD_GRABBED = 0x0000000000100000
32
+ SDL_WINDOW_VULKAN = 0x0000000010000000
33
+ SDL_WINDOW_METAL = 0x0000000020000000
34
+ SDL_WINDOW_TRANSPARENT = 0x0000000040000000
35
+ SDL_WINDOW_NOT_FOCUSABLE = 0x0000000080000000
36
+
37
+ SDL_FlashOperation = enum :SDL_FLASH_CANCEL, 0,
38
+ :SDL_FLASH_BRIEFLY, 1,
39
+ :SDL_FLASH_UNTIL_FOCUSED, 2
40
+
41
+ class SDL_DisplayMode < FFI::Struct
42
+ layout :displayID, :SDL_DisplayID,
43
+ :format, :uint32,
44
+ :w, :int,
45
+ :h, :int,
46
+ :pixel_density, :float,
47
+ :refresh_rate, :float,
48
+ :refresh_rate_numerator, :int,
49
+ :refresh_rate_denominator, :int,
50
+ :internal, :pointer
51
+ end
52
+
53
+ attach_function :SDL_GetNumVideoDrivers, [], :int
54
+ attach_function :SDL_GetVideoDriver, [:int], :string
55
+ attach_function :SDL_GetCurrentVideoDriver, [], :string
56
+ attach_function :SDL_GetSystemTheme, [], SDL_SystemTheme
57
+ attach_function :SDL_GetDisplays, [:pointer], :pointer
58
+ attach_function :SDL_GetPrimaryDisplay, [], :SDL_DisplayID
59
+ attach_function :SDL_GetDisplayProperties, [:SDL_DisplayID], :SDL_PropertiesID
60
+ attach_function :SDL_GetDisplayName, [:SDL_DisplayID], :string
61
+ attach_function :SDL_GetDisplayBounds, [:SDL_DisplayID, SDL_Rect.ptr], :bool
62
+ attach_function :SDL_GetDisplayUsableBounds, [:SDL_DisplayID, SDL_Rect.ptr], :bool
63
+ attach_function :SDL_GetDisplayContentScale, [:SDL_DisplayID], :float
64
+ attach_function :SDL_GetFullscreenDisplayModes, [:SDL_DisplayID, :pointer], :pointer
65
+ attach_function :SDL_GetClosestFullscreenDisplayMode, [:SDL_DisplayID, :int, :int, :float, :bool, SDL_DisplayMode.ptr], :bool
66
+ attach_function :SDL_GetDesktopDisplayMode, [:SDL_DisplayID], SDL_DisplayMode.ptr
67
+ attach_function :SDL_GetCurrentDisplayMode, [:SDL_DisplayID], SDL_DisplayMode.ptr
68
+
69
+ attach_function :SDL_CreateWindow, [:string, :int, :int, :uint64], :pointer
70
+ attach_function :SDL_CreatePopupWindow, [:pointer, :int, :int, :int, :int, :uint64], :pointer
71
+ attach_function :SDL_CreateWindowWithProperties, [:SDL_PropertiesID], :pointer
72
+ attach_function :SDL_GetWindowID, [:pointer], :SDL_WindowID
73
+ attach_function :SDL_GetWindowFromID, [:SDL_WindowID], :pointer
74
+ attach_function :SDL_GetWindowParent, [:pointer], :pointer
75
+ attach_function :SDL_GetWindowProperties, [:pointer], :SDL_PropertiesID
76
+ attach_function :SDL_GetWindowFlags, [:pointer], :uint64
77
+ attach_function :SDL_SetWindowTitle, %i[pointer string], :bool
78
+ attach_function :SDL_GetWindowTitle, [:pointer], :string
79
+ attach_function :SDL_SetWindowIcon, %i[pointer pointer], :bool
80
+ attach_function :SDL_SetWindowPosition, %i[pointer int int], :bool
81
+ attach_function :SDL_GetWindowPosition, %i[pointer pointer pointer], :bool
82
+ attach_function :SDL_SetWindowSize, %i[pointer int int], :bool
83
+ attach_function :SDL_GetWindowSize, %i[pointer pointer pointer], :bool
84
+ attach_function :SDL_GetWindowSafeArea, [:pointer, SDL_Rect.ptr], :bool
85
+ attach_function :SDL_SetWindowAspectRatio, %i[pointer float float], :bool
86
+ attach_function :SDL_GetWindowAspectRatio, %i[pointer pointer pointer], :bool
87
+ attach_function :SDL_GetWindowBordersSize, %i[pointer pointer pointer pointer pointer], :bool
88
+ attach_function :SDL_GetWindowSizeInPixels, %i[pointer pointer pointer], :bool
89
+ attach_function :SDL_SetWindowMinimumSize, %i[pointer int int], :bool
90
+ attach_function :SDL_GetWindowMinimumSize, %i[pointer pointer pointer], :bool
91
+ attach_function :SDL_SetWindowMaximumSize, %i[pointer int int], :bool
92
+ attach_function :SDL_GetWindowMaximumSize, %i[pointer pointer pointer], :bool
93
+ attach_function :SDL_SetWindowBordered, %i[pointer bool], :bool
94
+ attach_function :SDL_SetWindowResizable, %i[pointer bool], :bool
95
+ attach_function :SDL_SetWindowAlwaysOnTop, %i[pointer bool], :bool
96
+ attach_function :SDL_ShowWindow, [:pointer], :bool
97
+ attach_function :SDL_HideWindow, [:pointer], :bool
98
+ attach_function :SDL_RaiseWindow, [:pointer], :bool
99
+ attach_function :SDL_MaximizeWindow, [:pointer], :bool
100
+ attach_function :SDL_MinimizeWindow, [:pointer], :bool
101
+ attach_function :SDL_RestoreWindow, [:pointer], :bool
102
+ attach_function :SDL_SetWindowFullscreen, %i[pointer bool], :bool
103
+ attach_function :SDL_SyncWindow, [:pointer], :bool
104
+ attach_function :SDL_WindowHasSurface, [:pointer], :bool
105
+ attach_function :SDL_GetWindowSurface, [:pointer], :pointer
106
+ attach_function :SDL_SetWindowSurfaceVSync, %i[pointer int], :bool
107
+ attach_function :SDL_GetWindowSurfaceVSync, %i[pointer pointer], :bool
108
+ attach_function :SDL_UpdateWindowSurface, [:pointer], :bool
109
+ attach_function :SDL_UpdateWindowSurfaceRects, [:pointer, SDL_Rect.ptr, :int], :bool
110
+ attach_function :SDL_DestroyWindowSurface, [:pointer], :bool
111
+ attach_function :SDL_SetWindowKeyboardGrab, %i[pointer bool], :bool
112
+ attach_function :SDL_SetWindowMouseGrab, %i[pointer bool], :bool
113
+ attach_function :SDL_GetWindowKeyboardGrab, [:pointer], :bool
114
+ attach_function :SDL_GetWindowMouseGrab, [:pointer], :bool
115
+ attach_function :SDL_GetGrabbedWindow, [], :pointer
116
+ attach_function :SDL_SetWindowMouseRect, [:pointer, SDL_Rect.ptr], :bool
117
+ attach_function :SDL_GetWindowMouseRect, [:pointer], SDL_Rect.ptr
118
+ attach_function :SDL_SetWindowOpacity, %i[pointer float], :bool
119
+ attach_function :SDL_GetWindowOpacity, [:pointer], :float
120
+ attach_function :SDL_SetWindowParent, %i[pointer pointer], :bool
121
+ attach_function :SDL_SetWindowModal, %i[pointer bool], :bool
122
+ attach_function :SDL_SetWindowFocusable, %i[pointer bool], :bool
123
+ attach_function :SDL_ShowWindowSystemMenu, %i[pointer int int], :bool
124
+ attach_function :SDL_FlashWindow, [:pointer, SDL_FlashOperation], :bool
125
+ attach_function :SDL_DestroyWindow, [:pointer], :void
126
+ attach_function :SDL_ScreenSaverEnabled, [], :bool
127
+ attach_function :SDL_EnableScreenSaver, [], :bool
128
+ attach_function :SDL_DisableScreenSaver, [], :bool
129
+
130
+ attach_function :SDL_GL_LoadLibrary, [:string], :bool
131
+ attach_function :SDL_GL_GetProcAddress, [:string], :pointer
132
+ attach_function :SDL_GL_UnloadLibrary, [], :void
133
+ attach_function :SDL_GL_ExtensionSupported, [:string], :bool
134
+ attach_function :SDL_GL_ResetAttributes, [], :void
135
+ attach_function :SDL_GL_SetAttribute, %i[int int], :bool
136
+ attach_function :SDL_GL_GetAttribute, %i[int pointer], :bool
137
+ attach_function :SDL_GL_CreateContext, [:pointer], :pointer
138
+ attach_function :SDL_GL_MakeCurrent, %i[pointer pointer], :bool
139
+ attach_function :SDL_GL_GetCurrentWindow, [], :pointer
140
+ attach_function :SDL_GL_GetCurrentContext, [], :pointer
141
+ attach_function :SDL_GL_SetSwapInterval, [:int], :bool
142
+ attach_function :SDL_GL_GetSwapInterval, [:pointer], :bool
143
+ attach_function :SDL_GL_SwapWindow, [:pointer], :bool
144
+ attach_function :SDL_GL_DestroyContext, [:pointer], :bool
145
+ end
146
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ module Raw
5
+ attach_function :SDL_Vulkan_LoadLibrary, [:string], :bool
6
+ attach_function :SDL_Vulkan_GetVkGetInstanceProcAddr, [], :pointer
7
+ attach_function :SDL_Vulkan_UnloadLibrary, [], :void
8
+ attach_function :SDL_Vulkan_GetInstanceExtensions, [:pointer], :pointer
9
+ attach_function :SDL_Vulkan_CreateSurface, %i[pointer pointer pointer pointer], :bool
10
+ attach_function :SDL_Vulkan_DestroySurface, %i[pointer pointer pointer], :void
11
+ attach_function :SDL_Vulkan_GetPresentationSupport, %i[pointer pointer uint32], :bool
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SDL3
4
+ VERSION = "0.1.0"
5
+ end
data/lib/sdl3.rb ADDED
@@ -0,0 +1,126 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "sdl3/version"
4
+ require_relative "sdl3/raw/base"
5
+ require_relative "sdl3/raw/types"
6
+ require_relative "sdl3/raw/stdinc"
7
+ require_relative "sdl3/raw/assert"
8
+ require_relative "sdl3/raw/bits"
9
+ require_relative "sdl3/raw/guid"
10
+ require_relative "sdl3/raw/init"
11
+ require_relative "sdl3/raw/error"
12
+ require_relative "sdl3/raw/rect"
13
+ require_relative "sdl3/raw/pixels"
14
+ require_relative "sdl3/raw/blendmode"
15
+ require_relative "sdl3/raw/hints"
16
+ require_relative "sdl3/raw/log"
17
+ require_relative "sdl3/raw/properties"
18
+ require_relative "sdl3/raw/video"
19
+ require_relative "sdl3/raw/surface"
20
+ require_relative "sdl3/raw/render"
21
+ require_relative "sdl3/raw/scancode"
22
+ require_relative "sdl3/raw/keycode"
23
+ require_relative "sdl3/raw/keyboard"
24
+ require_relative "sdl3/raw/mouse"
25
+ require_relative "sdl3/raw/joystick"
26
+ require_relative "sdl3/raw/gamepad"
27
+ require_relative "sdl3/raw/touch"
28
+ require_relative "sdl3/raw/pen"
29
+ require_relative "sdl3/raw/sensor"
30
+ require_relative "sdl3/raw/events"
31
+ require_relative "sdl3/raw/audio"
32
+ require_relative "sdl3/raw/haptic"
33
+ require_relative "sdl3/raw/timer"
34
+ require_relative "sdl3/raw/filesystem"
35
+ require_relative "sdl3/raw/clipboard"
36
+ require_relative "sdl3/raw/cpuinfo"
37
+ require_relative "sdl3/raw/endian"
38
+ require_relative "sdl3/raw/power"
39
+ require_relative "sdl3/raw/messagebox"
40
+ require_relative "sdl3/raw/locale"
41
+ require_relative "sdl3/raw/misc"
42
+ require_relative "sdl3/raw/platform"
43
+ require_relative "sdl3/raw/system"
44
+ require_relative "sdl3/raw/iostream"
45
+ require_relative "sdl3/raw/time"
46
+ require_relative "sdl3/raw/dialog"
47
+ require_relative "sdl3/raw/loadso"
48
+ require_relative "sdl3/raw/version"
49
+ require_relative "sdl3/raw/thread"
50
+ require_relative "sdl3/raw/mutex"
51
+ require_relative "sdl3/raw/atomic"
52
+ require_relative "sdl3/raw/camera"
53
+ require_relative "sdl3/raw/asyncio"
54
+ require_relative "sdl3/raw/vulkan"
55
+ require_relative "sdl3/raw/metal"
56
+ require_relative "sdl3/raw/storage"
57
+ require_relative "sdl3/raw/process"
58
+ require_relative "sdl3/raw/tray"
59
+ require_relative "sdl3/raw/gpu"
60
+ require_relative "sdl3/raw/hidapi"
61
+
62
+ require_relative "sdl3/high_level/surface"
63
+ require_relative "sdl3/high_level/window"
64
+ require_relative "sdl3/high_level/renderer"
65
+ require_relative "sdl3/high_level/texture"
66
+ require_relative "sdl3/high_level/event"
67
+ require_relative "sdl3/high_level/audio_device"
68
+ require_relative "sdl3/high_level/joystick"
69
+ require_relative "sdl3/high_level/gamepad"
70
+ require_relative "sdl3/high_level/haptic"
71
+ require_relative "sdl3/high_level/camera"
72
+ require_relative "sdl3/high_level/timer"
73
+ require_relative "sdl3/high_level/clipboard"
74
+ require_relative "sdl3/high_level/gpu"
75
+ require_relative "sdl3/high_level/sensor"
76
+
77
+ module SDL3
78
+ class Error < StandardError; end
79
+ class InitError < Error; end
80
+ class WindowError < Error; end
81
+ class RendererError < Error; end
82
+ class AudioError < Error; end
83
+
84
+ INIT_AUDIO = Raw::SDL_INIT_AUDIO
85
+ INIT_VIDEO = Raw::SDL_INIT_VIDEO
86
+ INIT_JOYSTICK = Raw::SDL_INIT_JOYSTICK
87
+ INIT_HAPTIC = Raw::SDL_INIT_HAPTIC
88
+ INIT_GAMEPAD = Raw::SDL_INIT_GAMEPAD
89
+ INIT_EVENTS = Raw::SDL_INIT_EVENTS
90
+ INIT_SENSOR = Raw::SDL_INIT_SENSOR
91
+ INIT_CAMERA = Raw::SDL_INIT_CAMERA
92
+
93
+ class << self
94
+ def init(flags)
95
+ raise InitError, Raw.SDL_GetError unless Raw.SDL_Init(flags)
96
+
97
+ true
98
+ end
99
+
100
+ def init_sub_system(flags)
101
+ raise InitError, Raw.SDL_GetError unless Raw.SDL_InitSubSystem(flags)
102
+
103
+ true
104
+ end
105
+
106
+ def quit_sub_system(flags)
107
+ Raw.SDL_QuitSubSystem(flags)
108
+ end
109
+
110
+ def was_init(flags)
111
+ Raw.SDL_WasInit(flags)
112
+ end
113
+
114
+ def quit
115
+ Raw.SDL_Quit
116
+ end
117
+
118
+ def error
119
+ Raw.SDL_GetError
120
+ end
121
+
122
+ def clear_error
123
+ Raw.SDL_ClearError
124
+ end
125
+ end
126
+ end
data/sdl3.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/sdl3/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "sdl3"
7
+ spec.version = SDL3::VERSION
8
+ spec.authors = ["Yudai Takada"]
9
+ spec.email = ["t.yudai92@gmail.com"]
10
+
11
+ spec.summary = "Ruby FFI bindings for SDL3"
12
+ spec.description = "Complete Ruby bindings for SDL3 multimedia library using FFI"
13
+ spec.homepage = "https://github.com/ydah/sdl3-ruby"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.1.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
20
+
21
+ spec.files = Dir.chdir(__dir__) do
22
+ `git ls-files -z`.split("\x0").reject do |f|
23
+ (File.expand_path(f) == __FILE__) ||
24
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
25
+ end
26
+ end
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency "ffi", "~> 1.15"
30
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sdl3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yudai Takada
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: ffi
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.15'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.15'
26
+ description: Complete Ruby bindings for SDL3 multimedia library using FFI
27
+ email:
28
+ - t.yudai92@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - CHANGELOG.md
34
+ - LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - examples/01_hello_window.rb
38
+ - examples/02_basic_rendering.rb
39
+ - examples/03_keyboard_input.rb
40
+ - examples/04_mouse_input.rb
41
+ - examples/05_simple_game.rb
42
+ - lib/sdl3.rb
43
+ - lib/sdl3/high_level/audio_device.rb
44
+ - lib/sdl3/high_level/camera.rb
45
+ - lib/sdl3/high_level/clipboard.rb
46
+ - lib/sdl3/high_level/event.rb
47
+ - lib/sdl3/high_level/gamepad.rb
48
+ - lib/sdl3/high_level/gpu.rb
49
+ - lib/sdl3/high_level/haptic.rb
50
+ - lib/sdl3/high_level/joystick.rb
51
+ - lib/sdl3/high_level/renderer.rb
52
+ - lib/sdl3/high_level/sensor.rb
53
+ - lib/sdl3/high_level/surface.rb
54
+ - lib/sdl3/high_level/texture.rb
55
+ - lib/sdl3/high_level/timer.rb
56
+ - lib/sdl3/high_level/window.rb
57
+ - lib/sdl3/library_loader.rb
58
+ - lib/sdl3/raw/assert.rb
59
+ - lib/sdl3/raw/asyncio.rb
60
+ - lib/sdl3/raw/atomic.rb
61
+ - lib/sdl3/raw/audio.rb
62
+ - lib/sdl3/raw/base.rb
63
+ - lib/sdl3/raw/bits.rb
64
+ - lib/sdl3/raw/blendmode.rb
65
+ - lib/sdl3/raw/camera.rb
66
+ - lib/sdl3/raw/clipboard.rb
67
+ - lib/sdl3/raw/cpuinfo.rb
68
+ - lib/sdl3/raw/dialog.rb
69
+ - lib/sdl3/raw/endian.rb
70
+ - lib/sdl3/raw/error.rb
71
+ - lib/sdl3/raw/events.rb
72
+ - lib/sdl3/raw/filesystem.rb
73
+ - lib/sdl3/raw/gamepad.rb
74
+ - lib/sdl3/raw/gpu.rb
75
+ - lib/sdl3/raw/guid.rb
76
+ - lib/sdl3/raw/haptic.rb
77
+ - lib/sdl3/raw/hidapi.rb
78
+ - lib/sdl3/raw/hints.rb
79
+ - lib/sdl3/raw/init.rb
80
+ - lib/sdl3/raw/iostream.rb
81
+ - lib/sdl3/raw/joystick.rb
82
+ - lib/sdl3/raw/keyboard.rb
83
+ - lib/sdl3/raw/keycode.rb
84
+ - lib/sdl3/raw/loadso.rb
85
+ - lib/sdl3/raw/locale.rb
86
+ - lib/sdl3/raw/log.rb
87
+ - lib/sdl3/raw/messagebox.rb
88
+ - lib/sdl3/raw/metal.rb
89
+ - lib/sdl3/raw/misc.rb
90
+ - lib/sdl3/raw/mouse.rb
91
+ - lib/sdl3/raw/mutex.rb
92
+ - lib/sdl3/raw/pen.rb
93
+ - lib/sdl3/raw/pixels.rb
94
+ - lib/sdl3/raw/platform.rb
95
+ - lib/sdl3/raw/power.rb
96
+ - lib/sdl3/raw/process.rb
97
+ - lib/sdl3/raw/properties.rb
98
+ - lib/sdl3/raw/rect.rb
99
+ - lib/sdl3/raw/render.rb
100
+ - lib/sdl3/raw/scancode.rb
101
+ - lib/sdl3/raw/sensor.rb
102
+ - lib/sdl3/raw/stdinc.rb
103
+ - lib/sdl3/raw/storage.rb
104
+ - lib/sdl3/raw/surface.rb
105
+ - lib/sdl3/raw/system.rb
106
+ - lib/sdl3/raw/thread.rb
107
+ - lib/sdl3/raw/time.rb
108
+ - lib/sdl3/raw/timer.rb
109
+ - lib/sdl3/raw/touch.rb
110
+ - lib/sdl3/raw/tray.rb
111
+ - lib/sdl3/raw/types.rb
112
+ - lib/sdl3/raw/version.rb
113
+ - lib/sdl3/raw/video.rb
114
+ - lib/sdl3/raw/vulkan.rb
115
+ - lib/sdl3/version.rb
116
+ - sdl3.gemspec
117
+ homepage: https://github.com/ydah/sdl3-ruby
118
+ licenses:
119
+ - MIT
120
+ metadata:
121
+ homepage_uri: https://github.com/ydah/sdl3-ruby
122
+ source_code_uri: https://github.com/ydah/sdl3-ruby
123
+ changelog_uri: https://github.com/ydah/sdl3-ruby/blob/main/CHANGELOG.md
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 3.1.0
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubygems_version: 4.0.3
139
+ specification_version: 4
140
+ summary: Ruby FFI bindings for SDL3
141
+ test_files: []