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_image.rb
ADDED
@@ -0,0 +1,108 @@
|
|
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
|
+
IMAGE_MAJOR_VERSION = 3
|
14
|
+
IMAGE_MINOR_VERSION = 1
|
15
|
+
IMAGE_MICRO_VERSION = 1
|
16
|
+
|
17
|
+
# Enum
|
18
|
+
|
19
|
+
|
20
|
+
# Typedef
|
21
|
+
|
22
|
+
|
23
|
+
# Struct
|
24
|
+
|
25
|
+
class IMG_Animation < FFI::Struct
|
26
|
+
layout(
|
27
|
+
:w, :int,
|
28
|
+
:h, :int,
|
29
|
+
:count, :int,
|
30
|
+
:frames, :pointer,
|
31
|
+
:delays, :pointer,
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# Function
|
37
|
+
|
38
|
+
def self.setup_image_symbols(output_error = false)
|
39
|
+
entries = [
|
40
|
+
[:IMG_Version, :IMG_Version, [], :int],
|
41
|
+
[:IMG_LoadTyped_IO, :IMG_LoadTyped_IO, [:pointer, :bool, :pointer], :pointer],
|
42
|
+
[:IMG_Load, :IMG_Load, [:pointer], :pointer],
|
43
|
+
[:IMG_Load_IO, :IMG_Load_IO, [:pointer, :bool], :pointer],
|
44
|
+
[:IMG_LoadTexture, :IMG_LoadTexture, [:pointer, :pointer], :pointer],
|
45
|
+
[:IMG_LoadTexture_IO, :IMG_LoadTexture_IO, [:pointer, :pointer, :bool], :pointer],
|
46
|
+
[:IMG_LoadTextureTyped_IO, :IMG_LoadTextureTyped_IO, [:pointer, :pointer, :bool, :pointer], :pointer],
|
47
|
+
[:IMG_isAVIF, :IMG_isAVIF, [:pointer], :bool],
|
48
|
+
[:IMG_isICO, :IMG_isICO, [:pointer], :bool],
|
49
|
+
[:IMG_isCUR, :IMG_isCUR, [:pointer], :bool],
|
50
|
+
[:IMG_isBMP, :IMG_isBMP, [:pointer], :bool],
|
51
|
+
[:IMG_isGIF, :IMG_isGIF, [:pointer], :bool],
|
52
|
+
[:IMG_isJPG, :IMG_isJPG, [:pointer], :bool],
|
53
|
+
[:IMG_isJXL, :IMG_isJXL, [:pointer], :bool],
|
54
|
+
[:IMG_isLBM, :IMG_isLBM, [:pointer], :bool],
|
55
|
+
[:IMG_isPCX, :IMG_isPCX, [:pointer], :bool],
|
56
|
+
[:IMG_isPNG, :IMG_isPNG, [:pointer], :bool],
|
57
|
+
[:IMG_isPNM, :IMG_isPNM, [:pointer], :bool],
|
58
|
+
[:IMG_isSVG, :IMG_isSVG, [:pointer], :bool],
|
59
|
+
[:IMG_isQOI, :IMG_isQOI, [:pointer], :bool],
|
60
|
+
[:IMG_isTIF, :IMG_isTIF, [:pointer], :bool],
|
61
|
+
[:IMG_isXCF, :IMG_isXCF, [:pointer], :bool],
|
62
|
+
[:IMG_isXPM, :IMG_isXPM, [:pointer], :bool],
|
63
|
+
[:IMG_isXV, :IMG_isXV, [:pointer], :bool],
|
64
|
+
[:IMG_isWEBP, :IMG_isWEBP, [:pointer], :bool],
|
65
|
+
[:IMG_LoadAVIF_IO, :IMG_LoadAVIF_IO, [:pointer], :pointer],
|
66
|
+
[:IMG_LoadICO_IO, :IMG_LoadICO_IO, [:pointer], :pointer],
|
67
|
+
[:IMG_LoadCUR_IO, :IMG_LoadCUR_IO, [:pointer], :pointer],
|
68
|
+
[:IMG_LoadBMP_IO, :IMG_LoadBMP_IO, [:pointer], :pointer],
|
69
|
+
[:IMG_LoadGIF_IO, :IMG_LoadGIF_IO, [:pointer], :pointer],
|
70
|
+
[:IMG_LoadJPG_IO, :IMG_LoadJPG_IO, [:pointer], :pointer],
|
71
|
+
[:IMG_LoadJXL_IO, :IMG_LoadJXL_IO, [:pointer], :pointer],
|
72
|
+
[:IMG_LoadLBM_IO, :IMG_LoadLBM_IO, [:pointer], :pointer],
|
73
|
+
[:IMG_LoadPCX_IO, :IMG_LoadPCX_IO, [:pointer], :pointer],
|
74
|
+
[:IMG_LoadPNG_IO, :IMG_LoadPNG_IO, [:pointer], :pointer],
|
75
|
+
[:IMG_LoadPNM_IO, :IMG_LoadPNM_IO, [:pointer], :pointer],
|
76
|
+
[:IMG_LoadSVG_IO, :IMG_LoadSVG_IO, [:pointer], :pointer],
|
77
|
+
[:IMG_LoadQOI_IO, :IMG_LoadQOI_IO, [:pointer], :pointer],
|
78
|
+
[:IMG_LoadTGA_IO, :IMG_LoadTGA_IO, [:pointer], :pointer],
|
79
|
+
[:IMG_LoadTIF_IO, :IMG_LoadTIF_IO, [:pointer], :pointer],
|
80
|
+
[:IMG_LoadXCF_IO, :IMG_LoadXCF_IO, [:pointer], :pointer],
|
81
|
+
[:IMG_LoadXPM_IO, :IMG_LoadXPM_IO, [:pointer], :pointer],
|
82
|
+
[:IMG_LoadXV_IO, :IMG_LoadXV_IO, [:pointer], :pointer],
|
83
|
+
[:IMG_LoadWEBP_IO, :IMG_LoadWEBP_IO, [:pointer], :pointer],
|
84
|
+
[:IMG_LoadSizedSVG_IO, :IMG_LoadSizedSVG_IO, [:pointer, :int, :int], :pointer],
|
85
|
+
[:IMG_ReadXPMFromArray, :IMG_ReadXPMFromArray, [:pointer], :pointer],
|
86
|
+
[:IMG_ReadXPMFromArrayToRGB888, :IMG_ReadXPMFromArrayToRGB888, [:pointer], :pointer],
|
87
|
+
[:IMG_SaveAVIF, :IMG_SaveAVIF, [:pointer, :pointer, :int], :bool],
|
88
|
+
[:IMG_SaveAVIF_IO, :IMG_SaveAVIF_IO, [:pointer, :pointer, :bool, :int], :bool],
|
89
|
+
[:IMG_SavePNG, :IMG_SavePNG, [:pointer, :pointer], :bool],
|
90
|
+
[:IMG_SavePNG_IO, :IMG_SavePNG_IO, [:pointer, :pointer, :bool], :bool],
|
91
|
+
[:IMG_SaveJPG, :IMG_SaveJPG, [:pointer, :pointer, :int], :bool],
|
92
|
+
[:IMG_SaveJPG_IO, :IMG_SaveJPG_IO, [:pointer, :pointer, :bool, :int], :bool],
|
93
|
+
[:IMG_LoadAnimation, :IMG_LoadAnimation, [:pointer], :pointer],
|
94
|
+
[:IMG_LoadAnimation_IO, :IMG_LoadAnimation_IO, [:pointer, :bool], :pointer],
|
95
|
+
[:IMG_LoadAnimationTyped_IO, :IMG_LoadAnimationTyped_IO, [:pointer, :bool, :pointer], :pointer],
|
96
|
+
[:IMG_FreeAnimation, :IMG_FreeAnimation, [:pointer], :void],
|
97
|
+
[:IMG_LoadGIFAnimation_IO, :IMG_LoadGIFAnimation_IO, [:pointer], :pointer],
|
98
|
+
[:IMG_LoadWEBPAnimation_IO, :IMG_LoadWEBPAnimation_IO, [:pointer], :pointer],
|
99
|
+
]
|
100
|
+
entries.each do |entry|
|
101
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
102
|
+
rescue FFI::NotFoundError => e
|
103
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
data/lib/sdl3_init.rb
ADDED
@@ -0,0 +1,71 @@
|
|
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
|
+
INIT_AUDIO = 0x00000010
|
14
|
+
INIT_VIDEO = 0x00000020
|
15
|
+
INIT_JOYSTICK = 0x00000200
|
16
|
+
INIT_HAPTIC = 0x00001000
|
17
|
+
INIT_GAMEPAD = 0x00002000
|
18
|
+
INIT_EVENTS = 0x00004000
|
19
|
+
INIT_SENSOR = 0x00008000
|
20
|
+
INIT_CAMERA = 0x00010000
|
21
|
+
PROP_APP_METADATA_NAME_STRING = "SDL.app.metadata.name"
|
22
|
+
PROP_APP_METADATA_VERSION_STRING = "SDL.app.metadata.version"
|
23
|
+
PROP_APP_METADATA_IDENTIFIER_STRING = "SDL.app.metadata.identifier"
|
24
|
+
PROP_APP_METADATA_CREATOR_STRING = "SDL.app.metadata.creator"
|
25
|
+
PROP_APP_METADATA_COPYRIGHT_STRING = "SDL.app.metadata.copyright"
|
26
|
+
PROP_APP_METADATA_URL_STRING = "SDL.app.metadata.url"
|
27
|
+
PROP_APP_METADATA_TYPE_STRING = "SDL.app.metadata.type"
|
28
|
+
|
29
|
+
# Enum
|
30
|
+
|
31
|
+
APP_CONTINUE = 0
|
32
|
+
APP_SUCCESS = 1
|
33
|
+
APP_FAILURE = 2
|
34
|
+
|
35
|
+
# Typedef
|
36
|
+
|
37
|
+
typedef :uint, :SDL_InitFlags
|
38
|
+
typedef :int, :SDL_AppResult
|
39
|
+
callback :SDL_AppInit_func, [:pointer, :int, :pointer], :int
|
40
|
+
callback :SDL_AppIterate_func, [:pointer], :int
|
41
|
+
callback :SDL_AppEvent_func, [:pointer, :pointer], :int
|
42
|
+
callback :SDL_AppQuit_func, [:pointer, :int], :void
|
43
|
+
callback :SDL_MainThreadCallback, [:pointer], :void
|
44
|
+
|
45
|
+
# Struct
|
46
|
+
|
47
|
+
|
48
|
+
# Function
|
49
|
+
|
50
|
+
def self.setup_init_symbols(output_error = false)
|
51
|
+
entries = [
|
52
|
+
[:Init, :SDL_Init, [:uint], :bool],
|
53
|
+
[:InitSubSystem, :SDL_InitSubSystem, [:uint], :bool],
|
54
|
+
[:QuitSubSystem, :SDL_QuitSubSystem, [:uint], :void],
|
55
|
+
[:WasInit, :SDL_WasInit, [:uint], :uint],
|
56
|
+
[:Quit, :SDL_Quit, [], :void],
|
57
|
+
[:IsMainThread, :SDL_IsMainThread, [], :bool],
|
58
|
+
[:RunOnMainThread, :SDL_RunOnMainThread, [:SDL_MainThreadCallback, :pointer, :bool], :bool],
|
59
|
+
[:SetAppMetadata, :SDL_SetAppMetadata, [:pointer, :pointer, :pointer], :bool],
|
60
|
+
[:SetAppMetadataProperty, :SDL_SetAppMetadataProperty, [:pointer, :pointer], :bool],
|
61
|
+
[:GetAppMetadataProperty, :SDL_GetAppMetadataProperty, [:pointer], :pointer],
|
62
|
+
]
|
63
|
+
entries.each do |entry|
|
64
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
65
|
+
rescue FFI::NotFoundError => e
|
66
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,115 @@
|
|
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_IOSTREAM_WINDOWS_HANDLE_POINTER = "SDL.iostream.windows.handle"
|
14
|
+
PROP_IOSTREAM_STDIO_FILE_POINTER = "SDL.iostream.stdio.file"
|
15
|
+
PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER = "SDL.iostream.file_descriptor"
|
16
|
+
PROP_IOSTREAM_ANDROID_AASSET_POINTER = "SDL.iostream.android.aasset"
|
17
|
+
PROP_IOSTREAM_MEMORY_POINTER = "SDL.iostream.memory.base"
|
18
|
+
PROP_IOSTREAM_MEMORY_SIZE_NUMBER = "SDL.iostream.memory.size"
|
19
|
+
PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER = "SDL.iostream.dynamic.memory"
|
20
|
+
PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER = "SDL.iostream.dynamic.chunksize"
|
21
|
+
|
22
|
+
# Enum
|
23
|
+
|
24
|
+
IO_STATUS_READY = 0
|
25
|
+
IO_STATUS_ERROR = 1
|
26
|
+
IO_STATUS_EOF = 2
|
27
|
+
IO_STATUS_NOT_READY = 3
|
28
|
+
IO_STATUS_READONLY = 4
|
29
|
+
IO_STATUS_WRITEONLY = 5
|
30
|
+
IO_SEEK_SET = 0
|
31
|
+
IO_SEEK_CUR = 1
|
32
|
+
IO_SEEK_END = 2
|
33
|
+
|
34
|
+
# Typedef
|
35
|
+
|
36
|
+
typedef :int, :SDL_IOStatus
|
37
|
+
typedef :int, :SDL_IOWhence
|
38
|
+
|
39
|
+
# Struct
|
40
|
+
|
41
|
+
class IOStreamInterface < FFI::Struct
|
42
|
+
layout(
|
43
|
+
:version, :uint,
|
44
|
+
:size, :pointer,
|
45
|
+
:seek, :pointer,
|
46
|
+
:read, :pointer,
|
47
|
+
:write, :pointer,
|
48
|
+
:flush, :pointer,
|
49
|
+
:close, :pointer,
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
# Function
|
55
|
+
|
56
|
+
def self.setup_iostream_symbols(output_error = false)
|
57
|
+
entries = [
|
58
|
+
[:IOFromFile, :SDL_IOFromFile, [:pointer, :pointer], :pointer],
|
59
|
+
[:IOFromMem, :SDL_IOFromMem, [:pointer, :ulong_long], :pointer],
|
60
|
+
[:IOFromConstMem, :SDL_IOFromConstMem, [:pointer, :ulong_long], :pointer],
|
61
|
+
[:IOFromDynamicMem, :SDL_IOFromDynamicMem, [], :pointer],
|
62
|
+
[:OpenIO, :SDL_OpenIO, [:pointer, :pointer], :pointer],
|
63
|
+
[:CloseIO, :SDL_CloseIO, [:pointer], :bool],
|
64
|
+
[:GetIOProperties, :SDL_GetIOProperties, [:pointer], :uint],
|
65
|
+
[:GetIOStatus, :SDL_GetIOStatus, [:pointer], :int],
|
66
|
+
[:GetIOSize, :SDL_GetIOSize, [:pointer], :long_long],
|
67
|
+
[:SeekIO, :SDL_SeekIO, [:pointer, :long_long, :int], :long_long],
|
68
|
+
[:TellIO, :SDL_TellIO, [:pointer], :long_long],
|
69
|
+
[:ReadIO, :SDL_ReadIO, [:pointer, :pointer, :ulong_long], :ulong_long],
|
70
|
+
[:WriteIO, :SDL_WriteIO, [:pointer, :pointer, :ulong_long], :ulong_long],
|
71
|
+
[:IOprintf, :SDL_IOprintf, [:pointer, :pointer], :ulong_long],
|
72
|
+
[:IOvprintf, :SDL_IOvprintf, [:pointer, :pointer, :pointer], :ulong_long],
|
73
|
+
[:FlushIO, :SDL_FlushIO, [:pointer], :bool],
|
74
|
+
[:LoadFile_IO, :SDL_LoadFile_IO, [:pointer, :pointer, :bool], :pointer],
|
75
|
+
[:LoadFile, :SDL_LoadFile, [:pointer, :pointer], :pointer],
|
76
|
+
[:SaveFile_IO, :SDL_SaveFile_IO, [:pointer, :pointer, :ulong_long, :bool], :bool],
|
77
|
+
[:SaveFile, :SDL_SaveFile, [:pointer, :pointer, :ulong_long], :bool],
|
78
|
+
[:ReadU8, :SDL_ReadU8, [:pointer, :pointer], :bool],
|
79
|
+
[:ReadS8, :SDL_ReadS8, [:pointer, :pointer], :bool],
|
80
|
+
[:ReadU16LE, :SDL_ReadU16LE, [:pointer, :pointer], :bool],
|
81
|
+
[:ReadS16LE, :SDL_ReadS16LE, [:pointer, :pointer], :bool],
|
82
|
+
[:ReadU16BE, :SDL_ReadU16BE, [:pointer, :pointer], :bool],
|
83
|
+
[:ReadS16BE, :SDL_ReadS16BE, [:pointer, :pointer], :bool],
|
84
|
+
[:ReadU32LE, :SDL_ReadU32LE, [:pointer, :pointer], :bool],
|
85
|
+
[:ReadS32LE, :SDL_ReadS32LE, [:pointer, :pointer], :bool],
|
86
|
+
[:ReadU32BE, :SDL_ReadU32BE, [:pointer, :pointer], :bool],
|
87
|
+
[:ReadS32BE, :SDL_ReadS32BE, [:pointer, :pointer], :bool],
|
88
|
+
[:ReadU64LE, :SDL_ReadU64LE, [:pointer, :pointer], :bool],
|
89
|
+
[:ReadS64LE, :SDL_ReadS64LE, [:pointer, :pointer], :bool],
|
90
|
+
[:ReadU64BE, :SDL_ReadU64BE, [:pointer, :pointer], :bool],
|
91
|
+
[:ReadS64BE, :SDL_ReadS64BE, [:pointer, :pointer], :bool],
|
92
|
+
[:WriteU8, :SDL_WriteU8, [:pointer, :uchar], :bool],
|
93
|
+
[:WriteS8, :SDL_WriteS8, [:pointer, :char], :bool],
|
94
|
+
[:WriteU16LE, :SDL_WriteU16LE, [:pointer, :ushort], :bool],
|
95
|
+
[:WriteS16LE, :SDL_WriteS16LE, [:pointer, :short], :bool],
|
96
|
+
[:WriteU16BE, :SDL_WriteU16BE, [:pointer, :ushort], :bool],
|
97
|
+
[:WriteS16BE, :SDL_WriteS16BE, [:pointer, :short], :bool],
|
98
|
+
[:WriteU32LE, :SDL_WriteU32LE, [:pointer, :uint], :bool],
|
99
|
+
[:WriteS32LE, :SDL_WriteS32LE, [:pointer, :int], :bool],
|
100
|
+
[:WriteU32BE, :SDL_WriteU32BE, [:pointer, :uint], :bool],
|
101
|
+
[:WriteS32BE, :SDL_WriteS32BE, [:pointer, :int], :bool],
|
102
|
+
[:WriteU64LE, :SDL_WriteU64LE, [:pointer, :ulong_long], :bool],
|
103
|
+
[:WriteS64LE, :SDL_WriteS64LE, [:pointer, :long_long], :bool],
|
104
|
+
[:WriteU64BE, :SDL_WriteU64BE, [:pointer, :ulong_long], :bool],
|
105
|
+
[:WriteS64BE, :SDL_WriteS64BE, [:pointer, :long_long], :bool],
|
106
|
+
]
|
107
|
+
entries.each do |entry|
|
108
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
109
|
+
rescue FFI::NotFoundError => e
|
110
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
@@ -0,0 +1,174 @@
|
|
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_guid'
|
9
|
+
|
10
|
+
module SDL
|
11
|
+
extend FFI::Library
|
12
|
+
# Define/Macro
|
13
|
+
|
14
|
+
JOYSTICK_AXIS_MAX = 32767
|
15
|
+
JOYSTICK_AXIS_MIN = -32768
|
16
|
+
PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN = "SDL.joystick.cap.mono_led"
|
17
|
+
PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN = "SDL.joystick.cap.rgb_led"
|
18
|
+
PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN = "SDL.joystick.cap.player_led"
|
19
|
+
PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN = "SDL.joystick.cap.rumble"
|
20
|
+
PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN = "SDL.joystick.cap.trigger_rumble"
|
21
|
+
HAT_CENTERED = 0x00
|
22
|
+
HAT_UP = 0x01
|
23
|
+
HAT_RIGHT = 0x02
|
24
|
+
HAT_DOWN = 0x04
|
25
|
+
HAT_LEFT = 0x08
|
26
|
+
HAT_RIGHTUP = (HAT_RIGHT | HAT_UP)
|
27
|
+
HAT_RIGHTDOWN = (HAT_RIGHT | HAT_DOWN)
|
28
|
+
HAT_LEFTUP = (HAT_LEFT | HAT_UP)
|
29
|
+
HAT_LEFTDOWN = (HAT_LEFT | HAT_DOWN)
|
30
|
+
|
31
|
+
# Enum
|
32
|
+
|
33
|
+
JOYSTICK_TYPE_UNKNOWN = 0
|
34
|
+
JOYSTICK_TYPE_GAMEPAD = 1
|
35
|
+
JOYSTICK_TYPE_WHEEL = 2
|
36
|
+
JOYSTICK_TYPE_ARCADE_STICK = 3
|
37
|
+
JOYSTICK_TYPE_FLIGHT_STICK = 4
|
38
|
+
JOYSTICK_TYPE_DANCE_PAD = 5
|
39
|
+
JOYSTICK_TYPE_GUITAR = 6
|
40
|
+
JOYSTICK_TYPE_DRUM_KIT = 7
|
41
|
+
JOYSTICK_TYPE_ARCADE_PAD = 8
|
42
|
+
JOYSTICK_TYPE_THROTTLE = 9
|
43
|
+
JOYSTICK_TYPE_COUNT = 10
|
44
|
+
JOYSTICK_CONNECTION_INVALID = -1
|
45
|
+
JOYSTICK_CONNECTION_UNKNOWN = 0
|
46
|
+
JOYSTICK_CONNECTION_WIRED = 1
|
47
|
+
JOYSTICK_CONNECTION_WIRELESS = 2
|
48
|
+
|
49
|
+
# Typedef
|
50
|
+
|
51
|
+
typedef :uint, :SDL_JoystickID
|
52
|
+
typedef :int, :SDL_JoystickType
|
53
|
+
typedef :int, :SDL_JoystickConnectionState
|
54
|
+
|
55
|
+
# Struct
|
56
|
+
|
57
|
+
class VirtualJoystickTouchpadDesc < FFI::Struct
|
58
|
+
layout(
|
59
|
+
:nfingers, :ushort,
|
60
|
+
:padding, [:ushort, 3],
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
class VirtualJoystickSensorDesc < FFI::Struct
|
65
|
+
layout(
|
66
|
+
:type, :int,
|
67
|
+
:rate, :float,
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
class VirtualJoystickDesc < FFI::Struct
|
72
|
+
layout(
|
73
|
+
:version, :uint,
|
74
|
+
:type, :ushort,
|
75
|
+
:padding, :ushort,
|
76
|
+
:vendor_id, :ushort,
|
77
|
+
:product_id, :ushort,
|
78
|
+
:naxes, :ushort,
|
79
|
+
:nbuttons, :ushort,
|
80
|
+
:nballs, :ushort,
|
81
|
+
:nhats, :ushort,
|
82
|
+
:ntouchpads, :ushort,
|
83
|
+
:nsensors, :ushort,
|
84
|
+
:padding2, [:ushort, 2],
|
85
|
+
:button_mask, :uint,
|
86
|
+
:axis_mask, :uint,
|
87
|
+
:name, :pointer,
|
88
|
+
:touchpads, :pointer,
|
89
|
+
:sensors, :pointer,
|
90
|
+
:userdata, :pointer,
|
91
|
+
:Update, :pointer,
|
92
|
+
:SetPlayerIndex, :pointer,
|
93
|
+
:Rumble, :pointer,
|
94
|
+
:RumbleTriggers, :pointer,
|
95
|
+
:SetLED, :pointer,
|
96
|
+
:SendEffect, :pointer,
|
97
|
+
:SetSensorsEnabled, :pointer,
|
98
|
+
:Cleanup, :pointer,
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
# Function
|
104
|
+
|
105
|
+
def self.setup_joystick_symbols(output_error = false)
|
106
|
+
entries = [
|
107
|
+
[:LockJoysticks, :SDL_LockJoysticks, [], :void],
|
108
|
+
[:UnlockJoysticks, :SDL_UnlockJoysticks, [], :void],
|
109
|
+
[:HasJoystick, :SDL_HasJoystick, [], :bool],
|
110
|
+
[:GetJoysticks, :SDL_GetJoysticks, [:pointer], :pointer],
|
111
|
+
[:GetJoystickNameForID, :SDL_GetJoystickNameForID, [:uint], :pointer],
|
112
|
+
[:GetJoystickPathForID, :SDL_GetJoystickPathForID, [:uint], :pointer],
|
113
|
+
[:GetJoystickPlayerIndexForID, :SDL_GetJoystickPlayerIndexForID, [:uint], :int],
|
114
|
+
[:GetJoystickGUIDForID, :SDL_GetJoystickGUIDForID, [:uint], GUID.by_value],
|
115
|
+
[:GetJoystickVendorForID, :SDL_GetJoystickVendorForID, [:uint], :ushort],
|
116
|
+
[:GetJoystickProductForID, :SDL_GetJoystickProductForID, [:uint], :ushort],
|
117
|
+
[:GetJoystickProductVersionForID, :SDL_GetJoystickProductVersionForID, [:uint], :ushort],
|
118
|
+
[:GetJoystickTypeForID, :SDL_GetJoystickTypeForID, [:uint], :int],
|
119
|
+
[:OpenJoystick, :SDL_OpenJoystick, [:uint], :pointer],
|
120
|
+
[:GetJoystickFromID, :SDL_GetJoystickFromID, [:uint], :pointer],
|
121
|
+
[:GetJoystickFromPlayerIndex, :SDL_GetJoystickFromPlayerIndex, [:int], :pointer],
|
122
|
+
[:AttachVirtualJoystick, :SDL_AttachVirtualJoystick, [:pointer], :uint],
|
123
|
+
[:DetachVirtualJoystick, :SDL_DetachVirtualJoystick, [:uint], :bool],
|
124
|
+
[:IsJoystickVirtual, :SDL_IsJoystickVirtual, [:uint], :bool],
|
125
|
+
[:SetJoystickVirtualAxis, :SDL_SetJoystickVirtualAxis, [:pointer, :int, :short], :bool],
|
126
|
+
[:SetJoystickVirtualBall, :SDL_SetJoystickVirtualBall, [:pointer, :int, :short, :short], :bool],
|
127
|
+
[:SetJoystickVirtualButton, :SDL_SetJoystickVirtualButton, [:pointer, :int, :bool], :bool],
|
128
|
+
[:SetJoystickVirtualHat, :SDL_SetJoystickVirtualHat, [:pointer, :int, :uchar], :bool],
|
129
|
+
[:SetJoystickVirtualTouchpad, :SDL_SetJoystickVirtualTouchpad, [:pointer, :int, :int, :bool, :float, :float, :float], :bool],
|
130
|
+
[:SendJoystickVirtualSensorData, :SDL_SendJoystickVirtualSensorData, [:pointer, :int, :ulong_long, :pointer, :int], :bool],
|
131
|
+
[:GetJoystickProperties, :SDL_GetJoystickProperties, [:pointer], :uint],
|
132
|
+
[:GetJoystickName, :SDL_GetJoystickName, [:pointer], :pointer],
|
133
|
+
[:GetJoystickPath, :SDL_GetJoystickPath, [:pointer], :pointer],
|
134
|
+
[:GetJoystickPlayerIndex, :SDL_GetJoystickPlayerIndex, [:pointer], :int],
|
135
|
+
[:SetJoystickPlayerIndex, :SDL_SetJoystickPlayerIndex, [:pointer, :int], :bool],
|
136
|
+
[:GetJoystickGUID, :SDL_GetJoystickGUID, [:pointer], GUID.by_value],
|
137
|
+
[:GetJoystickVendor, :SDL_GetJoystickVendor, [:pointer], :ushort],
|
138
|
+
[:GetJoystickProduct, :SDL_GetJoystickProduct, [:pointer], :ushort],
|
139
|
+
[:GetJoystickProductVersion, :SDL_GetJoystickProductVersion, [:pointer], :ushort],
|
140
|
+
[:GetJoystickFirmwareVersion, :SDL_GetJoystickFirmwareVersion, [:pointer], :ushort],
|
141
|
+
[:GetJoystickSerial, :SDL_GetJoystickSerial, [:pointer], :pointer],
|
142
|
+
[:GetJoystickType, :SDL_GetJoystickType, [:pointer], :int],
|
143
|
+
[:GetJoystickGUIDInfo, :SDL_GetJoystickGUIDInfo, [GUID.by_value, :pointer, :pointer, :pointer, :pointer], :void],
|
144
|
+
[:JoystickConnected, :SDL_JoystickConnected, [:pointer], :bool],
|
145
|
+
[:GetJoystickID, :SDL_GetJoystickID, [:pointer], :uint],
|
146
|
+
[:GetNumJoystickAxes, :SDL_GetNumJoystickAxes, [:pointer], :int],
|
147
|
+
[:GetNumJoystickBalls, :SDL_GetNumJoystickBalls, [:pointer], :int],
|
148
|
+
[:GetNumJoystickHats, :SDL_GetNumJoystickHats, [:pointer], :int],
|
149
|
+
[:GetNumJoystickButtons, :SDL_GetNumJoystickButtons, [:pointer], :int],
|
150
|
+
[:SetJoystickEventsEnabled, :SDL_SetJoystickEventsEnabled, [:bool], :void],
|
151
|
+
[:JoystickEventsEnabled, :SDL_JoystickEventsEnabled, [], :bool],
|
152
|
+
[:UpdateJoysticks, :SDL_UpdateJoysticks, [], :void],
|
153
|
+
[:GetJoystickAxis, :SDL_GetJoystickAxis, [:pointer, :int], :short],
|
154
|
+
[:GetJoystickAxisInitialState, :SDL_GetJoystickAxisInitialState, [:pointer, :int, :pointer], :bool],
|
155
|
+
[:GetJoystickBall, :SDL_GetJoystickBall, [:pointer, :int, :pointer, :pointer], :bool],
|
156
|
+
[:GetJoystickHat, :SDL_GetJoystickHat, [:pointer, :int], :uchar],
|
157
|
+
[:GetJoystickButton, :SDL_GetJoystickButton, [:pointer, :int], :bool],
|
158
|
+
[:RumbleJoystick, :SDL_RumbleJoystick, [:pointer, :ushort, :ushort, :uint], :bool],
|
159
|
+
[:RumbleJoystickTriggers, :SDL_RumbleJoystickTriggers, [:pointer, :ushort, :ushort, :uint], :bool],
|
160
|
+
[:SetJoystickLED, :SDL_SetJoystickLED, [:pointer, :uchar, :uchar, :uchar], :bool],
|
161
|
+
[:SendJoystickEffect, :SDL_SendJoystickEffect, [:pointer, :pointer, :int], :bool],
|
162
|
+
[:CloseJoystick, :SDL_CloseJoystick, [:pointer], :void],
|
163
|
+
[:GetJoystickConnectionState, :SDL_GetJoystickConnectionState, [:pointer], :int],
|
164
|
+
[:GetJoystickPowerInfo, :SDL_GetJoystickPowerInfo, [:pointer, :pointer], :int],
|
165
|
+
]
|
166
|
+
entries.each do |entry|
|
167
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
168
|
+
rescue FFI::NotFoundError => e
|
169
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
@@ -0,0 +1,81 @@
|
|
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_TEXTINPUT_TYPE_NUMBER = "SDL.textinput.type"
|
14
|
+
PROP_TEXTINPUT_CAPITALIZATION_NUMBER = "SDL.textinput.capitalization"
|
15
|
+
PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN = "SDL.textinput.autocorrect"
|
16
|
+
PROP_TEXTINPUT_MULTILINE_BOOLEAN = "SDL.textinput.multiline"
|
17
|
+
PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER = "SDL.textinput.android.inputtype"
|
18
|
+
|
19
|
+
# Enum
|
20
|
+
|
21
|
+
TEXTINPUT_TYPE_TEXT = 0
|
22
|
+
TEXTINPUT_TYPE_TEXT_NAME = 1
|
23
|
+
TEXTINPUT_TYPE_TEXT_EMAIL = 2
|
24
|
+
TEXTINPUT_TYPE_TEXT_USERNAME = 3
|
25
|
+
TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN = 4
|
26
|
+
TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE = 5
|
27
|
+
TEXTINPUT_TYPE_NUMBER = 6
|
28
|
+
TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN = 7
|
29
|
+
TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE = 8
|
30
|
+
CAPITALIZE_NONE = 0
|
31
|
+
CAPITALIZE_SENTENCES = 1
|
32
|
+
CAPITALIZE_WORDS = 2
|
33
|
+
CAPITALIZE_LETTERS = 3
|
34
|
+
|
35
|
+
# Typedef
|
36
|
+
|
37
|
+
typedef :uint, :SDL_KeyboardID
|
38
|
+
typedef :int, :SDL_TextInputType
|
39
|
+
typedef :int, :SDL_Capitalization
|
40
|
+
|
41
|
+
# Struct
|
42
|
+
|
43
|
+
|
44
|
+
# Function
|
45
|
+
|
46
|
+
def self.setup_keyboard_symbols(output_error = false)
|
47
|
+
entries = [
|
48
|
+
[:HasKeyboard, :SDL_HasKeyboard, [], :bool],
|
49
|
+
[:GetKeyboards, :SDL_GetKeyboards, [:pointer], :pointer],
|
50
|
+
[:GetKeyboardNameForID, :SDL_GetKeyboardNameForID, [:uint], :pointer],
|
51
|
+
[:GetKeyboardFocus, :SDL_GetKeyboardFocus, [], :pointer],
|
52
|
+
[:GetKeyboardState, :SDL_GetKeyboardState, [:pointer], :pointer],
|
53
|
+
[:ResetKeyboard, :SDL_ResetKeyboard, [], :void],
|
54
|
+
[:GetModState, :SDL_GetModState, [], :ushort],
|
55
|
+
[:SetModState, :SDL_SetModState, [:ushort], :void],
|
56
|
+
[:GetKeyFromScancode, :SDL_GetKeyFromScancode, [:int, :ushort, :bool], :uint],
|
57
|
+
[:GetScancodeFromKey, :SDL_GetScancodeFromKey, [:uint, :pointer], :int],
|
58
|
+
[:SetScancodeName, :SDL_SetScancodeName, [:int, :pointer], :bool],
|
59
|
+
[:GetScancodeName, :SDL_GetScancodeName, [:int], :pointer],
|
60
|
+
[:GetScancodeFromName, :SDL_GetScancodeFromName, [:pointer], :int],
|
61
|
+
[:GetKeyName, :SDL_GetKeyName, [:uint], :pointer],
|
62
|
+
[:GetKeyFromName, :SDL_GetKeyFromName, [:pointer], :uint],
|
63
|
+
[:StartTextInput, :SDL_StartTextInput, [:pointer], :bool],
|
64
|
+
[:StartTextInputWithProperties, :SDL_StartTextInputWithProperties, [:pointer, :uint], :bool],
|
65
|
+
[:TextInputActive, :SDL_TextInputActive, [:pointer], :bool],
|
66
|
+
[:StopTextInput, :SDL_StopTextInput, [:pointer], :bool],
|
67
|
+
[:ClearComposition, :SDL_ClearComposition, [:pointer], :bool],
|
68
|
+
[:SetTextInputArea, :SDL_SetTextInputArea, [:pointer, :pointer, :int], :bool],
|
69
|
+
[:GetTextInputArea, :SDL_GetTextInputArea, [:pointer, :pointer, :pointer], :bool],
|
70
|
+
[:HasScreenKeyboardSupport, :SDL_HasScreenKeyboardSupport, [], :bool],
|
71
|
+
[:ScreenKeyboardShown, :SDL_ScreenKeyboardShown, [:pointer], :bool],
|
72
|
+
]
|
73
|
+
entries.each do |entry|
|
74
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
75
|
+
rescue FFI::NotFoundError => e
|
76
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|