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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +7 -0
- data/LICENSE +21 -0
- data/README.md +188 -0
- data/Rakefile +12 -0
- data/examples/01_hello_window.rb +24 -0
- data/examples/02_basic_rendering.rb +45 -0
- data/examples/03_keyboard_input.rb +52 -0
- data/examples/04_mouse_input.rb +56 -0
- data/examples/05_simple_game.rb +107 -0
- data/lib/sdl3/high_level/audio_device.rb +202 -0
- data/lib/sdl3/high_level/camera.rb +118 -0
- data/lib/sdl3/high_level/clipboard.rb +59 -0
- data/lib/sdl3/high_level/event.rb +240 -0
- data/lib/sdl3/high_level/gamepad.rb +190 -0
- data/lib/sdl3/high_level/gpu.rb +194 -0
- data/lib/sdl3/high_level/haptic.rb +213 -0
- data/lib/sdl3/high_level/joystick.rb +165 -0
- data/lib/sdl3/high_level/renderer.rb +163 -0
- data/lib/sdl3/high_level/sensor.rb +105 -0
- data/lib/sdl3/high_level/surface.rb +143 -0
- data/lib/sdl3/high_level/texture.rb +111 -0
- data/lib/sdl3/high_level/timer.rb +88 -0
- data/lib/sdl3/high_level/window.rb +151 -0
- data/lib/sdl3/library_loader.rb +63 -0
- data/lib/sdl3/raw/assert.rb +32 -0
- data/lib/sdl3/raw/asyncio.rb +36 -0
- data/lib/sdl3/raw/atomic.rb +40 -0
- data/lib/sdl3/raw/audio.rb +95 -0
- data/lib/sdl3/raw/base.rb +12 -0
- data/lib/sdl3/raw/bits.rb +17 -0
- data/lib/sdl3/raw/blendmode.rb +36 -0
- data/lib/sdl3/raw/camera.rb +38 -0
- data/lib/sdl3/raw/clipboard.rb +20 -0
- data/lib/sdl3/raw/cpuinfo.rb +29 -0
- data/lib/sdl3/raw/dialog.rb +33 -0
- data/lib/sdl3/raw/endian.rb +8 -0
- data/lib/sdl3/raw/error.rb +15 -0
- data/lib/sdl3/raw/events.rb +563 -0
- data/lib/sdl3/raw/filesystem.rb +47 -0
- data/lib/sdl3/raw/gamepad.rb +135 -0
- data/lib/sdl3/raw/gpu.rb +734 -0
- data/lib/sdl3/raw/guid.rb +12 -0
- data/lib/sdl3/raw/haptic.rb +167 -0
- data/lib/sdl3/raw/hidapi.rb +57 -0
- data/lib/sdl3/raw/hints.rb +20 -0
- data/lib/sdl3/raw/init.rb +27 -0
- data/lib/sdl3/raw/iostream.rb +88 -0
- data/lib/sdl3/raw/joystick.rb +101 -0
- data/lib/sdl3/raw/keyboard.rb +30 -0
- data/lib/sdl3/raw/keycode.rb +132 -0
- data/lib/sdl3/raw/loadso.rb +9 -0
- data/lib/sdl3/raw/locale.rb +12 -0
- data/lib/sdl3/raw/log.rb +61 -0
- data/lib/sdl3/raw/main.rb +23 -0
- data/lib/sdl3/raw/messagebox.rb +50 -0
- data/lib/sdl3/raw/metal.rb +9 -0
- data/lib/sdl3/raw/misc.rb +7 -0
- data/lib/sdl3/raw/mouse.rb +82 -0
- data/lib/sdl3/raw/mutex.rb +48 -0
- data/lib/sdl3/raw/openxr.rb +21 -0
- data/lib/sdl3/raw/pen.rb +38 -0
- data/lib/sdl3/raw/pixels.rb +180 -0
- data/lib/sdl3/raw/platform.rb +7 -0
- data/lib/sdl3/raw/power.rb +14 -0
- data/lib/sdl3/raw/process.rb +15 -0
- data/lib/sdl3/raw/properties.rb +39 -0
- data/lib/sdl3/raw/rect.rb +41 -0
- data/lib/sdl3/raw/render.rb +153 -0
- data/lib/sdl3/raw/scancode.rb +112 -0
- data/lib/sdl3/raw/sensor.rb +31 -0
- data/lib/sdl3/raw/stdinc.rb +209 -0
- data/lib/sdl3/raw/storage.rb +50 -0
- data/lib/sdl3/raw/surface.rb +106 -0
- data/lib/sdl3/raw/system.rb +77 -0
- data/lib/sdl3/raw/thread.rb +40 -0
- data/lib/sdl3/raw/time.rb +36 -0
- data/lib/sdl3/raw/timer.rb +19 -0
- data/lib/sdl3/raw/touch.rb +22 -0
- data/lib/sdl3/raw/tray.rb +42 -0
- data/lib/sdl3/raw/types.rb +21 -0
- data/lib/sdl3/raw/version.rb +8 -0
- data/lib/sdl3/raw/video.rb +208 -0
- data/lib/sdl3/raw/vulkan.rb +13 -0
- data/lib/sdl3/version.rb +5 -0
- data/lib/sdl3.rb +128 -0
- data/sdl3.gemspec +30 -0
- metadata +143 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
SDL_Sandbox = enum :SDL_Sandbox, [
|
|
6
|
+
:SDL_SANDBOX_NONE, 0,
|
|
7
|
+
:SDL_SANDBOX_UNKNOWN_CONTAINER, 1,
|
|
8
|
+
:SDL_SANDBOX_FLATPAK, 2,
|
|
9
|
+
:SDL_SANDBOX_SNAP, 3,
|
|
10
|
+
:SDL_SANDBOX_MACOS, 4
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
attach_function :SDL_IsTablet, [], :bool
|
|
14
|
+
attach_function :SDL_IsTV, [], :bool
|
|
15
|
+
attach_function :SDL_GetSandbox, [], :SDL_Sandbox
|
|
16
|
+
|
|
17
|
+
begin
|
|
18
|
+
callback :SDL_X11EventHook, %i[pointer pointer], :bool
|
|
19
|
+
attach_function :SDL_SetX11EventHook, [:SDL_X11EventHook, :pointer], :void
|
|
20
|
+
attach_function :SDL_SetLinuxThreadPriority, %i[int64 int], :bool
|
|
21
|
+
attach_function :SDL_SetLinuxThreadPriorityAndPolicy, %i[int64 int int], :bool
|
|
22
|
+
rescue FFI::NotFoundError
|
|
23
|
+
# Linux/X11 specific APIs are not available on all platforms.
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
callback :SDL_WindowsMessageHook, [:pointer, :pointer, :uint, :uint64, :int64], :bool
|
|
27
|
+
|
|
28
|
+
begin
|
|
29
|
+
attach_function :SDL_SetWindowsMessageHook, [:SDL_WindowsMessageHook, :pointer], :void
|
|
30
|
+
attach_function :SDL_GetDirect3D9AdapterIndex, [:pointer], :int
|
|
31
|
+
attach_function :SDL_GetDXGIOutputInfo, [:pointer, :pointer, :pointer], :bool
|
|
32
|
+
rescue FFI::NotFoundError
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
begin
|
|
36
|
+
attach_function :SDL_GetAndroidJNIEnv, [], :pointer
|
|
37
|
+
attach_function :SDL_GetAndroidActivity, [], :pointer
|
|
38
|
+
attach_function :SDL_GetAndroidSDKVersion, [], :int
|
|
39
|
+
attach_function :SDL_IsChromebook, [], :bool
|
|
40
|
+
attach_function :SDL_IsDeXMode, [], :bool
|
|
41
|
+
attach_function :SDL_SendAndroidBackButton, [], :void
|
|
42
|
+
attach_function :SDL_GetAndroidInternalStoragePath, [], :string
|
|
43
|
+
attach_function :SDL_GetAndroidExternalStorageState, [], :uint32
|
|
44
|
+
attach_function :SDL_GetAndroidExternalStoragePath, [], :string
|
|
45
|
+
attach_function :SDL_GetAndroidCachePath, [], :string
|
|
46
|
+
callback :SDL_RequestAndroidPermissionCallback, [:pointer, :string, :bool], :void
|
|
47
|
+
attach_function :SDL_RequestAndroidPermission, [:string, :SDL_RequestAndroidPermissionCallback, :pointer], :bool
|
|
48
|
+
attach_function :SDL_ShowAndroidToast, [:string, :int, :int, :int, :int], :bool
|
|
49
|
+
attach_function :SDL_SendAndroidMessage, [:uint32, :int], :bool
|
|
50
|
+
rescue FFI::NotFoundError
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
begin
|
|
54
|
+
callback :SDL_iOSAnimationCallback, [:pointer], :void
|
|
55
|
+
attach_function :SDL_SetiOSAnimationCallback, [:pointer, :int, :SDL_iOSAnimationCallback, :pointer], :bool
|
|
56
|
+
attach_function :SDL_SetiOSEventPump, [:bool], :void
|
|
57
|
+
rescue FFI::NotFoundError
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
begin
|
|
61
|
+
attach_function :SDL_OnApplicationWillTerminate, [], :void
|
|
62
|
+
attach_function :SDL_OnApplicationDidReceiveMemoryWarning, [], :void
|
|
63
|
+
attach_function :SDL_OnApplicationWillEnterBackground, [], :void
|
|
64
|
+
attach_function :SDL_OnApplicationDidEnterBackground, [], :void
|
|
65
|
+
attach_function :SDL_OnApplicationWillEnterForeground, [], :void
|
|
66
|
+
attach_function :SDL_OnApplicationDidEnterForeground, [], :void
|
|
67
|
+
attach_function :SDL_OnApplicationDidChangeStatusBarOrientation, [], :void
|
|
68
|
+
rescue FFI::NotFoundError
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
begin
|
|
72
|
+
attach_function :SDL_GetGDKTaskQueue, [:pointer], :bool
|
|
73
|
+
attach_function :SDL_GetGDKDefaultUser, [:pointer], :bool
|
|
74
|
+
rescue FFI::NotFoundError
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
typedef :uint64, :SDL_ThreadID
|
|
6
|
+
|
|
7
|
+
SDL_ThreadPriority = enum :SDL_THREAD_PRIORITY_LOW, 0,
|
|
8
|
+
:SDL_THREAD_PRIORITY_NORMAL, 1,
|
|
9
|
+
:SDL_THREAD_PRIORITY_HIGH, 2,
|
|
10
|
+
:SDL_THREAD_PRIORITY_TIME_CRITICAL, 3
|
|
11
|
+
|
|
12
|
+
SDL_ThreadState = enum :SDL_THREAD_UNKNOWN, 0,
|
|
13
|
+
:SDL_THREAD_ALIVE, 1,
|
|
14
|
+
:SDL_THREAD_DETACHED, 2,
|
|
15
|
+
:SDL_THREAD_COMPLETE, 3
|
|
16
|
+
|
|
17
|
+
callback :SDL_ThreadFunction, [:pointer], :int
|
|
18
|
+
callback :SDL_TLSDestructorCallback, [:pointer], :void
|
|
19
|
+
|
|
20
|
+
begin
|
|
21
|
+
attach_function :SDL_CreateThread, [:SDL_ThreadFunction, :string, :pointer], :pointer
|
|
22
|
+
attach_function :SDL_CreateThreadWithProperties, [:SDL_PropertiesID], :pointer
|
|
23
|
+
rescue FFI::NotFoundError
|
|
24
|
+
# Some SDL builds only export runtime thread creation entry points.
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
attach_function :SDL_CreateThreadRuntime, [:SDL_ThreadFunction, :string, :pointer, :pointer, :pointer], :pointer
|
|
28
|
+
attach_function :SDL_CreateThreadWithPropertiesRuntime, [:SDL_PropertiesID, :pointer, :pointer], :pointer
|
|
29
|
+
attach_function :SDL_GetThreadName, [:pointer], :string
|
|
30
|
+
attach_function :SDL_GetCurrentThreadID, [], :SDL_ThreadID
|
|
31
|
+
attach_function :SDL_GetThreadID, [:pointer], :SDL_ThreadID
|
|
32
|
+
attach_function :SDL_SetCurrentThreadPriority, [SDL_ThreadPriority], :bool
|
|
33
|
+
attach_function :SDL_WaitThread, %i[pointer pointer], :void
|
|
34
|
+
attach_function :SDL_GetThreadState, [:pointer], SDL_ThreadState
|
|
35
|
+
attach_function :SDL_DetachThread, [:pointer], :void
|
|
36
|
+
attach_function :SDL_GetTLS, [:pointer], :pointer
|
|
37
|
+
attach_function :SDL_SetTLS, [:pointer, :pointer, :SDL_TLSDestructorCallback], :bool
|
|
38
|
+
attach_function :SDL_CleanupTLS, [], :void
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
typedef :int64, :SDL_Time
|
|
6
|
+
|
|
7
|
+
SDL_DateFormat = enum :SDL_DATE_FORMAT_YYYYMMDD, 0,
|
|
8
|
+
:SDL_DATE_FORMAT_DDMMYYYY, 1,
|
|
9
|
+
:SDL_DATE_FORMAT_MMDDYYYY, 2
|
|
10
|
+
|
|
11
|
+
SDL_TimeFormat = enum :SDL_TIME_FORMAT_24HR, 0,
|
|
12
|
+
:SDL_TIME_FORMAT_12HR, 1
|
|
13
|
+
|
|
14
|
+
class SDL_DateTime < FFI::Struct
|
|
15
|
+
layout :year, :int,
|
|
16
|
+
:month, :int,
|
|
17
|
+
:day, :int,
|
|
18
|
+
:hour, :int,
|
|
19
|
+
:minute, :int,
|
|
20
|
+
:second, :int,
|
|
21
|
+
:nanosecond, :int,
|
|
22
|
+
:day_of_week, :int,
|
|
23
|
+
:utc_offset, :int
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
attach_function :SDL_GetDateTimeLocalePreferences, %i[pointer pointer], :bool
|
|
27
|
+
attach_function :SDL_GetCurrentTime, [:pointer], :bool
|
|
28
|
+
attach_function :SDL_TimeToDateTime, [:SDL_Time, SDL_DateTime.ptr, :bool], :bool
|
|
29
|
+
attach_function :SDL_DateTimeToTime, [SDL_DateTime.ptr, :pointer], :bool
|
|
30
|
+
attach_function :SDL_TimeToWindows, [:SDL_Time, :pointer, :pointer], :void
|
|
31
|
+
attach_function :SDL_TimeFromWindows, %i[uint32 uint32], :SDL_Time
|
|
32
|
+
attach_function :SDL_GetDaysInMonth, %i[int int], :int
|
|
33
|
+
attach_function :SDL_GetDayOfYear, %i[int int int], :int
|
|
34
|
+
attach_function :SDL_GetDayOfWeek, %i[int int int], :int
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
callback :SDL_TimerCallback, %i[pointer SDL_TimerID uint32], :uint32
|
|
6
|
+
callback :SDL_NSTimerCallback, %i[pointer SDL_TimerID uint64], :uint64
|
|
7
|
+
|
|
8
|
+
attach_function :SDL_GetTicks, [], :uint64
|
|
9
|
+
attach_function :SDL_GetTicksNS, [], :uint64
|
|
10
|
+
attach_function :SDL_GetPerformanceCounter, [], :uint64
|
|
11
|
+
attach_function :SDL_GetPerformanceFrequency, [], :uint64
|
|
12
|
+
attach_function :SDL_Delay, [:uint32], :void
|
|
13
|
+
attach_function :SDL_DelayNS, [:uint64], :void
|
|
14
|
+
attach_function :SDL_DelayPrecise, [:uint64], :void
|
|
15
|
+
attach_function :SDL_AddTimer, [:uint32, :SDL_TimerCallback, :pointer], :SDL_TimerID
|
|
16
|
+
attach_function :SDL_AddTimerNS, [:uint64, :SDL_NSTimerCallback, :pointer], :SDL_TimerID
|
|
17
|
+
attach_function :SDL_RemoveTimer, [:SDL_TimerID], :bool
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
SDL_TouchDeviceType = enum :SDL_TOUCH_DEVICE_INVALID, -1,
|
|
6
|
+
:SDL_TOUCH_DEVICE_DIRECT, 0,
|
|
7
|
+
:SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, 1,
|
|
8
|
+
:SDL_TOUCH_DEVICE_INDIRECT_RELATIVE, 2
|
|
9
|
+
|
|
10
|
+
class SDL_Finger < FFI::Struct
|
|
11
|
+
layout :id, :SDL_FingerID,
|
|
12
|
+
:x, :float,
|
|
13
|
+
:y, :float,
|
|
14
|
+
:pressure, :float
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
attach_function :SDL_GetTouchDevices, [:pointer], :pointer
|
|
18
|
+
attach_function :SDL_GetTouchDeviceName, [:SDL_TouchID], :string
|
|
19
|
+
attach_function :SDL_GetTouchDeviceType, [:SDL_TouchID], SDL_TouchDeviceType
|
|
20
|
+
attach_function :SDL_GetTouchFingers, [:SDL_TouchID, :pointer], :pointer
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
SDL_TrayEntryFlags = enum :SDL_TRAYENTRY_BUTTON, 0x00000001,
|
|
6
|
+
:SDL_TRAYENTRY_CHECKBOX, 0x00000002,
|
|
7
|
+
:SDL_TRAYENTRY_SUBMENU, 0x00000004,
|
|
8
|
+
:SDL_TRAYENTRY_DISABLED, 0x80000000,
|
|
9
|
+
:SDL_TRAYENTRY_CHECKED, 0x40000000
|
|
10
|
+
|
|
11
|
+
callback :SDL_TrayCallback, %i[pointer pointer], :void
|
|
12
|
+
|
|
13
|
+
begin
|
|
14
|
+
attach_function :SDL_CreateTray, %i[pointer string], :pointer
|
|
15
|
+
attach_function :SDL_CreateTrayWithProperties, [:SDL_PropertiesID], :pointer
|
|
16
|
+
attach_function :SDL_SetTrayIcon, %i[pointer pointer], :void
|
|
17
|
+
attach_function :SDL_SetTrayTooltip, %i[pointer string], :void
|
|
18
|
+
attach_function :SDL_CreateTrayMenu, [:pointer], :pointer
|
|
19
|
+
attach_function :SDL_CreateTraySubmenu, [:pointer], :pointer
|
|
20
|
+
attach_function :SDL_GetTrayMenu, [:pointer], :pointer
|
|
21
|
+
attach_function :SDL_GetTraySubmenu, [:pointer], :pointer
|
|
22
|
+
attach_function :SDL_GetTrayEntries, %i[pointer pointer], :pointer
|
|
23
|
+
attach_function :SDL_RemoveTrayEntry, [:pointer], :void
|
|
24
|
+
attach_function :SDL_InsertTrayEntryAt, %i[pointer int string uint32], :pointer
|
|
25
|
+
attach_function :SDL_SetTrayEntryLabel, %i[pointer string], :void
|
|
26
|
+
attach_function :SDL_GetTrayEntryLabel, [:pointer], :string
|
|
27
|
+
attach_function :SDL_SetTrayEntryChecked, %i[pointer bool], :void
|
|
28
|
+
attach_function :SDL_GetTrayEntryChecked, [:pointer], :bool
|
|
29
|
+
attach_function :SDL_SetTrayEntryEnabled, %i[pointer bool], :void
|
|
30
|
+
attach_function :SDL_GetTrayEntryEnabled, [:pointer], :bool
|
|
31
|
+
attach_function :SDL_SetTrayEntryCallback, [:pointer, :SDL_TrayCallback, :pointer], :void
|
|
32
|
+
attach_function :SDL_ClickTrayEntry, [:pointer], :void
|
|
33
|
+
attach_function :SDL_UpdateTrays, [], :void
|
|
34
|
+
attach_function :SDL_DestroyTray, [:pointer], :void
|
|
35
|
+
attach_function :SDL_GetTrayEntryParent, [:pointer], :pointer
|
|
36
|
+
attach_function :SDL_GetTrayMenuParentEntry, [:pointer], :pointer
|
|
37
|
+
attach_function :SDL_GetTrayMenuParentTray, [:pointer], :pointer
|
|
38
|
+
rescue FFI::NotFoundError
|
|
39
|
+
# Tray API may not be available in all SDL3 versions
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -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,208 @@
|
|
|
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_DisplayOrientation = enum :SDL_ORIENTATION_UNKNOWN, 0,
|
|
12
|
+
:SDL_ORIENTATION_LANDSCAPE, 1,
|
|
13
|
+
:SDL_ORIENTATION_LANDSCAPE_FLIPPED, 2,
|
|
14
|
+
:SDL_ORIENTATION_PORTRAIT, 3,
|
|
15
|
+
:SDL_ORIENTATION_PORTRAIT_FLIPPED, 4
|
|
16
|
+
|
|
17
|
+
SDL_ProgressState = enum :SDL_PROGRESS_STATE_INVALID, -1,
|
|
18
|
+
:SDL_PROGRESS_STATE_NONE, 0,
|
|
19
|
+
:SDL_PROGRESS_STATE_INDETERMINATE, 1,
|
|
20
|
+
:SDL_PROGRESS_STATE_NORMAL, 2,
|
|
21
|
+
:SDL_PROGRESS_STATE_PAUSED, 3,
|
|
22
|
+
:SDL_PROGRESS_STATE_ERROR, 4
|
|
23
|
+
|
|
24
|
+
SDL_WINDOW_FULLSCREEN = 0x0000000000000001
|
|
25
|
+
SDL_WINDOW_OPENGL = 0x0000000000000002
|
|
26
|
+
SDL_WINDOW_OCCLUDED = 0x0000000000000004
|
|
27
|
+
SDL_WINDOW_HIDDEN = 0x0000000000000008
|
|
28
|
+
SDL_WINDOW_BORDERLESS = 0x0000000000000010
|
|
29
|
+
SDL_WINDOW_RESIZABLE = 0x0000000000000020
|
|
30
|
+
SDL_WINDOW_MINIMIZED = 0x0000000000000040
|
|
31
|
+
SDL_WINDOW_MAXIMIZED = 0x0000000000000080
|
|
32
|
+
SDL_WINDOW_MOUSE_GRABBED = 0x0000000000000100
|
|
33
|
+
SDL_WINDOW_INPUT_FOCUS = 0x0000000000000200
|
|
34
|
+
SDL_WINDOW_MOUSE_FOCUS = 0x0000000000000400
|
|
35
|
+
SDL_WINDOW_EXTERNAL = 0x0000000000000800
|
|
36
|
+
SDL_WINDOW_MODAL = 0x0000000000001000
|
|
37
|
+
SDL_WINDOW_HIGH_PIXEL_DENSITY = 0x0000000000002000
|
|
38
|
+
SDL_WINDOW_MOUSE_CAPTURE = 0x0000000000004000
|
|
39
|
+
SDL_WINDOW_MOUSE_RELATIVE_MODE = 0x0000000000008000
|
|
40
|
+
SDL_WINDOW_ALWAYS_ON_TOP = 0x0000000000010000
|
|
41
|
+
SDL_WINDOW_UTILITY = 0x0000000000020000
|
|
42
|
+
SDL_WINDOW_TOOLTIP = 0x0000000000040000
|
|
43
|
+
SDL_WINDOW_POPUP_MENU = 0x0000000000080000
|
|
44
|
+
SDL_WINDOW_KEYBOARD_GRABBED = 0x0000000000100000
|
|
45
|
+
SDL_WINDOW_VULKAN = 0x0000000010000000
|
|
46
|
+
SDL_WINDOW_METAL = 0x0000000020000000
|
|
47
|
+
SDL_WINDOW_TRANSPARENT = 0x0000000040000000
|
|
48
|
+
SDL_WINDOW_NOT_FOCUSABLE = 0x0000000080000000
|
|
49
|
+
|
|
50
|
+
SDL_FlashOperation = enum :SDL_FLASH_CANCEL, 0,
|
|
51
|
+
:SDL_FLASH_BRIEFLY, 1,
|
|
52
|
+
:SDL_FLASH_UNTIL_FOCUSED, 2
|
|
53
|
+
|
|
54
|
+
class SDL_DisplayMode < FFI::Struct
|
|
55
|
+
layout :displayID, :SDL_DisplayID,
|
|
56
|
+
:format, :uint32,
|
|
57
|
+
:w, :int,
|
|
58
|
+
:h, :int,
|
|
59
|
+
:pixel_density, :float,
|
|
60
|
+
:refresh_rate, :float,
|
|
61
|
+
:refresh_rate_numerator, :int,
|
|
62
|
+
:refresh_rate_denominator, :int,
|
|
63
|
+
:internal, :pointer
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
attach_function :SDL_GetNumVideoDrivers, [], :int
|
|
67
|
+
attach_function :SDL_GetVideoDriver, [:int], :string
|
|
68
|
+
attach_function :SDL_GetCurrentVideoDriver, [], :string
|
|
69
|
+
attach_function :SDL_GetSystemTheme, [], SDL_SystemTheme
|
|
70
|
+
attach_function :SDL_GetDisplays, [:pointer], :pointer
|
|
71
|
+
attach_function :SDL_GetPrimaryDisplay, [], :SDL_DisplayID
|
|
72
|
+
attach_function :SDL_GetDisplayProperties, [:SDL_DisplayID], :SDL_PropertiesID
|
|
73
|
+
attach_function :SDL_GetDisplayName, [:SDL_DisplayID], :string
|
|
74
|
+
attach_function :SDL_GetDisplayBounds, [:SDL_DisplayID, SDL_Rect.ptr], :bool
|
|
75
|
+
attach_function :SDL_GetDisplayUsableBounds, [:SDL_DisplayID, SDL_Rect.ptr], :bool
|
|
76
|
+
begin
|
|
77
|
+
attach_function :SDL_GetNaturalDisplayOrientation, [:SDL_DisplayID], SDL_DisplayOrientation
|
|
78
|
+
attach_function :SDL_GetCurrentDisplayOrientation, [:SDL_DisplayID], SDL_DisplayOrientation
|
|
79
|
+
rescue FFI::NotFoundError
|
|
80
|
+
# Added in newer SDL3 versions.
|
|
81
|
+
end
|
|
82
|
+
attach_function :SDL_GetDisplayContentScale, [:SDL_DisplayID], :float
|
|
83
|
+
attach_function :SDL_GetFullscreenDisplayModes, [:SDL_DisplayID, :pointer], :pointer
|
|
84
|
+
attach_function :SDL_GetClosestFullscreenDisplayMode, [:SDL_DisplayID, :int, :int, :float, :bool, SDL_DisplayMode.ptr], :bool
|
|
85
|
+
attach_function :SDL_GetDesktopDisplayMode, [:SDL_DisplayID], SDL_DisplayMode.ptr
|
|
86
|
+
attach_function :SDL_GetCurrentDisplayMode, [:SDL_DisplayID], SDL_DisplayMode.ptr
|
|
87
|
+
begin
|
|
88
|
+
attach_function :SDL_GetDisplayForPoint, [SDL_Point.ptr], :SDL_DisplayID
|
|
89
|
+
attach_function :SDL_GetDisplayForRect, [SDL_Rect.ptr], :SDL_DisplayID
|
|
90
|
+
attach_function :SDL_GetDisplayForWindow, [:pointer], :SDL_DisplayID
|
|
91
|
+
rescue FFI::NotFoundError
|
|
92
|
+
# Added in newer SDL3 versions.
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
attach_function :SDL_CreateWindow, [:string, :int, :int, :uint64], :pointer
|
|
96
|
+
attach_function :SDL_CreatePopupWindow, [:pointer, :int, :int, :int, :int, :uint64], :pointer
|
|
97
|
+
attach_function :SDL_CreateWindowWithProperties, [:SDL_PropertiesID], :pointer
|
|
98
|
+
attach_function :SDL_GetWindowID, [:pointer], :SDL_WindowID
|
|
99
|
+
attach_function :SDL_GetWindowFromID, [:SDL_WindowID], :pointer
|
|
100
|
+
attach_function :SDL_GetWindowParent, [:pointer], :pointer
|
|
101
|
+
attach_function :SDL_GetWindowProperties, [:pointer], :SDL_PropertiesID
|
|
102
|
+
attach_function :SDL_GetWindowFlags, [:pointer], :uint64
|
|
103
|
+
attach_function :SDL_SetWindowTitle, %i[pointer string], :bool
|
|
104
|
+
attach_function :SDL_GetWindowTitle, [:pointer], :string
|
|
105
|
+
attach_function :SDL_SetWindowIcon, %i[pointer pointer], :bool
|
|
106
|
+
attach_function :SDL_SetWindowPosition, %i[pointer int int], :bool
|
|
107
|
+
attach_function :SDL_GetWindowPosition, %i[pointer pointer pointer], :bool
|
|
108
|
+
attach_function :SDL_SetWindowSize, %i[pointer int int], :bool
|
|
109
|
+
attach_function :SDL_GetWindowSize, %i[pointer pointer pointer], :bool
|
|
110
|
+
begin
|
|
111
|
+
attach_function :SDL_GetWindowPixelDensity, [:pointer], :float
|
|
112
|
+
attach_function :SDL_GetWindowDisplayScale, [:pointer], :float
|
|
113
|
+
rescue FFI::NotFoundError
|
|
114
|
+
# Added in newer SDL3 versions.
|
|
115
|
+
end
|
|
116
|
+
attach_function :SDL_GetWindowSafeArea, [:pointer, SDL_Rect.ptr], :bool
|
|
117
|
+
attach_function :SDL_SetWindowAspectRatio, %i[pointer float float], :bool
|
|
118
|
+
attach_function :SDL_GetWindowAspectRatio, %i[pointer pointer pointer], :bool
|
|
119
|
+
attach_function :SDL_GetWindowBordersSize, %i[pointer pointer pointer pointer pointer], :bool
|
|
120
|
+
attach_function :SDL_GetWindowSizeInPixels, %i[pointer pointer pointer], :bool
|
|
121
|
+
attach_function :SDL_SetWindowMinimumSize, %i[pointer int int], :bool
|
|
122
|
+
attach_function :SDL_GetWindowMinimumSize, %i[pointer pointer pointer], :bool
|
|
123
|
+
attach_function :SDL_SetWindowMaximumSize, %i[pointer int int], :bool
|
|
124
|
+
attach_function :SDL_GetWindowMaximumSize, %i[pointer pointer pointer], :bool
|
|
125
|
+
attach_function :SDL_SetWindowBordered, %i[pointer bool], :bool
|
|
126
|
+
attach_function :SDL_SetWindowResizable, %i[pointer bool], :bool
|
|
127
|
+
attach_function :SDL_SetWindowAlwaysOnTop, %i[pointer bool], :bool
|
|
128
|
+
attach_function :SDL_ShowWindow, [:pointer], :bool
|
|
129
|
+
attach_function :SDL_HideWindow, [:pointer], :bool
|
|
130
|
+
attach_function :SDL_RaiseWindow, [:pointer], :bool
|
|
131
|
+
attach_function :SDL_MaximizeWindow, [:pointer], :bool
|
|
132
|
+
attach_function :SDL_MinimizeWindow, [:pointer], :bool
|
|
133
|
+
attach_function :SDL_RestoreWindow, [:pointer], :bool
|
|
134
|
+
attach_function :SDL_SetWindowFullscreen, %i[pointer bool], :bool
|
|
135
|
+
begin
|
|
136
|
+
attach_function :SDL_SetWindowFullscreenMode, [:pointer, SDL_DisplayMode.ptr], :bool
|
|
137
|
+
attach_function :SDL_GetWindowFullscreenMode, [:pointer], SDL_DisplayMode.ptr
|
|
138
|
+
rescue FFI::NotFoundError
|
|
139
|
+
# Added in newer SDL3 versions.
|
|
140
|
+
end
|
|
141
|
+
attach_function :SDL_SyncWindow, [:pointer], :bool
|
|
142
|
+
attach_function :SDL_WindowHasSurface, [:pointer], :bool
|
|
143
|
+
attach_function :SDL_GetWindowSurface, [:pointer], :pointer
|
|
144
|
+
attach_function :SDL_SetWindowSurfaceVSync, %i[pointer int], :bool
|
|
145
|
+
attach_function :SDL_GetWindowSurfaceVSync, %i[pointer pointer], :bool
|
|
146
|
+
attach_function :SDL_UpdateWindowSurface, [:pointer], :bool
|
|
147
|
+
attach_function :SDL_UpdateWindowSurfaceRects, [:pointer, SDL_Rect.ptr, :int], :bool
|
|
148
|
+
attach_function :SDL_DestroyWindowSurface, [:pointer], :bool
|
|
149
|
+
attach_function :SDL_SetWindowKeyboardGrab, %i[pointer bool], :bool
|
|
150
|
+
attach_function :SDL_SetWindowMouseGrab, %i[pointer bool], :bool
|
|
151
|
+
attach_function :SDL_GetWindowKeyboardGrab, [:pointer], :bool
|
|
152
|
+
attach_function :SDL_GetWindowMouseGrab, [:pointer], :bool
|
|
153
|
+
attach_function :SDL_GetGrabbedWindow, [], :pointer
|
|
154
|
+
attach_function :SDL_SetWindowMouseRect, [:pointer, SDL_Rect.ptr], :bool
|
|
155
|
+
attach_function :SDL_GetWindowMouseRect, [:pointer], SDL_Rect.ptr
|
|
156
|
+
attach_function :SDL_SetWindowOpacity, %i[pointer float], :bool
|
|
157
|
+
attach_function :SDL_GetWindowOpacity, [:pointer], :float
|
|
158
|
+
attach_function :SDL_SetWindowParent, %i[pointer pointer], :bool
|
|
159
|
+
attach_function :SDL_SetWindowModal, %i[pointer bool], :bool
|
|
160
|
+
attach_function :SDL_SetWindowFocusable, %i[pointer bool], :bool
|
|
161
|
+
begin
|
|
162
|
+
attach_function :SDL_SetWindowFillDocument, %i[pointer bool], :bool
|
|
163
|
+
attach_function :SDL_GetWindowICCProfile, %i[pointer pointer], :pointer
|
|
164
|
+
attach_function :SDL_GetWindowPixelFormat, [:pointer], :uint32
|
|
165
|
+
attach_function :SDL_GetWindows, [:pointer], :pointer
|
|
166
|
+
attach_function :SDL_SetWindowHitTest, %i[pointer pointer pointer], :bool
|
|
167
|
+
attach_function :SDL_SetWindowShape, %i[pointer pointer], :bool
|
|
168
|
+
attach_function :SDL_SetWindowProgressState, [:pointer, SDL_ProgressState], :bool
|
|
169
|
+
attach_function :SDL_GetWindowProgressState, [:pointer], SDL_ProgressState
|
|
170
|
+
attach_function :SDL_SetWindowProgressValue, %i[pointer float], :bool
|
|
171
|
+
attach_function :SDL_GetWindowProgressValue, [:pointer], :float
|
|
172
|
+
rescue FFI::NotFoundError
|
|
173
|
+
# Added in newer SDL3 versions.
|
|
174
|
+
end
|
|
175
|
+
attach_function :SDL_ShowWindowSystemMenu, %i[pointer int int], :bool
|
|
176
|
+
attach_function :SDL_FlashWindow, [:pointer, SDL_FlashOperation], :bool
|
|
177
|
+
attach_function :SDL_DestroyWindow, [:pointer], :void
|
|
178
|
+
attach_function :SDL_ScreenSaverEnabled, [], :bool
|
|
179
|
+
attach_function :SDL_EnableScreenSaver, [], :bool
|
|
180
|
+
attach_function :SDL_DisableScreenSaver, [], :bool
|
|
181
|
+
|
|
182
|
+
attach_function :SDL_GL_LoadLibrary, [:string], :bool
|
|
183
|
+
attach_function :SDL_GL_GetProcAddress, [:string], :pointer
|
|
184
|
+
attach_function :SDL_GL_UnloadLibrary, [], :void
|
|
185
|
+
attach_function :SDL_GL_ExtensionSupported, [:string], :bool
|
|
186
|
+
attach_function :SDL_GL_ResetAttributes, [], :void
|
|
187
|
+
attach_function :SDL_GL_SetAttribute, %i[int int], :bool
|
|
188
|
+
attach_function :SDL_GL_GetAttribute, %i[int pointer], :bool
|
|
189
|
+
attach_function :SDL_GL_CreateContext, [:pointer], :pointer
|
|
190
|
+
attach_function :SDL_GL_MakeCurrent, %i[pointer pointer], :bool
|
|
191
|
+
attach_function :SDL_GL_GetCurrentWindow, [], :pointer
|
|
192
|
+
attach_function :SDL_GL_GetCurrentContext, [], :pointer
|
|
193
|
+
attach_function :SDL_GL_SetSwapInterval, [:int], :bool
|
|
194
|
+
attach_function :SDL_GL_GetSwapInterval, [:pointer], :bool
|
|
195
|
+
attach_function :SDL_GL_SwapWindow, [:pointer], :bool
|
|
196
|
+
attach_function :SDL_GL_DestroyContext, [:pointer], :bool
|
|
197
|
+
|
|
198
|
+
begin
|
|
199
|
+
attach_function :SDL_EGL_GetProcAddress, [:string], :pointer
|
|
200
|
+
attach_function :SDL_EGL_GetCurrentDisplay, [], :pointer
|
|
201
|
+
attach_function :SDL_EGL_GetCurrentConfig, [], :pointer
|
|
202
|
+
attach_function :SDL_EGL_GetWindowSurface, [:pointer], :pointer
|
|
203
|
+
attach_function :SDL_EGL_SetAttributeCallbacks, %i[pointer pointer pointer pointer], :void
|
|
204
|
+
rescue FFI::NotFoundError
|
|
205
|
+
# EGL entry points can be unavailable depending on SDL build options.
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
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
|
data/lib/sdl3/version.rb
ADDED
data/lib/sdl3.rb
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
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/main"
|
|
12
|
+
require_relative "sdl3/raw/error"
|
|
13
|
+
require_relative "sdl3/raw/rect"
|
|
14
|
+
require_relative "sdl3/raw/pixels"
|
|
15
|
+
require_relative "sdl3/raw/blendmode"
|
|
16
|
+
require_relative "sdl3/raw/hints"
|
|
17
|
+
require_relative "sdl3/raw/log"
|
|
18
|
+
require_relative "sdl3/raw/properties"
|
|
19
|
+
require_relative "sdl3/raw/video"
|
|
20
|
+
require_relative "sdl3/raw/surface"
|
|
21
|
+
require_relative "sdl3/raw/render"
|
|
22
|
+
require_relative "sdl3/raw/scancode"
|
|
23
|
+
require_relative "sdl3/raw/keycode"
|
|
24
|
+
require_relative "sdl3/raw/keyboard"
|
|
25
|
+
require_relative "sdl3/raw/mouse"
|
|
26
|
+
require_relative "sdl3/raw/joystick"
|
|
27
|
+
require_relative "sdl3/raw/gamepad"
|
|
28
|
+
require_relative "sdl3/raw/touch"
|
|
29
|
+
require_relative "sdl3/raw/pen"
|
|
30
|
+
require_relative "sdl3/raw/sensor"
|
|
31
|
+
require_relative "sdl3/raw/events"
|
|
32
|
+
require_relative "sdl3/raw/audio"
|
|
33
|
+
require_relative "sdl3/raw/haptic"
|
|
34
|
+
require_relative "sdl3/raw/timer"
|
|
35
|
+
require_relative "sdl3/raw/filesystem"
|
|
36
|
+
require_relative "sdl3/raw/clipboard"
|
|
37
|
+
require_relative "sdl3/raw/cpuinfo"
|
|
38
|
+
require_relative "sdl3/raw/endian"
|
|
39
|
+
require_relative "sdl3/raw/power"
|
|
40
|
+
require_relative "sdl3/raw/messagebox"
|
|
41
|
+
require_relative "sdl3/raw/locale"
|
|
42
|
+
require_relative "sdl3/raw/misc"
|
|
43
|
+
require_relative "sdl3/raw/platform"
|
|
44
|
+
require_relative "sdl3/raw/system"
|
|
45
|
+
require_relative "sdl3/raw/iostream"
|
|
46
|
+
require_relative "sdl3/raw/time"
|
|
47
|
+
require_relative "sdl3/raw/dialog"
|
|
48
|
+
require_relative "sdl3/raw/loadso"
|
|
49
|
+
require_relative "sdl3/raw/version"
|
|
50
|
+
require_relative "sdl3/raw/thread"
|
|
51
|
+
require_relative "sdl3/raw/mutex"
|
|
52
|
+
require_relative "sdl3/raw/atomic"
|
|
53
|
+
require_relative "sdl3/raw/camera"
|
|
54
|
+
require_relative "sdl3/raw/asyncio"
|
|
55
|
+
require_relative "sdl3/raw/vulkan"
|
|
56
|
+
require_relative "sdl3/raw/metal"
|
|
57
|
+
require_relative "sdl3/raw/storage"
|
|
58
|
+
require_relative "sdl3/raw/process"
|
|
59
|
+
require_relative "sdl3/raw/tray"
|
|
60
|
+
require_relative "sdl3/raw/gpu"
|
|
61
|
+
require_relative "sdl3/raw/openxr"
|
|
62
|
+
require_relative "sdl3/raw/hidapi"
|
|
63
|
+
|
|
64
|
+
require_relative "sdl3/high_level/surface"
|
|
65
|
+
require_relative "sdl3/high_level/window"
|
|
66
|
+
require_relative "sdl3/high_level/renderer"
|
|
67
|
+
require_relative "sdl3/high_level/texture"
|
|
68
|
+
require_relative "sdl3/high_level/event"
|
|
69
|
+
require_relative "sdl3/high_level/audio_device"
|
|
70
|
+
require_relative "sdl3/high_level/joystick"
|
|
71
|
+
require_relative "sdl3/high_level/gamepad"
|
|
72
|
+
require_relative "sdl3/high_level/haptic"
|
|
73
|
+
require_relative "sdl3/high_level/camera"
|
|
74
|
+
require_relative "sdl3/high_level/timer"
|
|
75
|
+
require_relative "sdl3/high_level/clipboard"
|
|
76
|
+
require_relative "sdl3/high_level/gpu"
|
|
77
|
+
require_relative "sdl3/high_level/sensor"
|
|
78
|
+
|
|
79
|
+
module SDL3
|
|
80
|
+
class Error < StandardError; end
|
|
81
|
+
class InitError < Error; end
|
|
82
|
+
class WindowError < Error; end
|
|
83
|
+
class RendererError < Error; end
|
|
84
|
+
class AudioError < Error; end
|
|
85
|
+
|
|
86
|
+
INIT_AUDIO = Raw::SDL_INIT_AUDIO
|
|
87
|
+
INIT_VIDEO = Raw::SDL_INIT_VIDEO
|
|
88
|
+
INIT_JOYSTICK = Raw::SDL_INIT_JOYSTICK
|
|
89
|
+
INIT_HAPTIC = Raw::SDL_INIT_HAPTIC
|
|
90
|
+
INIT_GAMEPAD = Raw::SDL_INIT_GAMEPAD
|
|
91
|
+
INIT_EVENTS = Raw::SDL_INIT_EVENTS
|
|
92
|
+
INIT_SENSOR = Raw::SDL_INIT_SENSOR
|
|
93
|
+
INIT_CAMERA = Raw::SDL_INIT_CAMERA
|
|
94
|
+
|
|
95
|
+
class << self
|
|
96
|
+
def init(flags)
|
|
97
|
+
raise InitError, Raw.SDL_GetError unless Raw.SDL_Init(flags)
|
|
98
|
+
|
|
99
|
+
true
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def init_sub_system(flags)
|
|
103
|
+
raise InitError, Raw.SDL_GetError unless Raw.SDL_InitSubSystem(flags)
|
|
104
|
+
|
|
105
|
+
true
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def quit_sub_system(flags)
|
|
109
|
+
Raw.SDL_QuitSubSystem(flags)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def was_init(flags)
|
|
113
|
+
Raw.SDL_WasInit(flags)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def quit
|
|
117
|
+
Raw.SDL_Quit
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def error
|
|
121
|
+
Raw.SDL_GetError
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def clear_error
|
|
125
|
+
Raw.SDL_ClearError
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
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
|