sdl2-bindings 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +83 -79
- data/LICENSE.txt +1 -1
- data/README.md +49 -49
- data/lib/sdl2.rb +170 -170
- data/lib/sdl2_audio.rb +219 -201
- data/lib/sdl2_blendmode.rb +69 -69
- data/lib/sdl2_clipboard.rb +51 -51
- data/lib/sdl2_cpuinfo.rb +106 -106
- data/lib/sdl2_error.rb +64 -64
- data/lib/sdl2_events.rb +530 -530
- data/lib/sdl2_filesystem.rb +48 -48
- data/lib/sdl2_framerate.rb +67 -67
- data/lib/sdl2_gamecontroller.rb +254 -254
- data/lib/sdl2_gesture.rb +55 -55
- data/lib/sdl2_gfxPrimitives.rb +222 -222
- data/lib/sdl2_haptic.rb +269 -269
- data/lib/sdl2_hints.rb +174 -174
- data/lib/sdl2_image.rb +185 -185
- data/lib/sdl2_imageFilter.rb +132 -132
- data/lib/sdl2_joystick.rb +230 -230
- data/lib/sdl2_keyboard.rb +99 -99
- data/lib/sdl2_keycode.rb +304 -304
- data/lib/sdl2_log.rb +115 -115
- data/lib/sdl2_main.rb +67 -67
- data/lib/sdl2_messagebox.rb +98 -98
- data/lib/sdl2_mixer.rb +317 -307
- data/lib/sdl2_mouse.rb +117 -117
- data/lib/sdl2_pixels.rb +224 -224
- data/lib/sdl2_platform.rb +45 -45
- data/lib/sdl2_power.rb +51 -51
- data/lib/sdl2_rect.rb +102 -102
- data/lib/sdl2_render.rb +290 -290
- data/lib/sdl2_rotozoom.rb +66 -66
- data/lib/sdl2_rwops.rb +208 -208
- data/lib/sdl2_scancode.rb +287 -287
- data/lib/sdl2_shape.rb +77 -77
- data/lib/sdl2_stdinc.rb +393 -393
- data/lib/sdl2_surface.rb +182 -182
- data/lib/sdl2_syswm.rb +154 -154
- data/lib/sdl2_timer.rb +62 -62
- data/lib/sdl2_touch.rb +73 -73
- data/lib/sdl2_ttf.rb +202 -190
- data/lib/sdl2_version.rb +62 -62
- data/lib/sdl2_video.rb +411 -411
- data/lib/sdl2_vulkan.rb +64 -64
- metadata +6 -6
data/lib/sdl2_log.rb
CHANGED
@@ -1,115 +1,115 @@
|
|
1
|
-
# Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
|
2
|
-
#
|
3
|
-
# * https://github.com/vaiorabbit/sdl2-bindings
|
4
|
-
#
|
5
|
-
# [NOTICE] This is an automatically generated file.
|
6
|
-
|
7
|
-
require 'ffi'
|
8
|
-
|
9
|
-
module SDL2
|
10
|
-
extend FFI::Library
|
11
|
-
# Define/Macro
|
12
|
-
|
13
|
-
SDL_MAX_LOG_MESSAGE = 4096
|
14
|
-
|
15
|
-
# Enum
|
16
|
-
|
17
|
-
SDL_LOG_CATEGORY_APPLICATION = 0
|
18
|
-
SDL_LOG_CATEGORY_ERROR = 1
|
19
|
-
SDL_LOG_CATEGORY_ASSERT = 2
|
20
|
-
SDL_LOG_CATEGORY_SYSTEM = 3
|
21
|
-
SDL_LOG_CATEGORY_AUDIO = 4
|
22
|
-
SDL_LOG_CATEGORY_VIDEO = 5
|
23
|
-
SDL_LOG_CATEGORY_RENDER = 6
|
24
|
-
SDL_LOG_CATEGORY_INPUT = 7
|
25
|
-
SDL_LOG_CATEGORY_TEST = 8
|
26
|
-
SDL_LOG_CATEGORY_RESERVED1 = 9
|
27
|
-
SDL_LOG_CATEGORY_RESERVED2 = 10
|
28
|
-
SDL_LOG_CATEGORY_RESERVED3 = 11
|
29
|
-
SDL_LOG_CATEGORY_RESERVED4 = 12
|
30
|
-
SDL_LOG_CATEGORY_RESERVED5 = 13
|
31
|
-
SDL_LOG_CATEGORY_RESERVED6 = 14
|
32
|
-
SDL_LOG_CATEGORY_RESERVED7 = 15
|
33
|
-
SDL_LOG_CATEGORY_RESERVED8 = 16
|
34
|
-
SDL_LOG_CATEGORY_RESERVED9 = 17
|
35
|
-
SDL_LOG_CATEGORY_RESERVED10 = 18
|
36
|
-
SDL_LOG_CATEGORY_CUSTOM = 19
|
37
|
-
SDL_LOG_PRIORITY_VERBOSE = 1
|
38
|
-
SDL_LOG_PRIORITY_DEBUG = 2
|
39
|
-
SDL_LOG_PRIORITY_INFO = 3
|
40
|
-
SDL_LOG_PRIORITY_WARN = 4
|
41
|
-
SDL_LOG_PRIORITY_ERROR = 5
|
42
|
-
SDL_LOG_PRIORITY_CRITICAL = 6
|
43
|
-
SDL_NUM_LOG_PRIORITIES = 7
|
44
|
-
|
45
|
-
# Typedef
|
46
|
-
|
47
|
-
typedef :int, :SDL_LogCategory
|
48
|
-
typedef :int, :SDL_LogPriority
|
49
|
-
callback :SDL_LogOutputFunction, [:pointer, :int, :int, :pointer], :void
|
50
|
-
|
51
|
-
# Struct
|
52
|
-
|
53
|
-
|
54
|
-
# Function
|
55
|
-
|
56
|
-
def self.setup_log_symbols()
|
57
|
-
symbols = [
|
58
|
-
:SDL_LogSetAllPriority,
|
59
|
-
:SDL_LogSetPriority,
|
60
|
-
:SDL_LogGetPriority,
|
61
|
-
:SDL_LogResetPriorities,
|
62
|
-
:SDL_Log,
|
63
|
-
:SDL_LogVerbose,
|
64
|
-
:SDL_LogDebug,
|
65
|
-
:SDL_LogInfo,
|
66
|
-
:SDL_LogWarn,
|
67
|
-
:SDL_LogError,
|
68
|
-
:SDL_LogCritical,
|
69
|
-
:SDL_LogMessage,
|
70
|
-
:SDL_LogGetOutputFunction,
|
71
|
-
:SDL_LogSetOutputFunction,
|
72
|
-
]
|
73
|
-
args = {
|
74
|
-
:SDL_LogSetAllPriority => [:int],
|
75
|
-
:SDL_LogSetPriority => [:int, :int],
|
76
|
-
:SDL_LogGetPriority => [:int],
|
77
|
-
:SDL_LogResetPriorities => [],
|
78
|
-
:SDL_Log => [:pointer],
|
79
|
-
:SDL_LogVerbose => [:int, :pointer],
|
80
|
-
:SDL_LogDebug => [:int, :pointer],
|
81
|
-
:SDL_LogInfo => [:int, :pointer],
|
82
|
-
:SDL_LogWarn => [:int, :pointer],
|
83
|
-
:SDL_LogError => [:int, :pointer],
|
84
|
-
:SDL_LogCritical => [:int, :pointer],
|
85
|
-
:SDL_LogMessage => [:int, :int, :pointer],
|
86
|
-
:SDL_LogGetOutputFunction => [:pointer, :pointer],
|
87
|
-
:SDL_LogSetOutputFunction => [:SDL_LogOutputFunction, :pointer],
|
88
|
-
}
|
89
|
-
retvals = {
|
90
|
-
:SDL_LogSetAllPriority => :void,
|
91
|
-
:SDL_LogSetPriority => :void,
|
92
|
-
:SDL_LogGetPriority => :int,
|
93
|
-
:SDL_LogResetPriorities => :void,
|
94
|
-
:SDL_Log => :void,
|
95
|
-
:SDL_LogVerbose => :void,
|
96
|
-
:SDL_LogDebug => :void,
|
97
|
-
:SDL_LogInfo => :void,
|
98
|
-
:SDL_LogWarn => :void,
|
99
|
-
:SDL_LogError => :void,
|
100
|
-
:SDL_LogCritical => :void,
|
101
|
-
:SDL_LogMessage => :void,
|
102
|
-
:SDL_LogGetOutputFunction => :void,
|
103
|
-
:SDL_LogSetOutputFunction => :void,
|
104
|
-
}
|
105
|
-
symbols.each do |sym|
|
106
|
-
begin
|
107
|
-
attach_function sym, args[sym], retvals[sym]
|
108
|
-
rescue FFI::NotFoundError => error
|
109
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
|
1
|
+
# Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
|
2
|
+
#
|
3
|
+
# * https://github.com/vaiorabbit/sdl2-bindings
|
4
|
+
#
|
5
|
+
# [NOTICE] This is an automatically generated file.
|
6
|
+
|
7
|
+
require 'ffi'
|
8
|
+
|
9
|
+
module SDL2
|
10
|
+
extend FFI::Library
|
11
|
+
# Define/Macro
|
12
|
+
|
13
|
+
SDL_MAX_LOG_MESSAGE = 4096
|
14
|
+
|
15
|
+
# Enum
|
16
|
+
|
17
|
+
SDL_LOG_CATEGORY_APPLICATION = 0
|
18
|
+
SDL_LOG_CATEGORY_ERROR = 1
|
19
|
+
SDL_LOG_CATEGORY_ASSERT = 2
|
20
|
+
SDL_LOG_CATEGORY_SYSTEM = 3
|
21
|
+
SDL_LOG_CATEGORY_AUDIO = 4
|
22
|
+
SDL_LOG_CATEGORY_VIDEO = 5
|
23
|
+
SDL_LOG_CATEGORY_RENDER = 6
|
24
|
+
SDL_LOG_CATEGORY_INPUT = 7
|
25
|
+
SDL_LOG_CATEGORY_TEST = 8
|
26
|
+
SDL_LOG_CATEGORY_RESERVED1 = 9
|
27
|
+
SDL_LOG_CATEGORY_RESERVED2 = 10
|
28
|
+
SDL_LOG_CATEGORY_RESERVED3 = 11
|
29
|
+
SDL_LOG_CATEGORY_RESERVED4 = 12
|
30
|
+
SDL_LOG_CATEGORY_RESERVED5 = 13
|
31
|
+
SDL_LOG_CATEGORY_RESERVED6 = 14
|
32
|
+
SDL_LOG_CATEGORY_RESERVED7 = 15
|
33
|
+
SDL_LOG_CATEGORY_RESERVED8 = 16
|
34
|
+
SDL_LOG_CATEGORY_RESERVED9 = 17
|
35
|
+
SDL_LOG_CATEGORY_RESERVED10 = 18
|
36
|
+
SDL_LOG_CATEGORY_CUSTOM = 19
|
37
|
+
SDL_LOG_PRIORITY_VERBOSE = 1
|
38
|
+
SDL_LOG_PRIORITY_DEBUG = 2
|
39
|
+
SDL_LOG_PRIORITY_INFO = 3
|
40
|
+
SDL_LOG_PRIORITY_WARN = 4
|
41
|
+
SDL_LOG_PRIORITY_ERROR = 5
|
42
|
+
SDL_LOG_PRIORITY_CRITICAL = 6
|
43
|
+
SDL_NUM_LOG_PRIORITIES = 7
|
44
|
+
|
45
|
+
# Typedef
|
46
|
+
|
47
|
+
typedef :int, :SDL_LogCategory
|
48
|
+
typedef :int, :SDL_LogPriority
|
49
|
+
callback :SDL_LogOutputFunction, [:pointer, :int, :int, :pointer], :void
|
50
|
+
|
51
|
+
# Struct
|
52
|
+
|
53
|
+
|
54
|
+
# Function
|
55
|
+
|
56
|
+
def self.setup_log_symbols()
|
57
|
+
symbols = [
|
58
|
+
:SDL_LogSetAllPriority,
|
59
|
+
:SDL_LogSetPriority,
|
60
|
+
:SDL_LogGetPriority,
|
61
|
+
:SDL_LogResetPriorities,
|
62
|
+
:SDL_Log,
|
63
|
+
:SDL_LogVerbose,
|
64
|
+
:SDL_LogDebug,
|
65
|
+
:SDL_LogInfo,
|
66
|
+
:SDL_LogWarn,
|
67
|
+
:SDL_LogError,
|
68
|
+
:SDL_LogCritical,
|
69
|
+
:SDL_LogMessage,
|
70
|
+
:SDL_LogGetOutputFunction,
|
71
|
+
:SDL_LogSetOutputFunction,
|
72
|
+
]
|
73
|
+
args = {
|
74
|
+
:SDL_LogSetAllPriority => [:int],
|
75
|
+
:SDL_LogSetPriority => [:int, :int],
|
76
|
+
:SDL_LogGetPriority => [:int],
|
77
|
+
:SDL_LogResetPriorities => [],
|
78
|
+
:SDL_Log => [:pointer],
|
79
|
+
:SDL_LogVerbose => [:int, :pointer],
|
80
|
+
:SDL_LogDebug => [:int, :pointer],
|
81
|
+
:SDL_LogInfo => [:int, :pointer],
|
82
|
+
:SDL_LogWarn => [:int, :pointer],
|
83
|
+
:SDL_LogError => [:int, :pointer],
|
84
|
+
:SDL_LogCritical => [:int, :pointer],
|
85
|
+
:SDL_LogMessage => [:int, :int, :pointer],
|
86
|
+
:SDL_LogGetOutputFunction => [:pointer, :pointer],
|
87
|
+
:SDL_LogSetOutputFunction => [:SDL_LogOutputFunction, :pointer],
|
88
|
+
}
|
89
|
+
retvals = {
|
90
|
+
:SDL_LogSetAllPriority => :void,
|
91
|
+
:SDL_LogSetPriority => :void,
|
92
|
+
:SDL_LogGetPriority => :int,
|
93
|
+
:SDL_LogResetPriorities => :void,
|
94
|
+
:SDL_Log => :void,
|
95
|
+
:SDL_LogVerbose => :void,
|
96
|
+
:SDL_LogDebug => :void,
|
97
|
+
:SDL_LogInfo => :void,
|
98
|
+
:SDL_LogWarn => :void,
|
99
|
+
:SDL_LogError => :void,
|
100
|
+
:SDL_LogCritical => :void,
|
101
|
+
:SDL_LogMessage => :void,
|
102
|
+
:SDL_LogGetOutputFunction => :void,
|
103
|
+
:SDL_LogSetOutputFunction => :void,
|
104
|
+
}
|
105
|
+
symbols.each do |sym|
|
106
|
+
begin
|
107
|
+
attach_function sym, args[sym], retvals[sym]
|
108
|
+
rescue FFI::NotFoundError => error
|
109
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
data/lib/sdl2_main.rb
CHANGED
@@ -1,67 +1,67 @@
|
|
1
|
-
# Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
|
2
|
-
#
|
3
|
-
# * https://github.com/vaiorabbit/sdl2-bindings
|
4
|
-
#
|
5
|
-
# [NOTICE] This is an automatically generated file.
|
6
|
-
|
7
|
-
require 'ffi'
|
8
|
-
|
9
|
-
module SDL2
|
10
|
-
extend FFI::Library
|
11
|
-
# Define/Macro
|
12
|
-
|
13
|
-
SDL_INIT_TIMER = 0x00000001
|
14
|
-
SDL_INIT_AUDIO = 0x00000010
|
15
|
-
SDL_INIT_VIDEO = 0x00000020
|
16
|
-
SDL_INIT_JOYSTICK = 0x00000200
|
17
|
-
SDL_INIT_HAPTIC = 0x00001000
|
18
|
-
SDL_INIT_GAMECONTROLLER = 0x00002000
|
19
|
-
SDL_INIT_EVENTS = 0x00004000
|
20
|
-
SDL_INIT_SENSOR = 0x00008000
|
21
|
-
SDL_INIT_NOPARACHUTE = 0x00100000
|
22
|
-
SDL_INIT_EVERYTHING = ( SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR )
|
23
|
-
|
24
|
-
# Enum
|
25
|
-
|
26
|
-
|
27
|
-
# Typedef
|
28
|
-
|
29
|
-
|
30
|
-
# Struct
|
31
|
-
|
32
|
-
|
33
|
-
# Function
|
34
|
-
|
35
|
-
def self.setup_main_symbols()
|
36
|
-
symbols = [
|
37
|
-
:SDL_Init,
|
38
|
-
:SDL_InitSubSystem,
|
39
|
-
:SDL_QuitSubSystem,
|
40
|
-
:SDL_WasInit,
|
41
|
-
:SDL_Quit,
|
42
|
-
]
|
43
|
-
args = {
|
44
|
-
:SDL_Init => [:uint],
|
45
|
-
:SDL_InitSubSystem => [:uint],
|
46
|
-
:SDL_QuitSubSystem => [:uint],
|
47
|
-
:SDL_WasInit => [:uint],
|
48
|
-
:SDL_Quit => [],
|
49
|
-
}
|
50
|
-
retvals = {
|
51
|
-
:SDL_Init => :int,
|
52
|
-
:SDL_InitSubSystem => :int,
|
53
|
-
:SDL_QuitSubSystem => :void,
|
54
|
-
:SDL_WasInit => :uint,
|
55
|
-
:SDL_Quit => :void,
|
56
|
-
}
|
57
|
-
symbols.each do |sym|
|
58
|
-
begin
|
59
|
-
attach_function sym, args[sym], retvals[sym]
|
60
|
-
rescue FFI::NotFoundError => error
|
61
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
1
|
+
# Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
|
2
|
+
#
|
3
|
+
# * https://github.com/vaiorabbit/sdl2-bindings
|
4
|
+
#
|
5
|
+
# [NOTICE] This is an automatically generated file.
|
6
|
+
|
7
|
+
require 'ffi'
|
8
|
+
|
9
|
+
module SDL2
|
10
|
+
extend FFI::Library
|
11
|
+
# Define/Macro
|
12
|
+
|
13
|
+
SDL_INIT_TIMER = 0x00000001
|
14
|
+
SDL_INIT_AUDIO = 0x00000010
|
15
|
+
SDL_INIT_VIDEO = 0x00000020
|
16
|
+
SDL_INIT_JOYSTICK = 0x00000200
|
17
|
+
SDL_INIT_HAPTIC = 0x00001000
|
18
|
+
SDL_INIT_GAMECONTROLLER = 0x00002000
|
19
|
+
SDL_INIT_EVENTS = 0x00004000
|
20
|
+
SDL_INIT_SENSOR = 0x00008000
|
21
|
+
SDL_INIT_NOPARACHUTE = 0x00100000
|
22
|
+
SDL_INIT_EVERYTHING = ( SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR )
|
23
|
+
|
24
|
+
# Enum
|
25
|
+
|
26
|
+
|
27
|
+
# Typedef
|
28
|
+
|
29
|
+
|
30
|
+
# Struct
|
31
|
+
|
32
|
+
|
33
|
+
# Function
|
34
|
+
|
35
|
+
def self.setup_main_symbols()
|
36
|
+
symbols = [
|
37
|
+
:SDL_Init,
|
38
|
+
:SDL_InitSubSystem,
|
39
|
+
:SDL_QuitSubSystem,
|
40
|
+
:SDL_WasInit,
|
41
|
+
:SDL_Quit,
|
42
|
+
]
|
43
|
+
args = {
|
44
|
+
:SDL_Init => [:uint],
|
45
|
+
:SDL_InitSubSystem => [:uint],
|
46
|
+
:SDL_QuitSubSystem => [:uint],
|
47
|
+
:SDL_WasInit => [:uint],
|
48
|
+
:SDL_Quit => [],
|
49
|
+
}
|
50
|
+
retvals = {
|
51
|
+
:SDL_Init => :int,
|
52
|
+
:SDL_InitSubSystem => :int,
|
53
|
+
:SDL_QuitSubSystem => :void,
|
54
|
+
:SDL_WasInit => :uint,
|
55
|
+
:SDL_Quit => :void,
|
56
|
+
}
|
57
|
+
symbols.each do |sym|
|
58
|
+
begin
|
59
|
+
attach_function sym, args[sym], retvals[sym]
|
60
|
+
rescue FFI::NotFoundError => error
|
61
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
data/lib/sdl2_messagebox.rb
CHANGED
@@ -1,98 +1,98 @@
|
|
1
|
-
# Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
|
2
|
-
#
|
3
|
-
# * https://github.com/vaiorabbit/sdl2-bindings
|
4
|
-
#
|
5
|
-
# [NOTICE] This is an automatically generated file.
|
6
|
-
|
7
|
-
require 'ffi'
|
8
|
-
|
9
|
-
module SDL2
|
10
|
-
extend FFI::Library
|
11
|
-
# Define/Macro
|
12
|
-
|
13
|
-
|
14
|
-
# Enum
|
15
|
-
|
16
|
-
SDL_MESSAGEBOX_ERROR = 16
|
17
|
-
SDL_MESSAGEBOX_WARNING = 32
|
18
|
-
SDL_MESSAGEBOX_INFORMATION = 64
|
19
|
-
SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 128
|
20
|
-
SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 256
|
21
|
-
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 1
|
22
|
-
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 2
|
23
|
-
SDL_MESSAGEBOX_COLOR_BACKGROUND = 0
|
24
|
-
SDL_MESSAGEBOX_COLOR_TEXT = 1
|
25
|
-
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = 2
|
26
|
-
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = 3
|
27
|
-
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = 4
|
28
|
-
SDL_MESSAGEBOX_COLOR_MAX = 5
|
29
|
-
|
30
|
-
# Typedef
|
31
|
-
|
32
|
-
typedef :int, :SDL_MessageBoxFlags
|
33
|
-
typedef :int, :SDL_MessageBoxButtonFlags
|
34
|
-
typedef :int, :SDL_MessageBoxColorType
|
35
|
-
|
36
|
-
# Struct
|
37
|
-
|
38
|
-
class SDL_MessageBoxButtonData < FFI::Struct
|
39
|
-
layout(
|
40
|
-
:flags, :uint,
|
41
|
-
:buttonid, :int,
|
42
|
-
:text, :pointer,
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
class SDL_MessageBoxColor < FFI::Struct
|
47
|
-
layout(
|
48
|
-
:r, :uchar,
|
49
|
-
:g, :uchar,
|
50
|
-
:b, :uchar,
|
51
|
-
)
|
52
|
-
end
|
53
|
-
|
54
|
-
class SDL_MessageBoxColorScheme < FFI::Struct
|
55
|
-
layout(
|
56
|
-
:colors, [SDL_MessageBoxColor, 5],
|
57
|
-
)
|
58
|
-
end
|
59
|
-
|
60
|
-
class SDL_MessageBoxData < FFI::Struct
|
61
|
-
layout(
|
62
|
-
:flags, :uint,
|
63
|
-
:window, :pointer,
|
64
|
-
:title, :pointer,
|
65
|
-
:message, :pointer,
|
66
|
-
:numbuttons, :int,
|
67
|
-
:buttons, :pointer,
|
68
|
-
:colorScheme, :pointer,
|
69
|
-
)
|
70
|
-
end
|
71
|
-
|
72
|
-
|
73
|
-
# Function
|
74
|
-
|
75
|
-
def self.setup_messagebox_symbols()
|
76
|
-
symbols = [
|
77
|
-
:SDL_ShowMessageBox,
|
78
|
-
:SDL_ShowSimpleMessageBox,
|
79
|
-
]
|
80
|
-
args = {
|
81
|
-
:SDL_ShowMessageBox => [:pointer, :pointer],
|
82
|
-
:SDL_ShowSimpleMessageBox => [:uint, :pointer, :pointer, :pointer],
|
83
|
-
}
|
84
|
-
retvals = {
|
85
|
-
:SDL_ShowMessageBox => :int,
|
86
|
-
:SDL_ShowSimpleMessageBox => :int,
|
87
|
-
}
|
88
|
-
symbols.each do |sym|
|
89
|
-
begin
|
90
|
-
attach_function sym, args[sym], retvals[sym]
|
91
|
-
rescue FFI::NotFoundError => error
|
92
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
|
1
|
+
# Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
|
2
|
+
#
|
3
|
+
# * https://github.com/vaiorabbit/sdl2-bindings
|
4
|
+
#
|
5
|
+
# [NOTICE] This is an automatically generated file.
|
6
|
+
|
7
|
+
require 'ffi'
|
8
|
+
|
9
|
+
module SDL2
|
10
|
+
extend FFI::Library
|
11
|
+
# Define/Macro
|
12
|
+
|
13
|
+
|
14
|
+
# Enum
|
15
|
+
|
16
|
+
SDL_MESSAGEBOX_ERROR = 16
|
17
|
+
SDL_MESSAGEBOX_WARNING = 32
|
18
|
+
SDL_MESSAGEBOX_INFORMATION = 64
|
19
|
+
SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 128
|
20
|
+
SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 256
|
21
|
+
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 1
|
22
|
+
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 2
|
23
|
+
SDL_MESSAGEBOX_COLOR_BACKGROUND = 0
|
24
|
+
SDL_MESSAGEBOX_COLOR_TEXT = 1
|
25
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = 2
|
26
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = 3
|
27
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = 4
|
28
|
+
SDL_MESSAGEBOX_COLOR_MAX = 5
|
29
|
+
|
30
|
+
# Typedef
|
31
|
+
|
32
|
+
typedef :int, :SDL_MessageBoxFlags
|
33
|
+
typedef :int, :SDL_MessageBoxButtonFlags
|
34
|
+
typedef :int, :SDL_MessageBoxColorType
|
35
|
+
|
36
|
+
# Struct
|
37
|
+
|
38
|
+
class SDL_MessageBoxButtonData < FFI::Struct
|
39
|
+
layout(
|
40
|
+
:flags, :uint,
|
41
|
+
:buttonid, :int,
|
42
|
+
:text, :pointer,
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
class SDL_MessageBoxColor < FFI::Struct
|
47
|
+
layout(
|
48
|
+
:r, :uchar,
|
49
|
+
:g, :uchar,
|
50
|
+
:b, :uchar,
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
class SDL_MessageBoxColorScheme < FFI::Struct
|
55
|
+
layout(
|
56
|
+
:colors, [SDL_MessageBoxColor, 5],
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
class SDL_MessageBoxData < FFI::Struct
|
61
|
+
layout(
|
62
|
+
:flags, :uint,
|
63
|
+
:window, :pointer,
|
64
|
+
:title, :pointer,
|
65
|
+
:message, :pointer,
|
66
|
+
:numbuttons, :int,
|
67
|
+
:buttons, :pointer,
|
68
|
+
:colorScheme, :pointer,
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
# Function
|
74
|
+
|
75
|
+
def self.setup_messagebox_symbols()
|
76
|
+
symbols = [
|
77
|
+
:SDL_ShowMessageBox,
|
78
|
+
:SDL_ShowSimpleMessageBox,
|
79
|
+
]
|
80
|
+
args = {
|
81
|
+
:SDL_ShowMessageBox => [:pointer, :pointer],
|
82
|
+
:SDL_ShowSimpleMessageBox => [:uint, :pointer, :pointer, :pointer],
|
83
|
+
}
|
84
|
+
retvals = {
|
85
|
+
:SDL_ShowMessageBox => :int,
|
86
|
+
:SDL_ShowSimpleMessageBox => :int,
|
87
|
+
}
|
88
|
+
symbols.each do |sym|
|
89
|
+
begin
|
90
|
+
attach_function sym, args[sym], retvals[sym]
|
91
|
+
rescue FFI::NotFoundError => error
|
92
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|