sdl3-bindings 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog +159 -0
- data/LICENSE.txt +21 -0
- data/README.md +132 -0
- data/lib/sdl3.rb +150 -0
- data/lib/sdl3_assert.rb +61 -0
- data/lib/sdl3_asyncio.rb +68 -0
- data/lib/sdl3_atomic.rb +64 -0
- data/lib/sdl3_audio.rb +120 -0
- data/lib/sdl3_bits.rb +38 -0
- data/lib/sdl3_blendmode.rb +63 -0
- data/lib/sdl3_camera.rb +67 -0
- data/lib/sdl3_clipboard.rb +49 -0
- data/lib/sdl3_cpuinfo.rb +55 -0
- data/lib/sdl3_dialog.rb +60 -0
- data/lib/sdl3_endian.rb +39 -0
- data/lib/sdl3_error.rb +41 -0
- data/lib/sdl3_events.rb +680 -0
- data/lib/sdl3_filesystem.rb +82 -0
- data/lib/sdl3_gamepad.rb +216 -0
- data/lib/sdl3_gpu.rb +836 -0
- data/lib/sdl3_guid.rb +44 -0
- data/lib/sdl3_haptic.rb +209 -0
- data/lib/sdl3_hidapi.rb +84 -0
- data/lib/sdl3_hints.rb +285 -0
- data/lib/sdl3_image.rb +108 -0
- data/lib/sdl3_init.rb +71 -0
- data/lib/sdl3_iostream.rb +115 -0
- data/lib/sdl3_joystick.rb +174 -0
- data/lib/sdl3_keyboard.rb +81 -0
- data/lib/sdl3_keycode.rb +310 -0
- data/lib/sdl3_loadso.rb +39 -0
- data/lib/sdl3_locale.rb +44 -0
- data/lib/sdl3_log.rb +85 -0
- data/lib/sdl3_messagebox.rb +88 -0
- data/lib/sdl3_misc.rb +37 -0
- data/lib/sdl3_mixer.rb +179 -0
- data/lib/sdl3_mouse.rb +90 -0
- data/lib/sdl3_mutex.rb +77 -0
- data/lib/sdl3_pen.rb +56 -0
- data/lib/sdl3_pixels.rb +296 -0
- data/lib/sdl3_platform.rb +37 -0
- data/lib/sdl3_power.rb +44 -0
- data/lib/sdl3_process.rb +65 -0
- data/lib/sdl3_properties.rb +67 -0
- data/lib/sdl3_rect.rb +98 -0
- data/lib/sdl3_render.rb +240 -0
- data/lib/sdl3_revision.rb +37 -0
- data/lib/sdl3_scancode.rb +286 -0
- data/lib/sdl3_sensor.rb +61 -0
- data/lib/sdl3_sound.rb +98 -0
- data/lib/sdl3_stdinc.rb +229 -0
- data/lib/sdl3_storage.rb +70 -0
- data/lib/sdl3_surface.rb +122 -0
- data/lib/sdl3_thread.rb +65 -0
- data/lib/sdl3_time.rb +66 -0
- data/lib/sdl3_timer.rb +54 -0
- data/lib/sdl3_touch.rb +56 -0
- data/lib/sdl3_tray.rb +66 -0
- data/lib/sdl3_ttf.rb +216 -0
- data/lib/sdl3_version.rb +41 -0
- data/lib/sdl3_video.rb +341 -0
- data/lib/sdl3_vulkan.rb +46 -0
- metadata +118 -0
data/lib/sdl3_storage.rb
ADDED
@@ -0,0 +1,70 @@
|
|
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
|
+
class StorageInterface < FFI::Struct
|
23
|
+
layout(
|
24
|
+
:version, :uint,
|
25
|
+
:close, :pointer,
|
26
|
+
:ready, :pointer,
|
27
|
+
:enumerate, :pointer,
|
28
|
+
:info, :pointer,
|
29
|
+
:read_file, :pointer,
|
30
|
+
:write_file, :pointer,
|
31
|
+
:mkdir, :pointer,
|
32
|
+
:remove, :pointer,
|
33
|
+
:rename, :pointer,
|
34
|
+
:copy, :pointer,
|
35
|
+
:space_remaining, :pointer,
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
# Function
|
41
|
+
|
42
|
+
def self.setup_storage_symbols(output_error = false)
|
43
|
+
entries = [
|
44
|
+
[:OpenTitleStorage, :SDL_OpenTitleStorage, [:pointer, :uint], :pointer],
|
45
|
+
[:OpenUserStorage, :SDL_OpenUserStorage, [:pointer, :pointer, :uint], :pointer],
|
46
|
+
[:OpenFileStorage, :SDL_OpenFileStorage, [:pointer], :pointer],
|
47
|
+
[:OpenStorage, :SDL_OpenStorage, [:pointer, :pointer], :pointer],
|
48
|
+
[:CloseStorage, :SDL_CloseStorage, [:pointer], :bool],
|
49
|
+
[:StorageReady, :SDL_StorageReady, [:pointer], :bool],
|
50
|
+
[:GetStorageFileSize, :SDL_GetStorageFileSize, [:pointer, :pointer, :pointer], :bool],
|
51
|
+
[:ReadStorageFile, :SDL_ReadStorageFile, [:pointer, :pointer, :pointer, :ulong_long], :bool],
|
52
|
+
[:WriteStorageFile, :SDL_WriteStorageFile, [:pointer, :pointer, :pointer, :ulong_long], :bool],
|
53
|
+
[:CreateStorageDirectory, :SDL_CreateStorageDirectory, [:pointer, :pointer], :bool],
|
54
|
+
[:EnumerateStorageDirectory, :SDL_EnumerateStorageDirectory, [:pointer, :pointer, :SDL_EnumerateDirectoryCallback, :pointer], :bool],
|
55
|
+
[:RemoveStoragePath, :SDL_RemoveStoragePath, [:pointer, :pointer], :bool],
|
56
|
+
[:RenameStoragePath, :SDL_RenameStoragePath, [:pointer, :pointer, :pointer], :bool],
|
57
|
+
[:CopyStorageFile, :SDL_CopyStorageFile, [:pointer, :pointer, :pointer], :bool],
|
58
|
+
[:GetStoragePathInfo, :SDL_GetStoragePathInfo, [:pointer, :pointer, :pointer], :bool],
|
59
|
+
[:GetStorageSpaceRemaining, :SDL_GetStorageSpaceRemaining, [:pointer], :ulong_long],
|
60
|
+
[:GlobStorageDirectory, :SDL_GlobStorageDirectory, [:pointer, :pointer, :pointer, :uint, :pointer], :pointer],
|
61
|
+
]
|
62
|
+
entries.each do |entry|
|
63
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
64
|
+
rescue FFI::NotFoundError => e
|
65
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
data/lib/sdl3_surface.rb
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
# Ruby-SDL3 : SDL3 wrapper for Ruby
|
2
|
+
#
|
3
|
+
# * https://github.com/vaiorabbit/sdl3-bindings
|
4
|
+
#
|
5
|
+
# [NOTICE] Autogenerated. Do not edit.
|
6
|
+
|
7
|
+
require 'ffi'
|
8
|
+
require_relative 'sdl3_rect'
|
9
|
+
|
10
|
+
module SDL
|
11
|
+
extend FFI::Library
|
12
|
+
# Define/Macro
|
13
|
+
|
14
|
+
SURFACE_PREALLOCATED = 0x00000001
|
15
|
+
SURFACE_LOCK_NEEDED = 0x00000002
|
16
|
+
SURFACE_LOCKED = 0x00000004
|
17
|
+
SURFACE_SIMD_ALIGNED = 0x00000008
|
18
|
+
PROP_SURFACE_SDR_WHITE_POINT_FLOAT = "SDL.surface.SDR_white_point"
|
19
|
+
PROP_SURFACE_HDR_HEADROOM_FLOAT = "SDL.surface.HDR_headroom"
|
20
|
+
PROP_SURFACE_TONEMAP_OPERATOR_STRING = "SDL.surface.tonemap"
|
21
|
+
|
22
|
+
# Enum
|
23
|
+
|
24
|
+
SCALEMODE_NEAREST = 0
|
25
|
+
SCALEMODE_LINEAR = 1
|
26
|
+
FLIP_NONE = 0
|
27
|
+
FLIP_HORIZONTAL = 1
|
28
|
+
FLIP_VERTICAL = 2
|
29
|
+
|
30
|
+
# Typedef
|
31
|
+
|
32
|
+
typedef :uint, :SDL_SurfaceFlags
|
33
|
+
typedef :int, :SDL_ScaleMode
|
34
|
+
typedef :int, :SDL_FlipMode
|
35
|
+
|
36
|
+
# Struct
|
37
|
+
|
38
|
+
class Surface < FFI::Struct
|
39
|
+
layout(
|
40
|
+
:flags, :uint,
|
41
|
+
:format, :int,
|
42
|
+
:w, :int,
|
43
|
+
:h, :int,
|
44
|
+
:pitch, :int,
|
45
|
+
:pixels, :pointer,
|
46
|
+
:refcount, :int,
|
47
|
+
:reserved, :pointer,
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
# Function
|
53
|
+
|
54
|
+
def self.setup_surface_symbols(output_error = false)
|
55
|
+
entries = [
|
56
|
+
[:CreateSurface, :SDL_CreateSurface, [:int, :int, :int], :pointer],
|
57
|
+
[:CreateSurfaceFrom, :SDL_CreateSurfaceFrom, [:int, :int, :int, :pointer, :int], :pointer],
|
58
|
+
[:DestroySurface, :SDL_DestroySurface, [:pointer], :void],
|
59
|
+
[:GetSurfaceProperties, :SDL_GetSurfaceProperties, [:pointer], :uint],
|
60
|
+
[:SetSurfaceColorspace, :SDL_SetSurfaceColorspace, [:pointer, :int], :bool],
|
61
|
+
[:GetSurfaceColorspace, :SDL_GetSurfaceColorspace, [:pointer], :int],
|
62
|
+
[:CreateSurfacePalette, :SDL_CreateSurfacePalette, [:pointer], :pointer],
|
63
|
+
[:SetSurfacePalette, :SDL_SetSurfacePalette, [:pointer, :pointer], :bool],
|
64
|
+
[:GetSurfacePalette, :SDL_GetSurfacePalette, [:pointer], :pointer],
|
65
|
+
[:AddSurfaceAlternateImage, :SDL_AddSurfaceAlternateImage, [:pointer, :pointer], :bool],
|
66
|
+
[:SurfaceHasAlternateImages, :SDL_SurfaceHasAlternateImages, [:pointer], :bool],
|
67
|
+
[:GetSurfaceImages, :SDL_GetSurfaceImages, [:pointer, :pointer], :pointer],
|
68
|
+
[:RemoveSurfaceAlternateImages, :SDL_RemoveSurfaceAlternateImages, [:pointer], :void],
|
69
|
+
[:LockSurface, :SDL_LockSurface, [:pointer], :bool],
|
70
|
+
[:UnlockSurface, :SDL_UnlockSurface, [:pointer], :void],
|
71
|
+
[:LoadBMP_IO, :SDL_LoadBMP_IO, [:pointer, :bool], :pointer],
|
72
|
+
[:LoadBMP, :SDL_LoadBMP, [:pointer], :pointer],
|
73
|
+
[:SaveBMP_IO, :SDL_SaveBMP_IO, [:pointer, :pointer, :bool], :bool],
|
74
|
+
[:SaveBMP, :SDL_SaveBMP, [:pointer, :pointer], :bool],
|
75
|
+
[:SetSurfaceRLE, :SDL_SetSurfaceRLE, [:pointer, :bool], :bool],
|
76
|
+
[:SurfaceHasRLE, :SDL_SurfaceHasRLE, [:pointer], :bool],
|
77
|
+
[:SetSurfaceColorKey, :SDL_SetSurfaceColorKey, [:pointer, :bool, :uint], :bool],
|
78
|
+
[:SurfaceHasColorKey, :SDL_SurfaceHasColorKey, [:pointer], :bool],
|
79
|
+
[:GetSurfaceColorKey, :SDL_GetSurfaceColorKey, [:pointer, :pointer], :bool],
|
80
|
+
[:SetSurfaceColorMod, :SDL_SetSurfaceColorMod, [:pointer, :uchar, :uchar, :uchar], :bool],
|
81
|
+
[:GetSurfaceColorMod, :SDL_GetSurfaceColorMod, [:pointer, :pointer, :pointer, :pointer], :bool],
|
82
|
+
[:SetSurfaceAlphaMod, :SDL_SetSurfaceAlphaMod, [:pointer, :uchar], :bool],
|
83
|
+
[:GetSurfaceAlphaMod, :SDL_GetSurfaceAlphaMod, [:pointer, :pointer], :bool],
|
84
|
+
[:SetSurfaceBlendMode, :SDL_SetSurfaceBlendMode, [:pointer, :uint], :bool],
|
85
|
+
[:GetSurfaceBlendMode, :SDL_GetSurfaceBlendMode, [:pointer, :pointer], :bool],
|
86
|
+
[:SetSurfaceClipRect, :SDL_SetSurfaceClipRect, [:pointer, :pointer], :bool],
|
87
|
+
[:GetSurfaceClipRect, :SDL_GetSurfaceClipRect, [:pointer, :pointer], :bool],
|
88
|
+
[:FlipSurface, :SDL_FlipSurface, [:pointer, :int], :bool],
|
89
|
+
[:DuplicateSurface, :SDL_DuplicateSurface, [:pointer], :pointer],
|
90
|
+
[:ScaleSurface, :SDL_ScaleSurface, [:pointer, :int, :int, :int], :pointer],
|
91
|
+
[:ConvertSurface, :SDL_ConvertSurface, [:pointer, :int], :pointer],
|
92
|
+
[:ConvertSurfaceAndColorspace, :SDL_ConvertSurfaceAndColorspace, [:pointer, :int, :pointer, :int, :uint], :pointer],
|
93
|
+
[:ConvertPixels, :SDL_ConvertPixels, [:int, :int, :int, :pointer, :int, :int, :pointer, :int], :bool],
|
94
|
+
[:ConvertPixelsAndColorspace, :SDL_ConvertPixelsAndColorspace, [:int, :int, :int, :int, :uint, :pointer, :int, :int, :int, :uint, :pointer, :int], :bool],
|
95
|
+
[:PremultiplyAlpha, :SDL_PremultiplyAlpha, [:int, :int, :int, :pointer, :int, :int, :pointer, :int, :bool], :bool],
|
96
|
+
[:PremultiplySurfaceAlpha, :SDL_PremultiplySurfaceAlpha, [:pointer, :bool], :bool],
|
97
|
+
[:ClearSurface, :SDL_ClearSurface, [:pointer, :float, :float, :float, :float], :bool],
|
98
|
+
[:FillSurfaceRect, :SDL_FillSurfaceRect, [:pointer, :pointer, :uint], :bool],
|
99
|
+
[:FillSurfaceRects, :SDL_FillSurfaceRects, [:pointer, :pointer, :int, :uint], :bool],
|
100
|
+
[:BlitSurface, :SDL_BlitSurface, [:pointer, :pointer, :pointer, :pointer], :bool],
|
101
|
+
[:BlitSurfaceUnchecked, :SDL_BlitSurfaceUnchecked, [:pointer, :pointer, :pointer, :pointer], :bool],
|
102
|
+
[:BlitSurfaceScaled, :SDL_BlitSurfaceScaled, [:pointer, :pointer, :pointer, :pointer, :int], :bool],
|
103
|
+
[:BlitSurfaceUncheckedScaled, :SDL_BlitSurfaceUncheckedScaled, [:pointer, :pointer, :pointer, :pointer, :int], :bool],
|
104
|
+
[:BlitSurfaceTiled, :SDL_BlitSurfaceTiled, [:pointer, :pointer, :pointer, :pointer], :bool],
|
105
|
+
[:BlitSurfaceTiledWithScale, :SDL_BlitSurfaceTiledWithScale, [:pointer, :pointer, :float, :int, :pointer, :pointer], :bool],
|
106
|
+
[:BlitSurface9Grid, :SDL_BlitSurface9Grid, [:pointer, :pointer, :int, :int, :int, :int, :float, :int, :pointer, :pointer], :bool],
|
107
|
+
[:MapSurfaceRGB, :SDL_MapSurfaceRGB, [:pointer, :uchar, :uchar, :uchar], :uint],
|
108
|
+
[:MapSurfaceRGBA, :SDL_MapSurfaceRGBA, [:pointer, :uchar, :uchar, :uchar, :uchar], :uint],
|
109
|
+
[:ReadSurfacePixel, :SDL_ReadSurfacePixel, [:pointer, :int, :int, :pointer, :pointer, :pointer, :pointer], :bool],
|
110
|
+
[:ReadSurfacePixelFloat, :SDL_ReadSurfacePixelFloat, [:pointer, :int, :int, :pointer, :pointer, :pointer, :pointer], :bool],
|
111
|
+
[:WriteSurfacePixel, :SDL_WriteSurfacePixel, [:pointer, :int, :int, :uchar, :uchar, :uchar, :uchar], :bool],
|
112
|
+
[:WriteSurfacePixelFloat, :SDL_WriteSurfacePixelFloat, [:pointer, :int, :int, :float, :float, :float, :float], :bool],
|
113
|
+
]
|
114
|
+
entries.each do |entry|
|
115
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
116
|
+
rescue FFI::NotFoundError => e
|
117
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
data/lib/sdl3_thread.rb
ADDED
@@ -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_THREAD_CREATE_ENTRY_FUNCTION_POINTER = "SDL.thread.create.entry_function"
|
14
|
+
PROP_THREAD_CREATE_NAME_STRING = "SDL.thread.create.name"
|
15
|
+
PROP_THREAD_CREATE_USERDATA_POINTER = "SDL.thread.create.userdata"
|
16
|
+
PROP_THREAD_CREATE_STACKSIZE_NUMBER = "SDL.thread.create.stacksize"
|
17
|
+
|
18
|
+
# Enum
|
19
|
+
|
20
|
+
THREAD_PRIORITY_LOW = 0
|
21
|
+
THREAD_PRIORITY_NORMAL = 1
|
22
|
+
THREAD_PRIORITY_HIGH = 2
|
23
|
+
THREAD_PRIORITY_TIME_CRITICAL = 3
|
24
|
+
THREAD_UNKNOWN = 0
|
25
|
+
THREAD_ALIVE = 1
|
26
|
+
THREAD_DETACHED = 2
|
27
|
+
THREAD_COMPLETE = 3
|
28
|
+
|
29
|
+
# Typedef
|
30
|
+
|
31
|
+
typedef :ulong_long, :SDL_ThreadID
|
32
|
+
typedef :int, :SDL_ThreadPriority
|
33
|
+
typedef :int, :SDL_ThreadState
|
34
|
+
callback :SDL_ThreadFunction, [:pointer], :int
|
35
|
+
callback :SDL_TLSDestructorCallback, [:pointer], :void
|
36
|
+
|
37
|
+
# Struct
|
38
|
+
|
39
|
+
|
40
|
+
# Function
|
41
|
+
|
42
|
+
def self.setup_thread_symbols(output_error = false)
|
43
|
+
entries = [
|
44
|
+
[:CreateThreadRuntime, :SDL_CreateThreadRuntime, [:SDL_ThreadFunction, :pointer, :pointer, :SDL_FunctionPointer, :SDL_FunctionPointer], :pointer],
|
45
|
+
[:CreateThreadWithPropertiesRuntime, :SDL_CreateThreadWithPropertiesRuntime, [:uint, :SDL_FunctionPointer, :SDL_FunctionPointer], :pointer],
|
46
|
+
[:GetThreadName, :SDL_GetThreadName, [:pointer], :pointer],
|
47
|
+
[:GetCurrentThreadID, :SDL_GetCurrentThreadID, [], :ulong_long],
|
48
|
+
[:GetThreadID, :SDL_GetThreadID, [:pointer], :ulong_long],
|
49
|
+
[:SetCurrentThreadPriority, :SDL_SetCurrentThreadPriority, [:int], :bool],
|
50
|
+
[:WaitThread, :SDL_WaitThread, [:pointer, :pointer], :void],
|
51
|
+
[:GetThreadState, :SDL_GetThreadState, [:pointer], :int],
|
52
|
+
[:DetachThread, :SDL_DetachThread, [:pointer], :void],
|
53
|
+
[:GetTLS, :SDL_GetTLS, [:pointer], :pointer],
|
54
|
+
[:SetTLS, :SDL_SetTLS, [:pointer, :pointer, :SDL_TLSDestructorCallback], :bool],
|
55
|
+
[:CleanupTLS, :SDL_CleanupTLS, [], :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
|
+
|
data/lib/sdl3_time.rb
ADDED
@@ -0,0 +1,66 @@
|
|
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
|
+
DATE_FORMAT_YYYYMMDD = 0
|
17
|
+
DATE_FORMAT_DDMMYYYY = 1
|
18
|
+
DATE_FORMAT_MMDDYYYY = 2
|
19
|
+
TIME_FORMAT_24HR = 0
|
20
|
+
TIME_FORMAT_12HR = 1
|
21
|
+
|
22
|
+
# Typedef
|
23
|
+
|
24
|
+
typedef :int, :SDL_DateFormat
|
25
|
+
typedef :int, :SDL_TimeFormat
|
26
|
+
|
27
|
+
# Struct
|
28
|
+
|
29
|
+
class DateTime < FFI::Struct
|
30
|
+
layout(
|
31
|
+
:year, :int,
|
32
|
+
:month, :int,
|
33
|
+
:day, :int,
|
34
|
+
:hour, :int,
|
35
|
+
:minute, :int,
|
36
|
+
:second, :int,
|
37
|
+
:nanosecond, :int,
|
38
|
+
:day_of_week, :int,
|
39
|
+
:utc_offset, :int,
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
# Function
|
45
|
+
|
46
|
+
def self.setup_time_symbols(output_error = false)
|
47
|
+
entries = [
|
48
|
+
[:GetDateTimeLocalePreferences, :SDL_GetDateTimeLocalePreferences, [:pointer, :pointer], :bool],
|
49
|
+
[:GetCurrentTime, :SDL_GetCurrentTime, [:pointer], :bool],
|
50
|
+
[:TimeToDateTime, :SDL_TimeToDateTime, [:long_long, :pointer, :bool], :bool],
|
51
|
+
[:DateTimeToTime, :SDL_DateTimeToTime, [:pointer, :pointer], :bool],
|
52
|
+
[:TimeToWindows, :SDL_TimeToWindows, [:long_long, :pointer, :pointer], :void],
|
53
|
+
[:TimeFromWindows, :SDL_TimeFromWindows, [:uint, :uint], :long_long],
|
54
|
+
[:GetDaysInMonth, :SDL_GetDaysInMonth, [:int, :int], :int],
|
55
|
+
[:GetDayOfYear, :SDL_GetDayOfYear, [:int, :int, :int], :int],
|
56
|
+
[:GetDayOfWeek, :SDL_GetDayOfWeek, [:int, :int, :int], :int],
|
57
|
+
]
|
58
|
+
entries.each do |entry|
|
59
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
60
|
+
rescue FFI::NotFoundError => e
|
61
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
data/lib/sdl3_timer.rb
ADDED
@@ -0,0 +1,54 @@
|
|
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
|
+
MS_PER_SECOND = 1000
|
14
|
+
US_PER_SECOND = 1000000
|
15
|
+
NS_PER_SECOND = 1000000000
|
16
|
+
NS_PER_MS = 1000000
|
17
|
+
NS_PER_US = 1000
|
18
|
+
|
19
|
+
# Enum
|
20
|
+
|
21
|
+
|
22
|
+
# Typedef
|
23
|
+
|
24
|
+
typedef :uint, :SDL_TimerID
|
25
|
+
callback :SDL_TimerCallback, [:pointer, :uint, :uint], :uint
|
26
|
+
callback :SDL_NSTimerCallback, [:pointer, :uint, :ulong_long], :ulong_long
|
27
|
+
|
28
|
+
# Struct
|
29
|
+
|
30
|
+
|
31
|
+
# Function
|
32
|
+
|
33
|
+
def self.setup_timer_symbols(output_error = false)
|
34
|
+
entries = [
|
35
|
+
[:GetTicks, :SDL_GetTicks, [], :ulong_long],
|
36
|
+
[:GetTicksNS, :SDL_GetTicksNS, [], :ulong_long],
|
37
|
+
[:GetPerformanceCounter, :SDL_GetPerformanceCounter, [], :ulong_long],
|
38
|
+
[:GetPerformanceFrequency, :SDL_GetPerformanceFrequency, [], :ulong_long],
|
39
|
+
[:Delay, :SDL_Delay, [:uint], :void],
|
40
|
+
[:DelayNS, :SDL_DelayNS, [:ulong_long], :void],
|
41
|
+
[:DelayPrecise, :SDL_DelayPrecise, [:ulong_long], :void],
|
42
|
+
[:AddTimer, :SDL_AddTimer, [:uint, :SDL_TimerCallback, :pointer], :uint],
|
43
|
+
[:AddTimerNS, :SDL_AddTimerNS, [:ulong_long, :SDL_NSTimerCallback, :pointer], :uint],
|
44
|
+
[:RemoveTimer, :SDL_RemoveTimer, [:uint], :bool],
|
45
|
+
]
|
46
|
+
entries.each do |entry|
|
47
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
48
|
+
rescue FFI::NotFoundError => e
|
49
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
data/lib/sdl3_touch.rb
ADDED
@@ -0,0 +1,56 @@
|
|
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
|
+
TOUCH_DEVICE_INVALID = -1
|
17
|
+
TOUCH_DEVICE_DIRECT = 0
|
18
|
+
TOUCH_DEVICE_INDIRECT_ABSOLUTE = 1
|
19
|
+
TOUCH_DEVICE_INDIRECT_RELATIVE = 2
|
20
|
+
|
21
|
+
# Typedef
|
22
|
+
|
23
|
+
typedef :ulong_long, :SDL_TouchID
|
24
|
+
typedef :ulong_long, :SDL_FingerID
|
25
|
+
typedef :int, :SDL_TouchDeviceType
|
26
|
+
|
27
|
+
# Struct
|
28
|
+
|
29
|
+
class Finger < FFI::Struct
|
30
|
+
layout(
|
31
|
+
:id, :ulong_long,
|
32
|
+
:x, :float,
|
33
|
+
:y, :float,
|
34
|
+
:pressure, :float,
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
# Function
|
40
|
+
|
41
|
+
def self.setup_touch_symbols(output_error = false)
|
42
|
+
entries = [
|
43
|
+
[:GetTouchDevices, :SDL_GetTouchDevices, [:pointer], :pointer],
|
44
|
+
[:GetTouchDeviceName, :SDL_GetTouchDeviceName, [:ulong_long], :pointer],
|
45
|
+
[:GetTouchDeviceType, :SDL_GetTouchDeviceType, [:ulong_long], :int],
|
46
|
+
[:GetTouchFingers, :SDL_GetTouchFingers, [:ulong_long, :pointer], :pointer],
|
47
|
+
]
|
48
|
+
entries.each do |entry|
|
49
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
50
|
+
rescue FFI::NotFoundError => e
|
51
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
data/lib/sdl3_tray.rb
ADDED
@@ -0,0 +1,66 @@
|
|
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
|
+
TRAYENTRY_BUTTON = 0x00000001
|
14
|
+
TRAYENTRY_CHECKBOX = 0x00000002
|
15
|
+
TRAYENTRY_SUBMENU = 0x00000004
|
16
|
+
TRAYENTRY_DISABLED = 0x80000000
|
17
|
+
TRAYENTRY_CHECKED = 0x40000000
|
18
|
+
|
19
|
+
# Enum
|
20
|
+
|
21
|
+
|
22
|
+
# Typedef
|
23
|
+
|
24
|
+
typedef :uint, :SDL_TrayEntryFlags
|
25
|
+
callback :SDL_TrayCallback, [:pointer, :pointer], :void
|
26
|
+
|
27
|
+
# Struct
|
28
|
+
|
29
|
+
|
30
|
+
# Function
|
31
|
+
|
32
|
+
def self.setup_tray_symbols(output_error = false)
|
33
|
+
entries = [
|
34
|
+
[:CreateTray, :SDL_CreateTray, [:pointer, :pointer], :pointer],
|
35
|
+
[:SetTrayIcon, :SDL_SetTrayIcon, [:pointer, :pointer], :void],
|
36
|
+
[:SetTrayTooltip, :SDL_SetTrayTooltip, [:pointer, :pointer], :void],
|
37
|
+
[:CreateTrayMenu, :SDL_CreateTrayMenu, [:pointer], :pointer],
|
38
|
+
[:CreateTraySubmenu, :SDL_CreateTraySubmenu, [:pointer], :pointer],
|
39
|
+
[:GetTrayMenu, :SDL_GetTrayMenu, [:pointer], :pointer],
|
40
|
+
[:GetTraySubmenu, :SDL_GetTraySubmenu, [:pointer], :pointer],
|
41
|
+
[:GetTrayEntries, :SDL_GetTrayEntries, [:pointer, :pointer], :pointer],
|
42
|
+
[:RemoveTrayEntry, :SDL_RemoveTrayEntry, [:pointer], :void],
|
43
|
+
[:InsertTrayEntryAt, :SDL_InsertTrayEntryAt, [:pointer, :int, :pointer, :uint], :pointer],
|
44
|
+
[:SetTrayEntryLabel, :SDL_SetTrayEntryLabel, [:pointer, :pointer], :void],
|
45
|
+
[:GetTrayEntryLabel, :SDL_GetTrayEntryLabel, [:pointer], :pointer],
|
46
|
+
[:SetTrayEntryChecked, :SDL_SetTrayEntryChecked, [:pointer, :bool], :void],
|
47
|
+
[:GetTrayEntryChecked, :SDL_GetTrayEntryChecked, [:pointer], :bool],
|
48
|
+
[:SetTrayEntryEnabled, :SDL_SetTrayEntryEnabled, [:pointer, :bool], :void],
|
49
|
+
[:GetTrayEntryEnabled, :SDL_GetTrayEntryEnabled, [:pointer], :bool],
|
50
|
+
[:SetTrayEntryCallback, :SDL_SetTrayEntryCallback, [:pointer, :SDL_TrayCallback, :pointer], :void],
|
51
|
+
[:ClickTrayEntry, :SDL_ClickTrayEntry, [:pointer], :void],
|
52
|
+
[:DestroyTray, :SDL_DestroyTray, [:pointer], :void],
|
53
|
+
[:GetTrayEntryParent, :SDL_GetTrayEntryParent, [:pointer], :pointer],
|
54
|
+
[:GetTrayMenuParentEntry, :SDL_GetTrayMenuParentEntry, [:pointer], :pointer],
|
55
|
+
[:GetTrayMenuParentTray, :SDL_GetTrayMenuParentTray, [:pointer], :pointer],
|
56
|
+
[:UpdateTrays, :SDL_UpdateTrays, [], :void],
|
57
|
+
]
|
58
|
+
entries.each do |entry|
|
59
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
60
|
+
rescue FFI::NotFoundError => e
|
61
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|