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
data/lib/sdl3/raw/log.rb
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
SDL_LogCategory = enum :SDL_LOG_CATEGORY_APPLICATION, 0,
|
|
6
|
+
:SDL_LOG_CATEGORY_ERROR, 1,
|
|
7
|
+
:SDL_LOG_CATEGORY_ASSERT, 2,
|
|
8
|
+
:SDL_LOG_CATEGORY_SYSTEM, 3,
|
|
9
|
+
:SDL_LOG_CATEGORY_AUDIO, 4,
|
|
10
|
+
:SDL_LOG_CATEGORY_VIDEO, 5,
|
|
11
|
+
:SDL_LOG_CATEGORY_RENDER, 6,
|
|
12
|
+
:SDL_LOG_CATEGORY_INPUT, 7,
|
|
13
|
+
:SDL_LOG_CATEGORY_TEST, 8,
|
|
14
|
+
:SDL_LOG_CATEGORY_GPU, 9,
|
|
15
|
+
:SDL_LOG_CATEGORY_RESERVED2, 10,
|
|
16
|
+
:SDL_LOG_CATEGORY_RESERVED3, 11,
|
|
17
|
+
:SDL_LOG_CATEGORY_RESERVED4, 12,
|
|
18
|
+
:SDL_LOG_CATEGORY_RESERVED5, 13,
|
|
19
|
+
:SDL_LOG_CATEGORY_RESERVED6, 14,
|
|
20
|
+
:SDL_LOG_CATEGORY_RESERVED7, 15,
|
|
21
|
+
:SDL_LOG_CATEGORY_RESERVED8, 16,
|
|
22
|
+
:SDL_LOG_CATEGORY_RESERVED9, 17,
|
|
23
|
+
:SDL_LOG_CATEGORY_RESERVED10, 18,
|
|
24
|
+
:SDL_LOG_CATEGORY_CUSTOM, 19
|
|
25
|
+
|
|
26
|
+
SDL_LogPriority = enum :SDL_LOG_PRIORITY_INVALID, 0,
|
|
27
|
+
:SDL_LOG_PRIORITY_TRACE, 1,
|
|
28
|
+
:SDL_LOG_PRIORITY_VERBOSE, 2,
|
|
29
|
+
:SDL_LOG_PRIORITY_DEBUG, 3,
|
|
30
|
+
:SDL_LOG_PRIORITY_INFO, 4,
|
|
31
|
+
:SDL_LOG_PRIORITY_WARN, 5,
|
|
32
|
+
:SDL_LOG_PRIORITY_ERROR, 6,
|
|
33
|
+
:SDL_LOG_PRIORITY_CRITICAL, 7,
|
|
34
|
+
:SDL_LOG_PRIORITY_COUNT, 8
|
|
35
|
+
|
|
36
|
+
callback :SDL_LogOutputFunction, %i[pointer int int string], :void
|
|
37
|
+
|
|
38
|
+
attach_function :SDL_SetLogPriorities, [SDL_LogPriority], :void
|
|
39
|
+
attach_function :SDL_SetLogPriority, [SDL_LogCategory, SDL_LogPriority], :void
|
|
40
|
+
attach_function :SDL_GetLogPriority, [SDL_LogCategory], SDL_LogPriority
|
|
41
|
+
attach_function :SDL_ResetLogPriorities, [], :void
|
|
42
|
+
attach_function :SDL_SetLogPriorityPrefix, [SDL_LogPriority, :string], :bool
|
|
43
|
+
attach_function :SDL_Log, [:string, :varargs], :void
|
|
44
|
+
attach_function :SDL_LogTrace, [SDL_LogCategory, :string, :varargs], :void
|
|
45
|
+
attach_function :SDL_LogVerbose, [SDL_LogCategory, :string, :varargs], :void
|
|
46
|
+
attach_function :SDL_LogDebug, [SDL_LogCategory, :string, :varargs], :void
|
|
47
|
+
attach_function :SDL_LogInfo, [SDL_LogCategory, :string, :varargs], :void
|
|
48
|
+
attach_function :SDL_LogWarn, [SDL_LogCategory, :string, :varargs], :void
|
|
49
|
+
attach_function :SDL_LogError, [SDL_LogCategory, :string, :varargs], :void
|
|
50
|
+
attach_function :SDL_LogCritical, [SDL_LogCategory, :string, :varargs], :void
|
|
51
|
+
attach_function :SDL_LogMessage, [SDL_LogCategory, SDL_LogPriority, :string, :varargs], :void
|
|
52
|
+
begin
|
|
53
|
+
attach_function :SDL_LogMessageV, [:int, SDL_LogPriority, :string, :pointer], :void
|
|
54
|
+
rescue FFI::NotFoundError
|
|
55
|
+
# Added in newer SDL3 versions.
|
|
56
|
+
end
|
|
57
|
+
attach_function :SDL_GetDefaultLogOutputFunction, [], :pointer
|
|
58
|
+
attach_function :SDL_GetLogOutputFunction, %i[pointer pointer], :void
|
|
59
|
+
attach_function :SDL_SetLogOutputFunction, [:SDL_LogOutputFunction, :pointer], :void
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
callback :SDL_main_func, %i[int pointer], :int
|
|
6
|
+
callback :SDL_AppInit_func, %i[pointer int pointer], :int
|
|
7
|
+
callback :SDL_AppIterate_func, [:pointer], :int
|
|
8
|
+
callback :SDL_AppEvent_func, %i[pointer pointer], :int
|
|
9
|
+
callback :SDL_AppQuit_func, %i[pointer int], :void
|
|
10
|
+
|
|
11
|
+
attach_function :SDL_SetMainReady, [], :void
|
|
12
|
+
attach_function :SDL_RunApp, %i[int pointer SDL_main_func pointer], :int
|
|
13
|
+
attach_function :SDL_EnterAppMainCallbacks, %i[int pointer SDL_AppInit_func SDL_AppIterate_func SDL_AppEvent_func SDL_AppQuit_func], :int
|
|
14
|
+
|
|
15
|
+
begin
|
|
16
|
+
attach_function :SDL_RegisterApp, %i[string uint32 pointer], :bool
|
|
17
|
+
attach_function :SDL_UnregisterApp, [], :void
|
|
18
|
+
attach_function :SDL_GDKSuspendComplete, [], :void
|
|
19
|
+
rescue FFI::NotFoundError
|
|
20
|
+
# Platform-specific entry-point hooks may be unavailable.
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
SDL_MESSAGEBOX_ERROR = 0x00000010
|
|
6
|
+
SDL_MESSAGEBOX_WARNING = 0x00000020
|
|
7
|
+
SDL_MESSAGEBOX_INFORMATION = 0x00000040
|
|
8
|
+
SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080
|
|
9
|
+
SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100
|
|
10
|
+
|
|
11
|
+
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001
|
|
12
|
+
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002
|
|
13
|
+
|
|
14
|
+
SDL_MESSAGEBOX_COLOR_BACKGROUND = 0
|
|
15
|
+
SDL_MESSAGEBOX_COLOR_TEXT = 1
|
|
16
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = 2
|
|
17
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = 3
|
|
18
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = 4
|
|
19
|
+
SDL_MESSAGEBOX_COLOR_COUNT = 5
|
|
20
|
+
|
|
21
|
+
class SDL_MessageBoxButtonData < FFI::Struct
|
|
22
|
+
layout :flags, :uint32,
|
|
23
|
+
:buttonID, :int,
|
|
24
|
+
:text, :string
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class SDL_MessageBoxColor < FFI::Struct
|
|
28
|
+
layout :r, :uint8,
|
|
29
|
+
:g, :uint8,
|
|
30
|
+
:b, :uint8
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class SDL_MessageBoxColorScheme < FFI::Struct
|
|
34
|
+
layout :colors, [SDL_MessageBoxColor, SDL_MESSAGEBOX_COLOR_COUNT]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class SDL_MessageBoxData < FFI::Struct
|
|
38
|
+
layout :flags, :uint32,
|
|
39
|
+
:window, :pointer,
|
|
40
|
+
:title, :string,
|
|
41
|
+
:message, :string,
|
|
42
|
+
:numbuttons, :int,
|
|
43
|
+
:buttons, SDL_MessageBoxButtonData.ptr,
|
|
44
|
+
:colorScheme, SDL_MessageBoxColorScheme.ptr
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
attach_function :SDL_ShowMessageBox, [SDL_MessageBoxData.ptr, :pointer], :bool
|
|
48
|
+
attach_function :SDL_ShowSimpleMessageBox, %i[uint32 string string pointer], :bool
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
SDL_BUTTON_LEFT = 1
|
|
6
|
+
SDL_BUTTON_MIDDLE = 2
|
|
7
|
+
SDL_BUTTON_RIGHT = 3
|
|
8
|
+
SDL_BUTTON_X1 = 4
|
|
9
|
+
SDL_BUTTON_X2 = 5
|
|
10
|
+
|
|
11
|
+
SDL_BUTTON_LMASK = 1 << (SDL_BUTTON_LEFT - 1)
|
|
12
|
+
SDL_BUTTON_MMASK = 1 << (SDL_BUTTON_MIDDLE - 1)
|
|
13
|
+
SDL_BUTTON_RMASK = 1 << (SDL_BUTTON_RIGHT - 1)
|
|
14
|
+
SDL_BUTTON_X1MASK = 1 << (SDL_BUTTON_X1 - 1)
|
|
15
|
+
SDL_BUTTON_X2MASK = 1 << (SDL_BUTTON_X2 - 1)
|
|
16
|
+
|
|
17
|
+
SDL_SystemCursor = enum :SDL_SYSTEM_CURSOR_DEFAULT, 0,
|
|
18
|
+
:SDL_SYSTEM_CURSOR_TEXT, 1,
|
|
19
|
+
:SDL_SYSTEM_CURSOR_WAIT, 2,
|
|
20
|
+
:SDL_SYSTEM_CURSOR_CROSSHAIR, 3,
|
|
21
|
+
:SDL_SYSTEM_CURSOR_PROGRESS, 4,
|
|
22
|
+
:SDL_SYSTEM_CURSOR_NWSE_RESIZE, 5,
|
|
23
|
+
:SDL_SYSTEM_CURSOR_NESW_RESIZE, 6,
|
|
24
|
+
:SDL_SYSTEM_CURSOR_EW_RESIZE, 7,
|
|
25
|
+
:SDL_SYSTEM_CURSOR_NS_RESIZE, 8,
|
|
26
|
+
:SDL_SYSTEM_CURSOR_MOVE, 9,
|
|
27
|
+
:SDL_SYSTEM_CURSOR_NOT_ALLOWED, 10,
|
|
28
|
+
:SDL_SYSTEM_CURSOR_POINTER, 11,
|
|
29
|
+
:SDL_SYSTEM_CURSOR_NW_RESIZE, 12,
|
|
30
|
+
:SDL_SYSTEM_CURSOR_N_RESIZE, 13,
|
|
31
|
+
:SDL_SYSTEM_CURSOR_NE_RESIZE, 14,
|
|
32
|
+
:SDL_SYSTEM_CURSOR_E_RESIZE, 15,
|
|
33
|
+
:SDL_SYSTEM_CURSOR_SE_RESIZE, 16,
|
|
34
|
+
:SDL_SYSTEM_CURSOR_S_RESIZE, 17,
|
|
35
|
+
:SDL_SYSTEM_CURSOR_SW_RESIZE, 18,
|
|
36
|
+
:SDL_SYSTEM_CURSOR_W_RESIZE, 19,
|
|
37
|
+
:SDL_SYSTEM_CURSOR_COUNT, 20
|
|
38
|
+
|
|
39
|
+
SDL_MouseWheelDirection = enum :SDL_MOUSEWHEEL_NORMAL, 0,
|
|
40
|
+
:SDL_MOUSEWHEEL_FLIPPED, 1
|
|
41
|
+
|
|
42
|
+
class SDL_CursorFrameInfo < FFI::Struct
|
|
43
|
+
layout :surface, :pointer,
|
|
44
|
+
:duration, :uint32
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
callback :SDL_MouseMotionTransformCallback, %i[pointer uint64 pointer SDL_MouseID pointer pointer], :void
|
|
48
|
+
|
|
49
|
+
attach_function :SDL_HasMouse, [], :bool
|
|
50
|
+
attach_function :SDL_GetMice, [:pointer], :pointer
|
|
51
|
+
attach_function :SDL_GetMouseNameForID, [:SDL_MouseID], :string
|
|
52
|
+
attach_function :SDL_GetMouseFocus, [], :pointer
|
|
53
|
+
attach_function :SDL_GetMouseState, %i[pointer pointer], :uint32
|
|
54
|
+
attach_function :SDL_GetGlobalMouseState, %i[pointer pointer], :uint32
|
|
55
|
+
attach_function :SDL_GetRelativeMouseState, %i[pointer pointer], :uint32
|
|
56
|
+
attach_function :SDL_WarpMouseInWindow, %i[pointer float float], :void
|
|
57
|
+
attach_function :SDL_WarpMouseGlobal, %i[float float], :bool
|
|
58
|
+
attach_function :SDL_SetWindowRelativeMouseMode, %i[pointer bool], :bool
|
|
59
|
+
attach_function :SDL_GetWindowRelativeMouseMode, [:pointer], :bool
|
|
60
|
+
attach_function :SDL_CaptureMouse, [:bool], :bool
|
|
61
|
+
attach_function :SDL_CreateCursor, %i[pointer pointer int int int int], :pointer
|
|
62
|
+
attach_function :SDL_CreateColorCursor, [SDL_Surface.ptr, :int, :int], :pointer
|
|
63
|
+
begin
|
|
64
|
+
attach_function :SDL_CreateAnimatedCursor, [SDL_CursorFrameInfo.ptr, :int, :int, :int], :pointer
|
|
65
|
+
rescue FFI::NotFoundError
|
|
66
|
+
# Added in newer SDL3 versions.
|
|
67
|
+
end
|
|
68
|
+
attach_function :SDL_CreateSystemCursor, [SDL_SystemCursor], :pointer
|
|
69
|
+
begin
|
|
70
|
+
attach_function :SDL_SetRelativeMouseTransform, [:SDL_MouseMotionTransformCallback, :pointer], :bool
|
|
71
|
+
rescue FFI::NotFoundError
|
|
72
|
+
# Added in newer SDL3 versions.
|
|
73
|
+
end
|
|
74
|
+
attach_function :SDL_SetCursor, [:pointer], :bool
|
|
75
|
+
attach_function :SDL_GetCursor, [], :pointer
|
|
76
|
+
attach_function :SDL_GetDefaultCursor, [], :pointer
|
|
77
|
+
attach_function :SDL_DestroyCursor, [:pointer], :void
|
|
78
|
+
attach_function :SDL_ShowCursor, [], :bool
|
|
79
|
+
attach_function :SDL_HideCursor, [], :bool
|
|
80
|
+
attach_function :SDL_CursorVisible, [], :bool
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
class SDL_InitState < FFI::Struct
|
|
6
|
+
layout :status, :int,
|
|
7
|
+
:thread, :uint64,
|
|
8
|
+
:reserved, :pointer
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
attach_function :SDL_CreateMutex, [], :pointer
|
|
12
|
+
attach_function :SDL_LockMutex, [:pointer], :void
|
|
13
|
+
attach_function :SDL_TryLockMutex, [:pointer], :bool
|
|
14
|
+
attach_function :SDL_UnlockMutex, [:pointer], :void
|
|
15
|
+
attach_function :SDL_DestroyMutex, [:pointer], :void
|
|
16
|
+
|
|
17
|
+
attach_function :SDL_CreateRWLock, [], :pointer
|
|
18
|
+
attach_function :SDL_LockRWLockForReading, [:pointer], :void
|
|
19
|
+
attach_function :SDL_LockRWLockForWriting, [:pointer], :void
|
|
20
|
+
attach_function :SDL_TryLockRWLockForReading, [:pointer], :bool
|
|
21
|
+
attach_function :SDL_TryLockRWLockForWriting, [:pointer], :bool
|
|
22
|
+
attach_function :SDL_UnlockRWLock, [:pointer], :void
|
|
23
|
+
attach_function :SDL_DestroyRWLock, [:pointer], :void
|
|
24
|
+
|
|
25
|
+
attach_function :SDL_CreateSemaphore, [:uint32], :pointer
|
|
26
|
+
attach_function :SDL_DestroySemaphore, [:pointer], :void
|
|
27
|
+
attach_function :SDL_WaitSemaphore, [:pointer], :void
|
|
28
|
+
attach_function :SDL_TryWaitSemaphore, [:pointer], :bool
|
|
29
|
+
attach_function :SDL_WaitSemaphoreTimeout, %i[pointer int32], :bool
|
|
30
|
+
attach_function :SDL_SignalSemaphore, [:pointer], :void
|
|
31
|
+
attach_function :SDL_GetSemaphoreValue, [:pointer], :uint32
|
|
32
|
+
|
|
33
|
+
attach_function :SDL_CreateCondition, [], :pointer
|
|
34
|
+
attach_function :SDL_DestroyCondition, [:pointer], :void
|
|
35
|
+
attach_function :SDL_SignalCondition, [:pointer], :void
|
|
36
|
+
attach_function :SDL_BroadcastCondition, [:pointer], :void
|
|
37
|
+
attach_function :SDL_WaitCondition, %i[pointer pointer], :void
|
|
38
|
+
attach_function :SDL_WaitConditionTimeout, %i[pointer pointer int32], :bool
|
|
39
|
+
|
|
40
|
+
begin
|
|
41
|
+
attach_function :SDL_ShouldInit, [SDL_InitState.ptr], :bool
|
|
42
|
+
attach_function :SDL_ShouldQuit, [SDL_InitState.ptr], :bool
|
|
43
|
+
attach_function :SDL_SetInitialized, [SDL_InitState.ptr, :bool], :void
|
|
44
|
+
rescue FFI::NotFoundError
|
|
45
|
+
# Added in newer SDL3 versions.
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
typedef :uint64, :XrSession
|
|
6
|
+
typedef :uint64, :XrSwapchain
|
|
7
|
+
typedef :int, :XrResult
|
|
8
|
+
|
|
9
|
+
begin
|
|
10
|
+
attach_function :SDL_CreateGPUXRSession, %i[pointer pointer pointer], :XrResult
|
|
11
|
+
attach_function :SDL_GetGPUXRSwapchainFormats, %i[pointer XrSession pointer], :pointer
|
|
12
|
+
attach_function :SDL_CreateGPUXRSwapchain, %i[pointer XrSession pointer int pointer pointer], :XrResult
|
|
13
|
+
attach_function :SDL_DestroyGPUXRSwapchain, %i[pointer XrSwapchain pointer], :XrResult
|
|
14
|
+
attach_function :SDL_OpenXR_LoadLibrary, [], :bool
|
|
15
|
+
attach_function :SDL_OpenXR_UnloadLibrary, [], :void
|
|
16
|
+
attach_function :SDL_OpenXR_GetXrGetInstanceProcAddr, [], :pointer
|
|
17
|
+
rescue FFI::NotFoundError
|
|
18
|
+
# OpenXR APIs are only available on recent SDL builds.
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/sdl3/raw/pen.rb
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
SDL_PEN_INPUT_DOWN = 1 << 0
|
|
6
|
+
SDL_PEN_INPUT_BUTTON_1 = 1 << 1
|
|
7
|
+
SDL_PEN_INPUT_BUTTON_2 = 1 << 2
|
|
8
|
+
SDL_PEN_INPUT_BUTTON_3 = 1 << 3
|
|
9
|
+
SDL_PEN_INPUT_BUTTON_4 = 1 << 4
|
|
10
|
+
SDL_PEN_INPUT_BUTTON_5 = 1 << 5
|
|
11
|
+
SDL_PEN_INPUT_ERASER_TIP = 1 << 30
|
|
12
|
+
|
|
13
|
+
SDL_PenAxis = enum :SDL_PEN_AXIS_PRESSURE, 0,
|
|
14
|
+
:SDL_PEN_AXIS_XTILT, 1,
|
|
15
|
+
:SDL_PEN_AXIS_YTILT, 2,
|
|
16
|
+
:SDL_PEN_AXIS_DISTANCE, 3,
|
|
17
|
+
:SDL_PEN_AXIS_ROTATION, 4,
|
|
18
|
+
:SDL_PEN_AXIS_SLIDER, 5,
|
|
19
|
+
:SDL_PEN_AXIS_TANGENTIAL_PRESSURE, 6,
|
|
20
|
+
:SDL_PEN_AXIS_COUNT, 7
|
|
21
|
+
|
|
22
|
+
SDL_PenDeviceType = enum :SDL_PEN_DEVICE_TYPE_INVALID, -1,
|
|
23
|
+
:SDL_PEN_DEVICE_TYPE_UNKNOWN, 0,
|
|
24
|
+
:SDL_PEN_DEVICE_TYPE_DIRECT, 1,
|
|
25
|
+
:SDL_PEN_DEVICE_TYPE_INDIRECT, 2
|
|
26
|
+
|
|
27
|
+
begin
|
|
28
|
+
attach_function :SDL_GetPens, [:pointer], :pointer
|
|
29
|
+
attach_function :SDL_GetPenDeviceType, [:SDL_PenID], SDL_PenDeviceType
|
|
30
|
+
attach_function :SDL_GetPenStatus, %i[SDL_PenID pointer pointer], :uint32
|
|
31
|
+
attach_function :SDL_GetPenName, [:SDL_PenID], :string
|
|
32
|
+
attach_function :SDL_PenConnected, [:SDL_PenID], :bool
|
|
33
|
+
attach_function :SDL_GetPenCapabilities, %i[SDL_PenID pointer], :uint32
|
|
34
|
+
rescue FFI::NotFoundError
|
|
35
|
+
# Pen API may not be available in all SDL3 versions
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
SDL_PixelType = enum :SDL_PIXELTYPE_UNKNOWN, 0,
|
|
6
|
+
:SDL_PIXELTYPE_INDEX1, 1,
|
|
7
|
+
:SDL_PIXELTYPE_INDEX4, 2,
|
|
8
|
+
:SDL_PIXELTYPE_INDEX8, 3,
|
|
9
|
+
:SDL_PIXELTYPE_PACKED8, 4,
|
|
10
|
+
:SDL_PIXELTYPE_PACKED16, 5,
|
|
11
|
+
:SDL_PIXELTYPE_PACKED32, 6,
|
|
12
|
+
:SDL_PIXELTYPE_ARRAYU8, 7,
|
|
13
|
+
:SDL_PIXELTYPE_ARRAYU16, 8,
|
|
14
|
+
:SDL_PIXELTYPE_ARRAYU32, 9,
|
|
15
|
+
:SDL_PIXELTYPE_ARRAYF16, 10,
|
|
16
|
+
:SDL_PIXELTYPE_ARRAYF32, 11,
|
|
17
|
+
:SDL_PIXELTYPE_INDEX2, 12
|
|
18
|
+
|
|
19
|
+
SDL_BitmapOrder = enum :SDL_BITMAPORDER_NONE, 0,
|
|
20
|
+
:SDL_BITMAPORDER_4321, 1,
|
|
21
|
+
:SDL_BITMAPORDER_1234, 2
|
|
22
|
+
|
|
23
|
+
SDL_PackedOrder = enum :SDL_PACKEDORDER_NONE, 0,
|
|
24
|
+
:SDL_PACKEDORDER_XRGB, 1,
|
|
25
|
+
:SDL_PACKEDORDER_RGBX, 2,
|
|
26
|
+
:SDL_PACKEDORDER_ARGB, 3,
|
|
27
|
+
:SDL_PACKEDORDER_RGBA, 4,
|
|
28
|
+
:SDL_PACKEDORDER_XBGR, 5,
|
|
29
|
+
:SDL_PACKEDORDER_BGRX, 6,
|
|
30
|
+
:SDL_PACKEDORDER_ABGR, 7,
|
|
31
|
+
:SDL_PACKEDORDER_BGRA, 8
|
|
32
|
+
|
|
33
|
+
SDL_ArrayOrder = enum :SDL_ARRAYORDER_NONE, 0,
|
|
34
|
+
:SDL_ARRAYORDER_RGB, 1,
|
|
35
|
+
:SDL_ARRAYORDER_RGBA, 2,
|
|
36
|
+
:SDL_ARRAYORDER_ARGB, 3,
|
|
37
|
+
:SDL_ARRAYORDER_BGR, 4,
|
|
38
|
+
:SDL_ARRAYORDER_BGRA, 5,
|
|
39
|
+
:SDL_ARRAYORDER_ABGR, 6
|
|
40
|
+
|
|
41
|
+
SDL_PackedLayout = enum :SDL_PACKEDLAYOUT_NONE, 0,
|
|
42
|
+
:SDL_PACKEDLAYOUT_332, 1,
|
|
43
|
+
:SDL_PACKEDLAYOUT_4444, 2,
|
|
44
|
+
:SDL_PACKEDLAYOUT_1555, 3,
|
|
45
|
+
:SDL_PACKEDLAYOUT_5551, 4,
|
|
46
|
+
:SDL_PACKEDLAYOUT_565, 5,
|
|
47
|
+
:SDL_PACKEDLAYOUT_8888, 6,
|
|
48
|
+
:SDL_PACKEDLAYOUT_2101010, 7,
|
|
49
|
+
:SDL_PACKEDLAYOUT_1010102, 8
|
|
50
|
+
|
|
51
|
+
SDL_PIXELFORMAT_UNKNOWN = 0x00000000
|
|
52
|
+
SDL_PIXELFORMAT_INDEX1LSB = 0x11100100
|
|
53
|
+
SDL_PIXELFORMAT_INDEX1MSB = 0x11200100
|
|
54
|
+
SDL_PIXELFORMAT_INDEX2LSB = 0x1C100200
|
|
55
|
+
SDL_PIXELFORMAT_INDEX2MSB = 0x1C200200
|
|
56
|
+
SDL_PIXELFORMAT_INDEX4LSB = 0x12100400
|
|
57
|
+
SDL_PIXELFORMAT_INDEX4MSB = 0x12200400
|
|
58
|
+
SDL_PIXELFORMAT_INDEX8 = 0x13000801
|
|
59
|
+
SDL_PIXELFORMAT_RGB332 = 0x14110801
|
|
60
|
+
SDL_PIXELFORMAT_XRGB4444 = 0x15120C02
|
|
61
|
+
SDL_PIXELFORMAT_XBGR4444 = 0x15520C02
|
|
62
|
+
SDL_PIXELFORMAT_XRGB1555 = 0x15130F02
|
|
63
|
+
SDL_PIXELFORMAT_XBGR1555 = 0x15530F02
|
|
64
|
+
SDL_PIXELFORMAT_ARGB4444 = 0x15321002
|
|
65
|
+
SDL_PIXELFORMAT_RGBA4444 = 0x15421002
|
|
66
|
+
SDL_PIXELFORMAT_ABGR4444 = 0x15721002
|
|
67
|
+
SDL_PIXELFORMAT_BGRA4444 = 0x15821002
|
|
68
|
+
SDL_PIXELFORMAT_ARGB1555 = 0x15331002
|
|
69
|
+
SDL_PIXELFORMAT_RGBA5551 = 0x15441002
|
|
70
|
+
SDL_PIXELFORMAT_ABGR1555 = 0x15731002
|
|
71
|
+
SDL_PIXELFORMAT_BGRA5551 = 0x15841002
|
|
72
|
+
SDL_PIXELFORMAT_RGB565 = 0x15151002
|
|
73
|
+
SDL_PIXELFORMAT_BGR565 = 0x15551002
|
|
74
|
+
SDL_PIXELFORMAT_RGB24 = 0x17101803
|
|
75
|
+
SDL_PIXELFORMAT_BGR24 = 0x17401803
|
|
76
|
+
SDL_PIXELFORMAT_XRGB8888 = 0x16161804
|
|
77
|
+
SDL_PIXELFORMAT_RGBX8888 = 0x16261804
|
|
78
|
+
SDL_PIXELFORMAT_XBGR8888 = 0x16561804
|
|
79
|
+
SDL_PIXELFORMAT_BGRX8888 = 0x16661804
|
|
80
|
+
SDL_PIXELFORMAT_ARGB8888 = 0x16362004
|
|
81
|
+
SDL_PIXELFORMAT_RGBA8888 = 0x16462004
|
|
82
|
+
SDL_PIXELFORMAT_ABGR8888 = 0x16762004
|
|
83
|
+
SDL_PIXELFORMAT_BGRA8888 = 0x16862004
|
|
84
|
+
SDL_PIXELFORMAT_XRGB2101010 = 0x16172004
|
|
85
|
+
SDL_PIXELFORMAT_XBGR2101010 = 0x16572004
|
|
86
|
+
SDL_PIXELFORMAT_ARGB2101010 = 0x16372004
|
|
87
|
+
SDL_PIXELFORMAT_ABGR2101010 = 0x16772004
|
|
88
|
+
SDL_PIXELFORMAT_RGB48 = 0x18103006
|
|
89
|
+
SDL_PIXELFORMAT_BGR48 = 0x18403006
|
|
90
|
+
SDL_PIXELFORMAT_RGBA64 = 0x18204008
|
|
91
|
+
SDL_PIXELFORMAT_ARGB64 = 0x18304008
|
|
92
|
+
SDL_PIXELFORMAT_BGRA64 = 0x18504008
|
|
93
|
+
SDL_PIXELFORMAT_ABGR64 = 0x18604008
|
|
94
|
+
SDL_PIXELFORMAT_RGB48_FLOAT = 0x1A103006
|
|
95
|
+
SDL_PIXELFORMAT_BGR48_FLOAT = 0x1A403006
|
|
96
|
+
SDL_PIXELFORMAT_RGBA64_FLOAT = 0x1A204008
|
|
97
|
+
SDL_PIXELFORMAT_ARGB64_FLOAT = 0x1A304008
|
|
98
|
+
SDL_PIXELFORMAT_BGRA64_FLOAT = 0x1A504008
|
|
99
|
+
SDL_PIXELFORMAT_ABGR64_FLOAT = 0x1A604008
|
|
100
|
+
SDL_PIXELFORMAT_RGB96_FLOAT = 0x1B10600C
|
|
101
|
+
SDL_PIXELFORMAT_BGR96_FLOAT = 0x1B40600C
|
|
102
|
+
SDL_PIXELFORMAT_RGBA128_FLOAT = 0x1B208010
|
|
103
|
+
SDL_PIXELFORMAT_ARGB128_FLOAT = 0x1B308010
|
|
104
|
+
SDL_PIXELFORMAT_BGRA128_FLOAT = 0x1B508010
|
|
105
|
+
SDL_PIXELFORMAT_ABGR128_FLOAT = 0x1B608010
|
|
106
|
+
SDL_PIXELFORMAT_YV12 = 0x32315659
|
|
107
|
+
SDL_PIXELFORMAT_IYUV = 0x56555949
|
|
108
|
+
SDL_PIXELFORMAT_YUY2 = 0x32595559
|
|
109
|
+
SDL_PIXELFORMAT_UYVY = 0x59565955
|
|
110
|
+
SDL_PIXELFORMAT_YVYU = 0x55595659
|
|
111
|
+
SDL_PIXELFORMAT_NV12 = 0x3231564E
|
|
112
|
+
SDL_PIXELFORMAT_NV21 = 0x3132564E
|
|
113
|
+
SDL_PIXELFORMAT_P010 = 0x30313050
|
|
114
|
+
SDL_PIXELFORMAT_EXTERNAL_OES = 0x2053454F
|
|
115
|
+
|
|
116
|
+
SDL_Colorspace = enum :SDL_COLORSPACE_UNKNOWN, 0,
|
|
117
|
+
:SDL_COLORSPACE_SRGB, 0x120005A0,
|
|
118
|
+
:SDL_COLORSPACE_SRGB_LINEAR, 0x12000500,
|
|
119
|
+
:SDL_COLORSPACE_HDR10, 0x12002600,
|
|
120
|
+
:SDL_COLORSPACE_JPEG, 0x220004C6,
|
|
121
|
+
:SDL_COLORSPACE_BT601_LIMITED, 0x211018C6,
|
|
122
|
+
:SDL_COLORSPACE_BT601_FULL, 0x221018C6,
|
|
123
|
+
:SDL_COLORSPACE_BT709_LIMITED, 0x21100421,
|
|
124
|
+
:SDL_COLORSPACE_BT709_FULL, 0x22100421,
|
|
125
|
+
:SDL_COLORSPACE_BT2020_LIMITED, 0x21102609,
|
|
126
|
+
:SDL_COLORSPACE_BT2020_FULL, 0x22102609
|
|
127
|
+
|
|
128
|
+
class SDL_Color < FFI::Struct
|
|
129
|
+
layout :r, :uint8,
|
|
130
|
+
:g, :uint8,
|
|
131
|
+
:b, :uint8,
|
|
132
|
+
:a, :uint8
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
class SDL_FColor < FFI::Struct
|
|
136
|
+
layout :r, :float,
|
|
137
|
+
:g, :float,
|
|
138
|
+
:b, :float,
|
|
139
|
+
:a, :float
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
class SDL_Palette < FFI::Struct
|
|
143
|
+
layout :ncolors, :int,
|
|
144
|
+
:colors, :pointer,
|
|
145
|
+
:version, :uint32,
|
|
146
|
+
:refcount, :int
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
class SDL_PixelFormatDetails < FFI::Struct
|
|
150
|
+
layout :format, :uint32,
|
|
151
|
+
:bits_per_pixel, :uint8,
|
|
152
|
+
:bytes_per_pixel, :uint8,
|
|
153
|
+
:padding, [:uint8, 2],
|
|
154
|
+
:Rmask, :uint32,
|
|
155
|
+
:Gmask, :uint32,
|
|
156
|
+
:Bmask, :uint32,
|
|
157
|
+
:Amask, :uint32,
|
|
158
|
+
:Rbits, :uint8,
|
|
159
|
+
:Gbits, :uint8,
|
|
160
|
+
:Bbits, :uint8,
|
|
161
|
+
:Abits, :uint8,
|
|
162
|
+
:Rshift, :uint8,
|
|
163
|
+
:Gshift, :uint8,
|
|
164
|
+
:Bshift, :uint8,
|
|
165
|
+
:Ashift, :uint8
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
attach_function :SDL_GetPixelFormatName, [:uint32], :string
|
|
169
|
+
attach_function :SDL_GetMasksForPixelFormat, [:uint32, :pointer, :pointer, :pointer, :pointer, :pointer], :bool
|
|
170
|
+
attach_function :SDL_GetPixelFormatForMasks, %i[int uint32 uint32 uint32 uint32], :uint32
|
|
171
|
+
attach_function :SDL_GetPixelFormatDetails, [:uint32], SDL_PixelFormatDetails.ptr
|
|
172
|
+
attach_function :SDL_CreatePalette, [:int], SDL_Palette.ptr
|
|
173
|
+
attach_function :SDL_SetPaletteColors, [SDL_Palette.ptr, SDL_Color.ptr, :int, :int], :bool
|
|
174
|
+
attach_function :SDL_DestroyPalette, [SDL_Palette.ptr], :void
|
|
175
|
+
attach_function :SDL_MapRGB, [SDL_PixelFormatDetails.ptr, SDL_Palette.ptr, :uint8, :uint8, :uint8], :uint32
|
|
176
|
+
attach_function :SDL_MapRGBA, [SDL_PixelFormatDetails.ptr, SDL_Palette.ptr, :uint8, :uint8, :uint8, :uint8], :uint32
|
|
177
|
+
attach_function :SDL_GetRGB, [:uint32, SDL_PixelFormatDetails.ptr, SDL_Palette.ptr, :pointer, :pointer, :pointer], :void
|
|
178
|
+
attach_function :SDL_GetRGBA, [:uint32, SDL_PixelFormatDetails.ptr, SDL_Palette.ptr, :pointer, :pointer, :pointer, :pointer], :void
|
|
179
|
+
end
|
|
180
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
SDL_PowerState = enum :SDL_POWERSTATE_ERROR, -1,
|
|
6
|
+
:SDL_POWERSTATE_UNKNOWN, 0,
|
|
7
|
+
:SDL_POWERSTATE_ON_BATTERY, 1,
|
|
8
|
+
:SDL_POWERSTATE_NO_BATTERY, 2,
|
|
9
|
+
:SDL_POWERSTATE_CHARGING, 3,
|
|
10
|
+
:SDL_POWERSTATE_CHARGED, 4
|
|
11
|
+
|
|
12
|
+
attach_function :SDL_GetPowerInfo, %i[pointer pointer], SDL_PowerState
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
attach_function :SDL_CreateProcess, %i[pointer bool], :pointer
|
|
6
|
+
attach_function :SDL_CreateProcessWithProperties, [:SDL_PropertiesID], :pointer
|
|
7
|
+
attach_function :SDL_GetProcessProperties, [:pointer], :SDL_PropertiesID
|
|
8
|
+
attach_function :SDL_ReadProcess, %i[pointer pointer pointer], :pointer
|
|
9
|
+
attach_function :SDL_GetProcessInput, [:pointer], :pointer
|
|
10
|
+
attach_function :SDL_GetProcessOutput, [:pointer], :pointer
|
|
11
|
+
attach_function :SDL_KillProcess, %i[pointer bool], :bool
|
|
12
|
+
attach_function :SDL_WaitProcess, %i[pointer bool pointer], :bool
|
|
13
|
+
attach_function :SDL_DestroyProcess, [:pointer], :void
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
SDL_PropertyType = enum :SDL_PROPERTY_TYPE_INVALID, 0,
|
|
6
|
+
:SDL_PROPERTY_TYPE_POINTER, 1,
|
|
7
|
+
:SDL_PROPERTY_TYPE_STRING, 2,
|
|
8
|
+
:SDL_PROPERTY_TYPE_NUMBER, 3,
|
|
9
|
+
:SDL_PROPERTY_TYPE_FLOAT, 4,
|
|
10
|
+
:SDL_PROPERTY_TYPE_BOOLEAN, 5
|
|
11
|
+
|
|
12
|
+
callback :SDL_CleanupPropertyCallback, %i[pointer pointer], :void
|
|
13
|
+
callback :SDL_EnumeratePropertiesCallback, %i[pointer SDL_PropertiesID string], :void
|
|
14
|
+
|
|
15
|
+
attach_function :SDL_GetGlobalProperties, [], :SDL_PropertiesID
|
|
16
|
+
attach_function :SDL_CreateProperties, [], :SDL_PropertiesID
|
|
17
|
+
attach_function :SDL_CopyProperties, %i[SDL_PropertiesID SDL_PropertiesID], :bool
|
|
18
|
+
attach_function :SDL_LockProperties, [:SDL_PropertiesID], :bool
|
|
19
|
+
attach_function :SDL_UnlockProperties, [:SDL_PropertiesID], :void
|
|
20
|
+
attach_function :SDL_SetPointerPropertyWithCleanup,
|
|
21
|
+
[:SDL_PropertiesID, :string, :pointer, :SDL_CleanupPropertyCallback, :pointer], :bool
|
|
22
|
+
attach_function :SDL_SetPointerProperty, %i[SDL_PropertiesID string pointer], :bool
|
|
23
|
+
attach_function :SDL_SetStringProperty, %i[SDL_PropertiesID string string], :bool
|
|
24
|
+
attach_function :SDL_SetNumberProperty, %i[SDL_PropertiesID string int64], :bool
|
|
25
|
+
attach_function :SDL_SetFloatProperty, %i[SDL_PropertiesID string float], :bool
|
|
26
|
+
attach_function :SDL_SetBooleanProperty, %i[SDL_PropertiesID string bool], :bool
|
|
27
|
+
attach_function :SDL_HasProperty, %i[SDL_PropertiesID string], :bool
|
|
28
|
+
attach_function :SDL_GetPropertyType, %i[SDL_PropertiesID string], SDL_PropertyType
|
|
29
|
+
attach_function :SDL_GetPointerProperty, %i[SDL_PropertiesID string pointer], :pointer
|
|
30
|
+
attach_function :SDL_GetStringProperty, %i[SDL_PropertiesID string string], :string
|
|
31
|
+
attach_function :SDL_GetNumberProperty, %i[SDL_PropertiesID string int64], :int64
|
|
32
|
+
attach_function :SDL_GetFloatProperty, %i[SDL_PropertiesID string float], :float
|
|
33
|
+
attach_function :SDL_GetBooleanProperty, %i[SDL_PropertiesID string bool], :bool
|
|
34
|
+
attach_function :SDL_ClearProperty, %i[SDL_PropertiesID string], :bool
|
|
35
|
+
attach_function :SDL_EnumerateProperties,
|
|
36
|
+
[:SDL_PropertiesID, :SDL_EnumeratePropertiesCallback, :pointer], :bool
|
|
37
|
+
attach_function :SDL_DestroyProperties, [:SDL_PropertiesID], :void
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SDL3
|
|
4
|
+
module Raw
|
|
5
|
+
class SDL_Point < FFI::Struct
|
|
6
|
+
layout :x, :int,
|
|
7
|
+
:y, :int
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class SDL_FPoint < FFI::Struct
|
|
11
|
+
layout :x, :float,
|
|
12
|
+
:y, :float
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class SDL_Rect < FFI::Struct
|
|
16
|
+
layout :x, :int,
|
|
17
|
+
:y, :int,
|
|
18
|
+
:w, :int,
|
|
19
|
+
:h, :int
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class SDL_FRect < FFI::Struct
|
|
23
|
+
layout :x, :float,
|
|
24
|
+
:y, :float,
|
|
25
|
+
:w, :float,
|
|
26
|
+
:h, :float
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
attach_function :SDL_HasRectIntersection, [SDL_Rect.ptr, SDL_Rect.ptr], :bool
|
|
30
|
+
attach_function :SDL_GetRectIntersection, [SDL_Rect.ptr, SDL_Rect.ptr, SDL_Rect.ptr], :bool
|
|
31
|
+
attach_function :SDL_GetRectUnion, [SDL_Rect.ptr, SDL_Rect.ptr, SDL_Rect.ptr], :bool
|
|
32
|
+
attach_function :SDL_GetRectEnclosingPoints, [SDL_Point.ptr, :int, SDL_Rect.ptr, SDL_Rect.ptr], :bool
|
|
33
|
+
attach_function :SDL_GetRectAndLineIntersection, [SDL_Rect.ptr, :pointer, :pointer, :pointer, :pointer], :bool
|
|
34
|
+
|
|
35
|
+
attach_function :SDL_HasRectIntersectionFloat, [SDL_FRect.ptr, SDL_FRect.ptr], :bool
|
|
36
|
+
attach_function :SDL_GetRectIntersectionFloat, [SDL_FRect.ptr, SDL_FRect.ptr, SDL_FRect.ptr], :bool
|
|
37
|
+
attach_function :SDL_GetRectUnionFloat, [SDL_FRect.ptr, SDL_FRect.ptr, SDL_FRect.ptr], :bool
|
|
38
|
+
attach_function :SDL_GetRectEnclosingPointsFloat, [SDL_FPoint.ptr, :int, SDL_FRect.ptr, SDL_FRect.ptr], :bool
|
|
39
|
+
attach_function :SDL_GetRectAndLineIntersectionFloat, [SDL_FRect.ptr, :pointer, :pointer, :pointer, :pointer], :bool
|
|
40
|
+
end
|
|
41
|
+
end
|