sdl2-bindings 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +25 -0
- data/LICENSE.txt +1 -1
- data/README.md +38 -19
- data/lib/sdl2.rb +56 -99
- data/lib/sdl2_audio.rb +62 -20
- data/lib/sdl2_blendmode.rb +28 -25
- data/lib/sdl2_clipboard.rb +9 -4
- data/lib/sdl2_cpuinfo.rb +31 -8
- data/lib/sdl2_error.rb +17 -10
- data/lib/sdl2_events.rb +152 -130
- data/lib/sdl2_filesystem.rb +8 -4
- data/lib/sdl2_framerate.rb +11 -4
- data/lib/sdl2_gamecontroller.rb +130 -55
- data/lib/sdl2_gesture.rb +10 -4
- data/lib/sdl2_gfxPrimitives.rb +65 -4
- data/lib/sdl2_haptic.rb +76 -44
- data/lib/sdl2_hidapi.rb +139 -0
- data/lib/sdl2_hints.rb +146 -113
- data/lib/sdl2_image.rb +54 -7
- data/lib/sdl2_imageFilter.rb +36 -4
- data/lib/sdl2_joystick.rb +102 -38
- data/lib/sdl2_keyboard.rb +23 -5
- data/lib/sdl2_keycode.rb +8 -5
- data/lib/sdl2_log.rb +48 -32
- data/lib/sdl2_main.rb +21 -14
- data/lib/sdl2_messagebox.rb +26 -22
- data/lib/sdl2_misc.rb +48 -0
- data/lib/sdl2_mixer.rb +86 -11
- data/lib/sdl2_mouse.rb +44 -25
- data/lib/sdl2_pixels.rb +115 -99
- data/lib/sdl2_platform.rb +7 -4
- data/lib/sdl2_power.rb +12 -9
- data/lib/sdl2_rect.rb +18 -11
- data/lib/sdl2_render.rb +135 -21
- data/lib/sdl2_rotozoom.rb +14 -4
- data/lib/sdl2_rwops.rb +69 -39
- data/lib/sdl2_scancode.rb +250 -248
- data/lib/sdl2_sensor.rb +115 -0
- data/lib/sdl2_shape.rb +17 -11
- data/lib/sdl2_stdinc.rb +213 -42
- data/lib/sdl2_surface.rb +62 -15
- data/lib/sdl2_syswm.rb +47 -41
- data/lib/sdl2_timer.rb +16 -4
- data/lib/sdl2_touch.rb +18 -9
- data/lib/sdl2_ttf.rb +180 -25
- data/lib/sdl2_version.rb +13 -8
- data/lib/sdl2_video.rb +232 -103
- data/lib/sdl2_vulkan.rb +12 -4
- metadata +21 -4
data/lib/sdl2_syswm.rb
CHANGED
@@ -7,32 +7,35 @@
|
|
7
7
|
require 'ffi'
|
8
8
|
require_relative 'sdl2_version'
|
9
9
|
|
10
|
-
module
|
10
|
+
module SDL
|
11
11
|
extend FFI::Library
|
12
12
|
# Define/Macro
|
13
13
|
|
14
|
+
METALVIEW_TAG = 255
|
14
15
|
|
15
16
|
# Enum
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
18
|
+
SYSWM_UNKNOWN = 0
|
19
|
+
SYSWM_WINDOWS = 1
|
20
|
+
SYSWM_X11 = 2
|
21
|
+
SYSWM_DIRECTFB = 3
|
22
|
+
SYSWM_COCOA = 4
|
23
|
+
SYSWM_UIKIT = 5
|
24
|
+
SYSWM_WAYLAND = 6
|
25
|
+
SYSWM_MIR = 7
|
26
|
+
SYSWM_WINRT = 8
|
27
|
+
SYSWM_ANDROID = 9
|
28
|
+
SYSWM_VIVANTE = 10
|
29
|
+
SYSWM_OS2 = 11
|
30
|
+
SYSWM_HAIKU = 12
|
31
|
+
SYSWM_KMSDRM = 13
|
32
|
+
SYSWM_RISCOS = 14
|
30
33
|
|
31
34
|
# Typedef
|
32
35
|
|
33
36
|
typedef :int, :SDL_SYSWM_TYPE
|
34
37
|
|
35
|
-
class
|
38
|
+
class SysWMmsg_def_win < FFI::Struct
|
36
39
|
layout(
|
37
40
|
:hwnd, :pointer,
|
38
41
|
:msg, :uint32,
|
@@ -41,46 +44,46 @@ module SDL2
|
|
41
44
|
)
|
42
45
|
end
|
43
46
|
|
44
|
-
class
|
47
|
+
class SysWMmsg_value_win < FFI::Union
|
45
48
|
layout(
|
46
|
-
:win,
|
49
|
+
:win, SysWMmsg_def_win.by_value,
|
47
50
|
:dummy, :int
|
48
51
|
)
|
49
52
|
end
|
50
53
|
|
51
|
-
class
|
54
|
+
class SysWMmsg_win < FFI::Struct
|
52
55
|
layout(
|
53
|
-
:version,
|
56
|
+
:version, Version.by_value,
|
54
57
|
:subsystem, :int,
|
55
|
-
:msg,
|
58
|
+
:msg, SysWMmsg_value_win.by_value
|
56
59
|
)
|
57
60
|
end
|
58
61
|
|
59
62
|
|
60
|
-
class
|
63
|
+
class SysWMmsg_def_cocoa < FFI::Struct
|
61
64
|
layout(
|
62
65
|
:dummy, :int
|
63
66
|
)
|
64
67
|
end
|
65
68
|
|
66
|
-
class
|
69
|
+
class SysWMmsg_value_cocoa < FFI::Union
|
67
70
|
layout(
|
68
|
-
:cocoa,
|
71
|
+
:cocoa, SysWMmsg_def_cocoa.by_value,
|
69
72
|
:dummy, :int
|
70
73
|
)
|
71
74
|
end
|
72
75
|
|
73
|
-
class
|
76
|
+
class SysWMmsg_cocoa < FFI::Struct
|
74
77
|
layout(
|
75
|
-
:version,
|
78
|
+
:version, Version.by_value,
|
76
79
|
:subsystem, :int,
|
77
|
-
:msg,
|
80
|
+
:msg, SysWMmsg_value_cocoa.by_value
|
78
81
|
)
|
79
82
|
end
|
80
83
|
|
81
84
|
################################################################################
|
82
85
|
|
83
|
-
class
|
86
|
+
class SysWMinfo_def_win < FFI::Struct
|
84
87
|
layout(
|
85
88
|
:window, :pointer,
|
86
89
|
:hdc, :pointer,
|
@@ -88,40 +91,40 @@ module SDL2
|
|
88
91
|
)
|
89
92
|
end
|
90
93
|
|
91
|
-
class
|
94
|
+
class SysWMinfo_value_win < FFI::Union
|
92
95
|
layout(
|
93
|
-
:win,
|
96
|
+
:win, SysWMinfo_def_win.by_value,
|
94
97
|
:dummy, [:uint8, 64]
|
95
98
|
)
|
96
99
|
end
|
97
100
|
|
98
|
-
class
|
101
|
+
class SysWMinfo_win < FFI::Struct
|
99
102
|
layout(
|
100
|
-
:version,
|
103
|
+
:version, Version.by_value,
|
101
104
|
:subsystem, :int,
|
102
|
-
:info,
|
105
|
+
:info, SysWMinfo_value_win.by_value
|
103
106
|
)
|
104
107
|
end
|
105
108
|
|
106
109
|
|
107
|
-
class
|
110
|
+
class SysWMinfo_def_cocoa < FFI::Struct
|
108
111
|
layout(
|
109
112
|
:window, :pointer
|
110
113
|
)
|
111
114
|
end
|
112
115
|
|
113
|
-
class
|
116
|
+
class SysWMinfo_value_cocoa < FFI::Union
|
114
117
|
layout(
|
115
|
-
:cocoa,
|
118
|
+
:cocoa, SysWMinfo_def_cocoa.by_value,
|
116
119
|
:dummy, [:uint8, 64]
|
117
120
|
)
|
118
121
|
end
|
119
122
|
|
120
|
-
class
|
123
|
+
class SysWMinfo_cocoa < FFI::Struct
|
121
124
|
layout(
|
122
|
-
:version,
|
125
|
+
:version, Version.by_value,
|
123
126
|
:subsystem, :int,
|
124
|
-
:info,
|
127
|
+
:info, SysWMinfo_value_cocoa.by_value
|
125
128
|
)
|
126
129
|
end
|
127
130
|
|
@@ -131,10 +134,13 @@ module SDL2
|
|
131
134
|
|
132
135
|
# Function
|
133
136
|
|
134
|
-
def self.setup_syswm_symbols()
|
137
|
+
def self.setup_syswm_symbols(output_error = false)
|
135
138
|
symbols = [
|
136
139
|
:SDL_GetWindowWMInfo,
|
137
140
|
]
|
141
|
+
apis = {
|
142
|
+
:SDL_GetWindowWMInfo => :GetWindowWMInfo,
|
143
|
+
}
|
138
144
|
args = {
|
139
145
|
:SDL_GetWindowWMInfo => [:pointer, :pointer],
|
140
146
|
}
|
@@ -143,9 +149,9 @@ module SDL2
|
|
143
149
|
}
|
144
150
|
symbols.each do |sym|
|
145
151
|
begin
|
146
|
-
attach_function sym, args[sym], retvals[sym]
|
152
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
147
153
|
rescue FFI::NotFoundError => error
|
148
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
154
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
149
155
|
end
|
150
156
|
end
|
151
157
|
end
|
data/lib/sdl2_timer.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
require 'ffi'
|
8
8
|
|
9
|
-
module
|
9
|
+
module SDL
|
10
10
|
extend FFI::Library
|
11
11
|
# Define/Macro
|
12
12
|
|
@@ -24,17 +24,28 @@ module SDL2
|
|
24
24
|
|
25
25
|
# Function
|
26
26
|
|
27
|
-
def self.setup_timer_symbols()
|
27
|
+
def self.setup_timer_symbols(output_error = false)
|
28
28
|
symbols = [
|
29
29
|
:SDL_GetTicks,
|
30
|
+
:SDL_GetTicks64,
|
30
31
|
:SDL_GetPerformanceCounter,
|
31
32
|
:SDL_GetPerformanceFrequency,
|
32
33
|
:SDL_Delay,
|
33
34
|
:SDL_AddTimer,
|
34
35
|
:SDL_RemoveTimer,
|
35
36
|
]
|
37
|
+
apis = {
|
38
|
+
:SDL_GetTicks => :GetTicks,
|
39
|
+
:SDL_GetTicks64 => :GetTicks64,
|
40
|
+
:SDL_GetPerformanceCounter => :GetPerformanceCounter,
|
41
|
+
:SDL_GetPerformanceFrequency => :GetPerformanceFrequency,
|
42
|
+
:SDL_Delay => :Delay,
|
43
|
+
:SDL_AddTimer => :AddTimer,
|
44
|
+
:SDL_RemoveTimer => :RemoveTimer,
|
45
|
+
}
|
36
46
|
args = {
|
37
47
|
:SDL_GetTicks => [],
|
48
|
+
:SDL_GetTicks64 => [],
|
38
49
|
:SDL_GetPerformanceCounter => [],
|
39
50
|
:SDL_GetPerformanceFrequency => [],
|
40
51
|
:SDL_Delay => [:uint],
|
@@ -43,6 +54,7 @@ module SDL2
|
|
43
54
|
}
|
44
55
|
retvals = {
|
45
56
|
:SDL_GetTicks => :uint,
|
57
|
+
:SDL_GetTicks64 => :ulong_long,
|
46
58
|
:SDL_GetPerformanceCounter => :ulong_long,
|
47
59
|
:SDL_GetPerformanceFrequency => :ulong_long,
|
48
60
|
:SDL_Delay => :void,
|
@@ -51,9 +63,9 @@ module SDL2
|
|
51
63
|
}
|
52
64
|
symbols.each do |sym|
|
53
65
|
begin
|
54
|
-
attach_function sym, args[sym], retvals[sym]
|
66
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
55
67
|
rescue FFI::NotFoundError => error
|
56
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
68
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
57
69
|
end
|
58
70
|
end
|
59
71
|
end
|
data/lib/sdl2_touch.rb
CHANGED
@@ -6,17 +6,19 @@
|
|
6
6
|
|
7
7
|
require 'ffi'
|
8
8
|
|
9
|
-
module
|
9
|
+
module SDL
|
10
10
|
extend FFI::Library
|
11
11
|
# Define/Macro
|
12
12
|
|
13
|
+
TOUCH_MOUSEID = -1
|
14
|
+
MOUSE_TOUCHID = -1
|
13
15
|
|
14
16
|
# Enum
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
TOUCH_DEVICE_INVALID = -1
|
19
|
+
TOUCH_DEVICE_DIRECT = 0
|
20
|
+
TOUCH_DEVICE_INDIRECT_ABSOLUTE = 1
|
21
|
+
TOUCH_DEVICE_INDIRECT_RELATIVE = 2
|
20
22
|
|
21
23
|
# Typedef
|
22
24
|
|
@@ -26,7 +28,7 @@ module SDL2
|
|
26
28
|
|
27
29
|
# Struct
|
28
30
|
|
29
|
-
class
|
31
|
+
class Finger < FFI::Struct
|
30
32
|
layout(
|
31
33
|
:id, :long_long,
|
32
34
|
:x, :float,
|
@@ -38,7 +40,7 @@ module SDL2
|
|
38
40
|
|
39
41
|
# Function
|
40
42
|
|
41
|
-
def self.setup_touch_symbols()
|
43
|
+
def self.setup_touch_symbols(output_error = false)
|
42
44
|
symbols = [
|
43
45
|
:SDL_GetNumTouchDevices,
|
44
46
|
:SDL_GetTouchDevice,
|
@@ -46,6 +48,13 @@ module SDL2
|
|
46
48
|
:SDL_GetNumTouchFingers,
|
47
49
|
:SDL_GetTouchFinger,
|
48
50
|
]
|
51
|
+
apis = {
|
52
|
+
:SDL_GetNumTouchDevices => :GetNumTouchDevices,
|
53
|
+
:SDL_GetTouchDevice => :GetTouchDevice,
|
54
|
+
:SDL_GetTouchDeviceType => :GetTouchDeviceType,
|
55
|
+
:SDL_GetNumTouchFingers => :GetNumTouchFingers,
|
56
|
+
:SDL_GetTouchFinger => :GetTouchFinger,
|
57
|
+
}
|
49
58
|
args = {
|
50
59
|
:SDL_GetNumTouchDevices => [],
|
51
60
|
:SDL_GetTouchDevice => [:int],
|
@@ -62,9 +71,9 @@ module SDL2
|
|
62
71
|
}
|
63
72
|
symbols.each do |sym|
|
64
73
|
begin
|
65
|
-
attach_function sym, args[sym], retvals[sym]
|
74
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
66
75
|
rescue FFI::NotFoundError => error
|
67
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
76
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
68
77
|
end
|
69
78
|
end
|
70
79
|
end
|
data/lib/sdl2_ttf.rb
CHANGED
@@ -7,16 +7,13 @@
|
|
7
7
|
require 'ffi'
|
8
8
|
require_relative 'sdl2_pixels'
|
9
9
|
|
10
|
-
module
|
10
|
+
module SDL
|
11
11
|
extend FFI::Library
|
12
12
|
# Define/Macro
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
TTF_MAJOR_VERSION = SDL_TTF_MAJOR_VERSION
|
18
|
-
TTF_MINOR_VERSION = SDL_TTF_MINOR_VERSION
|
19
|
-
TTF_PATCHLEVEL = SDL_TTF_PATCHLEVEL
|
14
|
+
TTF_MAJOR_VERSION = 2
|
15
|
+
TTF_MINOR_VERSION = 0
|
16
|
+
TTF_PATCHLEVEL = 15
|
20
17
|
TTF_STYLE_NORMAL = 0x00
|
21
18
|
TTF_STYLE_BOLD = 0x01
|
22
19
|
TTF_STYLE_ITALIC = 0x02
|
@@ -38,15 +35,23 @@ module SDL2
|
|
38
35
|
|
39
36
|
# Function
|
40
37
|
|
41
|
-
def self.setup_ttf_symbols()
|
38
|
+
def self.setup_ttf_symbols(output_error = false)
|
42
39
|
symbols = [
|
43
40
|
:TTF_Linked_Version,
|
41
|
+
:TTF_GetFreeTypeVersion,
|
42
|
+
:TTF_GetHarfBuzzVersion,
|
44
43
|
:TTF_ByteSwappedUNICODE,
|
45
44
|
:TTF_Init,
|
46
45
|
:TTF_OpenFont,
|
47
46
|
:TTF_OpenFontIndex,
|
48
47
|
:TTF_OpenFontRW,
|
49
48
|
:TTF_OpenFontIndexRW,
|
49
|
+
:TTF_OpenFontDPI,
|
50
|
+
:TTF_OpenFontIndexDPI,
|
51
|
+
:TTF_OpenFontDPIRW,
|
52
|
+
:TTF_OpenFontIndexDPIRW,
|
53
|
+
:TTF_SetFontSize,
|
54
|
+
:TTF_SetFontSizeDPI,
|
50
55
|
:TTF_GetFontStyle,
|
51
56
|
:TTF_SetFontStyle,
|
52
57
|
:TTF_GetFontOutline,
|
@@ -64,18 +69,31 @@ module SDL2
|
|
64
69
|
:TTF_FontFaceFamilyName,
|
65
70
|
:TTF_FontFaceStyleName,
|
66
71
|
:TTF_GlyphIsProvided,
|
72
|
+
:TTF_GlyphIsProvided32,
|
67
73
|
:TTF_GlyphMetrics,
|
74
|
+
:TTF_GlyphMetrics32,
|
68
75
|
:TTF_SizeText,
|
69
76
|
:TTF_SizeUTF8,
|
70
77
|
:TTF_SizeUNICODE,
|
78
|
+
:TTF_MeasureText,
|
79
|
+
:TTF_MeasureUTF8,
|
80
|
+
:TTF_MeasureUNICODE,
|
71
81
|
:TTF_RenderText_Solid,
|
72
82
|
:TTF_RenderUTF8_Solid,
|
73
83
|
:TTF_RenderUNICODE_Solid,
|
84
|
+
:TTF_RenderText_Solid_Wrapped,
|
85
|
+
:TTF_RenderUTF8_Solid_Wrapped,
|
86
|
+
:TTF_RenderUNICODE_Solid_Wrapped,
|
74
87
|
:TTF_RenderGlyph_Solid,
|
88
|
+
:TTF_RenderGlyph32_Solid,
|
75
89
|
:TTF_RenderText_Shaded,
|
76
90
|
:TTF_RenderUTF8_Shaded,
|
77
91
|
:TTF_RenderUNICODE_Shaded,
|
92
|
+
:TTF_RenderText_Shaded_Wrapped,
|
93
|
+
:TTF_RenderUTF8_Shaded_Wrapped,
|
94
|
+
:TTF_RenderUNICODE_Shaded_Wrapped,
|
78
95
|
:TTF_RenderGlyph_Shaded,
|
96
|
+
:TTF_RenderGlyph32_Shaded,
|
79
97
|
:TTF_RenderText_Blended,
|
80
98
|
:TTF_RenderUTF8_Blended,
|
81
99
|
:TTF_RenderUNICODE_Blended,
|
@@ -83,20 +101,111 @@ module SDL2
|
|
83
101
|
:TTF_RenderUTF8_Blended_Wrapped,
|
84
102
|
:TTF_RenderUNICODE_Blended_Wrapped,
|
85
103
|
:TTF_RenderGlyph_Blended,
|
104
|
+
:TTF_RenderGlyph32_Blended,
|
105
|
+
:TTF_SetDirection,
|
106
|
+
:TTF_SetScript,
|
86
107
|
:TTF_CloseFont,
|
87
108
|
:TTF_Quit,
|
88
109
|
:TTF_WasInit,
|
89
110
|
:TTF_GetFontKerningSize,
|
90
111
|
:TTF_GetFontKerningSizeGlyphs,
|
112
|
+
:TTF_GetFontKerningSizeGlyphs32,
|
113
|
+
:TTF_SetFontSDF,
|
114
|
+
:TTF_GetFontSDF,
|
91
115
|
]
|
116
|
+
apis = {
|
117
|
+
:TTF_Linked_Version => :TTF_Linked_Version,
|
118
|
+
:TTF_GetFreeTypeVersion => :TTF_GetFreeTypeVersion,
|
119
|
+
:TTF_GetHarfBuzzVersion => :TTF_GetHarfBuzzVersion,
|
120
|
+
:TTF_ByteSwappedUNICODE => :TTF_ByteSwappedUNICODE,
|
121
|
+
:TTF_Init => :TTF_Init,
|
122
|
+
:TTF_OpenFont => :TTF_OpenFont,
|
123
|
+
:TTF_OpenFontIndex => :TTF_OpenFontIndex,
|
124
|
+
:TTF_OpenFontRW => :TTF_OpenFontRW,
|
125
|
+
:TTF_OpenFontIndexRW => :TTF_OpenFontIndexRW,
|
126
|
+
:TTF_OpenFontDPI => :TTF_OpenFontDPI,
|
127
|
+
:TTF_OpenFontIndexDPI => :TTF_OpenFontIndexDPI,
|
128
|
+
:TTF_OpenFontDPIRW => :TTF_OpenFontDPIRW,
|
129
|
+
:TTF_OpenFontIndexDPIRW => :TTF_OpenFontIndexDPIRW,
|
130
|
+
:TTF_SetFontSize => :TTF_SetFontSize,
|
131
|
+
:TTF_SetFontSizeDPI => :TTF_SetFontSizeDPI,
|
132
|
+
:TTF_GetFontStyle => :TTF_GetFontStyle,
|
133
|
+
:TTF_SetFontStyle => :TTF_SetFontStyle,
|
134
|
+
:TTF_GetFontOutline => :TTF_GetFontOutline,
|
135
|
+
:TTF_SetFontOutline => :TTF_SetFontOutline,
|
136
|
+
:TTF_GetFontHinting => :TTF_GetFontHinting,
|
137
|
+
:TTF_SetFontHinting => :TTF_SetFontHinting,
|
138
|
+
:TTF_FontHeight => :TTF_FontHeight,
|
139
|
+
:TTF_FontAscent => :TTF_FontAscent,
|
140
|
+
:TTF_FontDescent => :TTF_FontDescent,
|
141
|
+
:TTF_FontLineSkip => :TTF_FontLineSkip,
|
142
|
+
:TTF_GetFontKerning => :TTF_GetFontKerning,
|
143
|
+
:TTF_SetFontKerning => :TTF_SetFontKerning,
|
144
|
+
:TTF_FontFaces => :TTF_FontFaces,
|
145
|
+
:TTF_FontFaceIsFixedWidth => :TTF_FontFaceIsFixedWidth,
|
146
|
+
:TTF_FontFaceFamilyName => :TTF_FontFaceFamilyName,
|
147
|
+
:TTF_FontFaceStyleName => :TTF_FontFaceStyleName,
|
148
|
+
:TTF_GlyphIsProvided => :TTF_GlyphIsProvided,
|
149
|
+
:TTF_GlyphIsProvided32 => :TTF_GlyphIsProvided32,
|
150
|
+
:TTF_GlyphMetrics => :TTF_GlyphMetrics,
|
151
|
+
:TTF_GlyphMetrics32 => :TTF_GlyphMetrics32,
|
152
|
+
:TTF_SizeText => :TTF_SizeText,
|
153
|
+
:TTF_SizeUTF8 => :TTF_SizeUTF8,
|
154
|
+
:TTF_SizeUNICODE => :TTF_SizeUNICODE,
|
155
|
+
:TTF_MeasureText => :TTF_MeasureText,
|
156
|
+
:TTF_MeasureUTF8 => :TTF_MeasureUTF8,
|
157
|
+
:TTF_MeasureUNICODE => :TTF_MeasureUNICODE,
|
158
|
+
:TTF_RenderText_Solid => :TTF_RenderText_Solid,
|
159
|
+
:TTF_RenderUTF8_Solid => :TTF_RenderUTF8_Solid,
|
160
|
+
:TTF_RenderUNICODE_Solid => :TTF_RenderUNICODE_Solid,
|
161
|
+
:TTF_RenderText_Solid_Wrapped => :TTF_RenderText_Solid_Wrapped,
|
162
|
+
:TTF_RenderUTF8_Solid_Wrapped => :TTF_RenderUTF8_Solid_Wrapped,
|
163
|
+
:TTF_RenderUNICODE_Solid_Wrapped => :TTF_RenderUNICODE_Solid_Wrapped,
|
164
|
+
:TTF_RenderGlyph_Solid => :TTF_RenderGlyph_Solid,
|
165
|
+
:TTF_RenderGlyph32_Solid => :TTF_RenderGlyph32_Solid,
|
166
|
+
:TTF_RenderText_Shaded => :TTF_RenderText_Shaded,
|
167
|
+
:TTF_RenderUTF8_Shaded => :TTF_RenderUTF8_Shaded,
|
168
|
+
:TTF_RenderUNICODE_Shaded => :TTF_RenderUNICODE_Shaded,
|
169
|
+
:TTF_RenderText_Shaded_Wrapped => :TTF_RenderText_Shaded_Wrapped,
|
170
|
+
:TTF_RenderUTF8_Shaded_Wrapped => :TTF_RenderUTF8_Shaded_Wrapped,
|
171
|
+
:TTF_RenderUNICODE_Shaded_Wrapped => :TTF_RenderUNICODE_Shaded_Wrapped,
|
172
|
+
:TTF_RenderGlyph_Shaded => :TTF_RenderGlyph_Shaded,
|
173
|
+
:TTF_RenderGlyph32_Shaded => :TTF_RenderGlyph32_Shaded,
|
174
|
+
:TTF_RenderText_Blended => :TTF_RenderText_Blended,
|
175
|
+
:TTF_RenderUTF8_Blended => :TTF_RenderUTF8_Blended,
|
176
|
+
:TTF_RenderUNICODE_Blended => :TTF_RenderUNICODE_Blended,
|
177
|
+
:TTF_RenderText_Blended_Wrapped => :TTF_RenderText_Blended_Wrapped,
|
178
|
+
:TTF_RenderUTF8_Blended_Wrapped => :TTF_RenderUTF8_Blended_Wrapped,
|
179
|
+
:TTF_RenderUNICODE_Blended_Wrapped => :TTF_RenderUNICODE_Blended_Wrapped,
|
180
|
+
:TTF_RenderGlyph_Blended => :TTF_RenderGlyph_Blended,
|
181
|
+
:TTF_RenderGlyph32_Blended => :TTF_RenderGlyph32_Blended,
|
182
|
+
:TTF_SetDirection => :TTF_SetDirection,
|
183
|
+
:TTF_SetScript => :TTF_SetScript,
|
184
|
+
:TTF_CloseFont => :TTF_CloseFont,
|
185
|
+
:TTF_Quit => :TTF_Quit,
|
186
|
+
:TTF_WasInit => :TTF_WasInit,
|
187
|
+
:TTF_GetFontKerningSize => :TTF_GetFontKerningSize,
|
188
|
+
:TTF_GetFontKerningSizeGlyphs => :TTF_GetFontKerningSizeGlyphs,
|
189
|
+
:TTF_GetFontKerningSizeGlyphs32 => :TTF_GetFontKerningSizeGlyphs32,
|
190
|
+
:TTF_SetFontSDF => :TTF_SetFontSDF,
|
191
|
+
:TTF_GetFontSDF => :TTF_GetFontSDF,
|
192
|
+
}
|
92
193
|
args = {
|
93
194
|
:TTF_Linked_Version => [],
|
195
|
+
:TTF_GetFreeTypeVersion => [:pointer, :pointer, :pointer],
|
196
|
+
:TTF_GetHarfBuzzVersion => [:pointer, :pointer, :pointer],
|
94
197
|
:TTF_ByteSwappedUNICODE => [:int],
|
95
198
|
:TTF_Init => [],
|
96
199
|
:TTF_OpenFont => [:pointer, :int],
|
97
200
|
:TTF_OpenFontIndex => [:pointer, :int, :long],
|
98
201
|
:TTF_OpenFontRW => [:pointer, :int, :int],
|
99
202
|
:TTF_OpenFontIndexRW => [:pointer, :int, :int, :long],
|
203
|
+
:TTF_OpenFontDPI => [:pointer, :int, :uint, :uint],
|
204
|
+
:TTF_OpenFontIndexDPI => [:pointer, :int, :long, :uint, :uint],
|
205
|
+
:TTF_OpenFontDPIRW => [:pointer, :int, :int, :uint, :uint],
|
206
|
+
:TTF_OpenFontIndexDPIRW => [:pointer, :int, :int, :long, :uint, :uint],
|
207
|
+
:TTF_SetFontSize => [:pointer, :int],
|
208
|
+
:TTF_SetFontSizeDPI => [:pointer, :int, :uint, :uint],
|
100
209
|
:TTF_GetFontStyle => [:pointer],
|
101
210
|
:TTF_SetFontStyle => [:pointer, :int],
|
102
211
|
:TTF_GetFontOutline => [:pointer],
|
@@ -114,39 +223,66 @@ module SDL2
|
|
114
223
|
:TTF_FontFaceFamilyName => [:pointer],
|
115
224
|
:TTF_FontFaceStyleName => [:pointer],
|
116
225
|
:TTF_GlyphIsProvided => [:pointer, :ushort],
|
226
|
+
:TTF_GlyphIsProvided32 => [:pointer, :uint],
|
117
227
|
:TTF_GlyphMetrics => [:pointer, :ushort, :pointer, :pointer, :pointer, :pointer, :pointer],
|
228
|
+
:TTF_GlyphMetrics32 => [:pointer, :uint, :pointer, :pointer, :pointer, :pointer, :pointer],
|
118
229
|
:TTF_SizeText => [:pointer, :pointer, :pointer, :pointer],
|
119
230
|
:TTF_SizeUTF8 => [:pointer, :pointer, :pointer, :pointer],
|
120
231
|
:TTF_SizeUNICODE => [:pointer, :pointer, :pointer, :pointer],
|
121
|
-
:
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
125
|
-
:
|
126
|
-
:
|
127
|
-
:
|
128
|
-
:
|
129
|
-
:
|
130
|
-
:
|
131
|
-
:
|
132
|
-
:
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
232
|
+
:TTF_MeasureText => [:pointer, :pointer, :int, :pointer, :pointer],
|
233
|
+
:TTF_MeasureUTF8 => [:pointer, :pointer, :int, :pointer, :pointer],
|
234
|
+
:TTF_MeasureUNICODE => [:pointer, :pointer, :int, :pointer, :pointer],
|
235
|
+
:TTF_RenderText_Solid => [:pointer, :pointer, Color.by_value],
|
236
|
+
:TTF_RenderUTF8_Solid => [:pointer, :pointer, Color.by_value],
|
237
|
+
:TTF_RenderUNICODE_Solid => [:pointer, :pointer, Color.by_value],
|
238
|
+
:TTF_RenderText_Solid_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
|
239
|
+
:TTF_RenderUTF8_Solid_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
|
240
|
+
:TTF_RenderUNICODE_Solid_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
|
241
|
+
:TTF_RenderGlyph_Solid => [:pointer, :ushort, Color.by_value],
|
242
|
+
:TTF_RenderGlyph32_Solid => [:pointer, :uint, Color.by_value],
|
243
|
+
:TTF_RenderText_Shaded => [:pointer, :pointer, Color.by_value, Color.by_value],
|
244
|
+
:TTF_RenderUTF8_Shaded => [:pointer, :pointer, Color.by_value, Color.by_value],
|
245
|
+
:TTF_RenderUNICODE_Shaded => [:pointer, :pointer, Color.by_value, Color.by_value],
|
246
|
+
:TTF_RenderText_Shaded_Wrapped => [:pointer, :pointer, Color.by_value, Color.by_value, :uint],
|
247
|
+
:TTF_RenderUTF8_Shaded_Wrapped => [:pointer, :pointer, Color.by_value, Color.by_value, :uint],
|
248
|
+
:TTF_RenderUNICODE_Shaded_Wrapped => [:pointer, :pointer, Color.by_value, Color.by_value, :uint],
|
249
|
+
:TTF_RenderGlyph_Shaded => [:pointer, :ushort, Color.by_value, Color.by_value],
|
250
|
+
:TTF_RenderGlyph32_Shaded => [:pointer, :uint, Color.by_value, Color.by_value],
|
251
|
+
:TTF_RenderText_Blended => [:pointer, :pointer, Color.by_value],
|
252
|
+
:TTF_RenderUTF8_Blended => [:pointer, :pointer, Color.by_value],
|
253
|
+
:TTF_RenderUNICODE_Blended => [:pointer, :pointer, Color.by_value],
|
254
|
+
:TTF_RenderText_Blended_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
|
255
|
+
:TTF_RenderUTF8_Blended_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
|
256
|
+
:TTF_RenderUNICODE_Blended_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
|
257
|
+
:TTF_RenderGlyph_Blended => [:pointer, :ushort, Color.by_value],
|
258
|
+
:TTF_RenderGlyph32_Blended => [:pointer, :uint, Color.by_value],
|
259
|
+
:TTF_SetDirection => [:int],
|
260
|
+
:TTF_SetScript => [:int],
|
136
261
|
:TTF_CloseFont => [:pointer],
|
137
262
|
:TTF_Quit => [],
|
138
263
|
:TTF_WasInit => [],
|
139
264
|
:TTF_GetFontKerningSize => [:pointer, :int, :int],
|
140
265
|
:TTF_GetFontKerningSizeGlyphs => [:pointer, :ushort, :ushort],
|
266
|
+
:TTF_GetFontKerningSizeGlyphs32 => [:pointer, :uint, :uint],
|
267
|
+
:TTF_SetFontSDF => [:pointer, :int],
|
268
|
+
:TTF_GetFontSDF => [:pointer],
|
141
269
|
}
|
142
270
|
retvals = {
|
143
271
|
:TTF_Linked_Version => :pointer,
|
272
|
+
:TTF_GetFreeTypeVersion => :void,
|
273
|
+
:TTF_GetHarfBuzzVersion => :void,
|
144
274
|
:TTF_ByteSwappedUNICODE => :void,
|
145
275
|
:TTF_Init => :int,
|
146
276
|
:TTF_OpenFont => :pointer,
|
147
277
|
:TTF_OpenFontIndex => :pointer,
|
148
278
|
:TTF_OpenFontRW => :pointer,
|
149
279
|
:TTF_OpenFontIndexRW => :pointer,
|
280
|
+
:TTF_OpenFontDPI => :pointer,
|
281
|
+
:TTF_OpenFontIndexDPI => :pointer,
|
282
|
+
:TTF_OpenFontDPIRW => :pointer,
|
283
|
+
:TTF_OpenFontIndexDPIRW => :pointer,
|
284
|
+
:TTF_SetFontSize => :int,
|
285
|
+
:TTF_SetFontSizeDPI => :int,
|
150
286
|
:TTF_GetFontStyle => :int,
|
151
287
|
:TTF_SetFontStyle => :void,
|
152
288
|
:TTF_GetFontOutline => :int,
|
@@ -164,18 +300,31 @@ module SDL2
|
|
164
300
|
:TTF_FontFaceFamilyName => :pointer,
|
165
301
|
:TTF_FontFaceStyleName => :pointer,
|
166
302
|
:TTF_GlyphIsProvided => :int,
|
303
|
+
:TTF_GlyphIsProvided32 => :int,
|
167
304
|
:TTF_GlyphMetrics => :int,
|
305
|
+
:TTF_GlyphMetrics32 => :int,
|
168
306
|
:TTF_SizeText => :int,
|
169
307
|
:TTF_SizeUTF8 => :int,
|
170
308
|
:TTF_SizeUNICODE => :int,
|
309
|
+
:TTF_MeasureText => :int,
|
310
|
+
:TTF_MeasureUTF8 => :int,
|
311
|
+
:TTF_MeasureUNICODE => :int,
|
171
312
|
:TTF_RenderText_Solid => :pointer,
|
172
313
|
:TTF_RenderUTF8_Solid => :pointer,
|
173
314
|
:TTF_RenderUNICODE_Solid => :pointer,
|
315
|
+
:TTF_RenderText_Solid_Wrapped => :pointer,
|
316
|
+
:TTF_RenderUTF8_Solid_Wrapped => :pointer,
|
317
|
+
:TTF_RenderUNICODE_Solid_Wrapped => :pointer,
|
174
318
|
:TTF_RenderGlyph_Solid => :pointer,
|
319
|
+
:TTF_RenderGlyph32_Solid => :pointer,
|
175
320
|
:TTF_RenderText_Shaded => :pointer,
|
176
321
|
:TTF_RenderUTF8_Shaded => :pointer,
|
177
322
|
:TTF_RenderUNICODE_Shaded => :pointer,
|
323
|
+
:TTF_RenderText_Shaded_Wrapped => :pointer,
|
324
|
+
:TTF_RenderUTF8_Shaded_Wrapped => :pointer,
|
325
|
+
:TTF_RenderUNICODE_Shaded_Wrapped => :pointer,
|
178
326
|
:TTF_RenderGlyph_Shaded => :pointer,
|
327
|
+
:TTF_RenderGlyph32_Shaded => :pointer,
|
179
328
|
:TTF_RenderText_Blended => :pointer,
|
180
329
|
:TTF_RenderUTF8_Blended => :pointer,
|
181
330
|
:TTF_RenderUNICODE_Blended => :pointer,
|
@@ -183,17 +332,23 @@ module SDL2
|
|
183
332
|
:TTF_RenderUTF8_Blended_Wrapped => :pointer,
|
184
333
|
:TTF_RenderUNICODE_Blended_Wrapped => :pointer,
|
185
334
|
:TTF_RenderGlyph_Blended => :pointer,
|
335
|
+
:TTF_RenderGlyph32_Blended => :pointer,
|
336
|
+
:TTF_SetDirection => :int,
|
337
|
+
:TTF_SetScript => :int,
|
186
338
|
:TTF_CloseFont => :void,
|
187
339
|
:TTF_Quit => :void,
|
188
340
|
:TTF_WasInit => :int,
|
189
341
|
:TTF_GetFontKerningSize => :int,
|
190
342
|
:TTF_GetFontKerningSizeGlyphs => :int,
|
343
|
+
:TTF_GetFontKerningSizeGlyphs32 => :int,
|
344
|
+
:TTF_SetFontSDF => :int,
|
345
|
+
:TTF_GetFontSDF => :int,
|
191
346
|
}
|
192
347
|
symbols.each do |sym|
|
193
348
|
begin
|
194
|
-
attach_function sym, args[sym], retvals[sym]
|
349
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
195
350
|
rescue FFI::NotFoundError => error
|
196
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
351
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
197
352
|
end
|
198
353
|
end
|
199
354
|
end
|