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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +83 -79
  3. data/LICENSE.txt +1 -1
  4. data/README.md +49 -49
  5. data/lib/sdl2.rb +170 -170
  6. data/lib/sdl2_audio.rb +219 -201
  7. data/lib/sdl2_blendmode.rb +69 -69
  8. data/lib/sdl2_clipboard.rb +51 -51
  9. data/lib/sdl2_cpuinfo.rb +106 -106
  10. data/lib/sdl2_error.rb +64 -64
  11. data/lib/sdl2_events.rb +530 -530
  12. data/lib/sdl2_filesystem.rb +48 -48
  13. data/lib/sdl2_framerate.rb +67 -67
  14. data/lib/sdl2_gamecontroller.rb +254 -254
  15. data/lib/sdl2_gesture.rb +55 -55
  16. data/lib/sdl2_gfxPrimitives.rb +222 -222
  17. data/lib/sdl2_haptic.rb +269 -269
  18. data/lib/sdl2_hints.rb +174 -174
  19. data/lib/sdl2_image.rb +185 -185
  20. data/lib/sdl2_imageFilter.rb +132 -132
  21. data/lib/sdl2_joystick.rb +230 -230
  22. data/lib/sdl2_keyboard.rb +99 -99
  23. data/lib/sdl2_keycode.rb +304 -304
  24. data/lib/sdl2_log.rb +115 -115
  25. data/lib/sdl2_main.rb +67 -67
  26. data/lib/sdl2_messagebox.rb +98 -98
  27. data/lib/sdl2_mixer.rb +317 -307
  28. data/lib/sdl2_mouse.rb +117 -117
  29. data/lib/sdl2_pixels.rb +224 -224
  30. data/lib/sdl2_platform.rb +45 -45
  31. data/lib/sdl2_power.rb +51 -51
  32. data/lib/sdl2_rect.rb +102 -102
  33. data/lib/sdl2_render.rb +290 -290
  34. data/lib/sdl2_rotozoom.rb +66 -66
  35. data/lib/sdl2_rwops.rb +208 -208
  36. data/lib/sdl2_scancode.rb +287 -287
  37. data/lib/sdl2_shape.rb +77 -77
  38. data/lib/sdl2_stdinc.rb +393 -393
  39. data/lib/sdl2_surface.rb +182 -182
  40. data/lib/sdl2_syswm.rb +154 -154
  41. data/lib/sdl2_timer.rb +62 -62
  42. data/lib/sdl2_touch.rb +73 -73
  43. data/lib/sdl2_ttf.rb +202 -190
  44. data/lib/sdl2_version.rb +62 -62
  45. data/lib/sdl2_video.rb +411 -411
  46. data/lib/sdl2_vulkan.rb +64 -64
  47. metadata +6 -6
data/lib/sdl2_timer.rb CHANGED
@@ -1,62 +1,62 @@
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
-
17
- # Typedef
18
-
19
- callback :SDL_TimerCallback, [:uint, :pointer], :uint
20
- typedef :int, :SDL_TimerID
21
-
22
- # Struct
23
-
24
-
25
- # Function
26
-
27
- def self.setup_timer_symbols()
28
- symbols = [
29
- :SDL_GetTicks,
30
- :SDL_GetPerformanceCounter,
31
- :SDL_GetPerformanceFrequency,
32
- :SDL_Delay,
33
- :SDL_AddTimer,
34
- :SDL_RemoveTimer,
35
- ]
36
- args = {
37
- :SDL_GetTicks => [],
38
- :SDL_GetPerformanceCounter => [],
39
- :SDL_GetPerformanceFrequency => [],
40
- :SDL_Delay => [:uint],
41
- :SDL_AddTimer => [:uint, :SDL_TimerCallback, :pointer],
42
- :SDL_RemoveTimer => [:int],
43
- }
44
- retvals = {
45
- :SDL_GetTicks => :uint,
46
- :SDL_GetPerformanceCounter => :ulong_long,
47
- :SDL_GetPerformanceFrequency => :ulong_long,
48
- :SDL_Delay => :void,
49
- :SDL_AddTimer => :int,
50
- :SDL_RemoveTimer => :int,
51
- }
52
- symbols.each do |sym|
53
- begin
54
- attach_function sym, args[sym], retvals[sym]
55
- rescue FFI::NotFoundError => error
56
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
57
- end
58
- end
59
- end
60
-
61
- end
62
-
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
+
17
+ # Typedef
18
+
19
+ callback :SDL_TimerCallback, [:uint, :pointer], :uint
20
+ typedef :int, :SDL_TimerID
21
+
22
+ # Struct
23
+
24
+
25
+ # Function
26
+
27
+ def self.setup_timer_symbols()
28
+ symbols = [
29
+ :SDL_GetTicks,
30
+ :SDL_GetPerformanceCounter,
31
+ :SDL_GetPerformanceFrequency,
32
+ :SDL_Delay,
33
+ :SDL_AddTimer,
34
+ :SDL_RemoveTimer,
35
+ ]
36
+ args = {
37
+ :SDL_GetTicks => [],
38
+ :SDL_GetPerformanceCounter => [],
39
+ :SDL_GetPerformanceFrequency => [],
40
+ :SDL_Delay => [:uint],
41
+ :SDL_AddTimer => [:uint, :SDL_TimerCallback, :pointer],
42
+ :SDL_RemoveTimer => [:int],
43
+ }
44
+ retvals = {
45
+ :SDL_GetTicks => :uint,
46
+ :SDL_GetPerformanceCounter => :ulong_long,
47
+ :SDL_GetPerformanceFrequency => :ulong_long,
48
+ :SDL_Delay => :void,
49
+ :SDL_AddTimer => :int,
50
+ :SDL_RemoveTimer => :int,
51
+ }
52
+ symbols.each do |sym|
53
+ begin
54
+ attach_function sym, args[sym], retvals[sym]
55
+ rescue FFI::NotFoundError => error
56
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
57
+ end
58
+ end
59
+ end
60
+
61
+ end
62
+
data/lib/sdl2_touch.rb CHANGED
@@ -1,73 +1,73 @@
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_TOUCH_DEVICE_INVALID = -1
17
- SDL_TOUCH_DEVICE_DIRECT = 0
18
- SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE = 1
19
- SDL_TOUCH_DEVICE_INDIRECT_RELATIVE = 2
20
-
21
- # Typedef
22
-
23
- typedef :long_long, :SDL_TouchID
24
- typedef :long_long, :SDL_FingerID
25
- typedef :int, :SDL_TouchDeviceType
26
-
27
- # Struct
28
-
29
- class SDL_Finger < FFI::Struct
30
- layout(
31
- :id, :long_long,
32
- :x, :float,
33
- :y, :float,
34
- :pressure, :float,
35
- )
36
- end
37
-
38
-
39
- # Function
40
-
41
- def self.setup_touch_symbols()
42
- symbols = [
43
- :SDL_GetNumTouchDevices,
44
- :SDL_GetTouchDevice,
45
- :SDL_GetTouchDeviceType,
46
- :SDL_GetNumTouchFingers,
47
- :SDL_GetTouchFinger,
48
- ]
49
- args = {
50
- :SDL_GetNumTouchDevices => [],
51
- :SDL_GetTouchDevice => [:int],
52
- :SDL_GetTouchDeviceType => [:long_long],
53
- :SDL_GetNumTouchFingers => [:long_long],
54
- :SDL_GetTouchFinger => [:long_long, :int],
55
- }
56
- retvals = {
57
- :SDL_GetNumTouchDevices => :int,
58
- :SDL_GetTouchDevice => :long_long,
59
- :SDL_GetTouchDeviceType => :int,
60
- :SDL_GetNumTouchFingers => :int,
61
- :SDL_GetTouchFinger => :pointer,
62
- }
63
- symbols.each do |sym|
64
- begin
65
- attach_function sym, args[sym], retvals[sym]
66
- rescue FFI::NotFoundError => error
67
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
68
- end
69
- end
70
- end
71
-
72
- end
73
-
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_TOUCH_DEVICE_INVALID = -1
17
+ SDL_TOUCH_DEVICE_DIRECT = 0
18
+ SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE = 1
19
+ SDL_TOUCH_DEVICE_INDIRECT_RELATIVE = 2
20
+
21
+ # Typedef
22
+
23
+ typedef :long_long, :SDL_TouchID
24
+ typedef :long_long, :SDL_FingerID
25
+ typedef :int, :SDL_TouchDeviceType
26
+
27
+ # Struct
28
+
29
+ class SDL_Finger < FFI::Struct
30
+ layout(
31
+ :id, :long_long,
32
+ :x, :float,
33
+ :y, :float,
34
+ :pressure, :float,
35
+ )
36
+ end
37
+
38
+
39
+ # Function
40
+
41
+ def self.setup_touch_symbols()
42
+ symbols = [
43
+ :SDL_GetNumTouchDevices,
44
+ :SDL_GetTouchDevice,
45
+ :SDL_GetTouchDeviceType,
46
+ :SDL_GetNumTouchFingers,
47
+ :SDL_GetTouchFinger,
48
+ ]
49
+ args = {
50
+ :SDL_GetNumTouchDevices => [],
51
+ :SDL_GetTouchDevice => [:int],
52
+ :SDL_GetTouchDeviceType => [:long_long],
53
+ :SDL_GetNumTouchFingers => [:long_long],
54
+ :SDL_GetTouchFinger => [:long_long, :int],
55
+ }
56
+ retvals = {
57
+ :SDL_GetNumTouchDevices => :int,
58
+ :SDL_GetTouchDevice => :long_long,
59
+ :SDL_GetTouchDeviceType => :int,
60
+ :SDL_GetNumTouchFingers => :int,
61
+ :SDL_GetTouchFinger => :pointer,
62
+ }
63
+ symbols.each do |sym|
64
+ begin
65
+ attach_function sym, args[sym], retvals[sym]
66
+ rescue FFI::NotFoundError => error
67
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
68
+ end
69
+ end
70
+ end
71
+
72
+ end
73
+
data/lib/sdl2_ttf.rb CHANGED
@@ -1,190 +1,202 @@
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
- require_relative 'sdl2_pixels'
9
-
10
- module SDL2
11
- extend FFI::Library
12
- # Define/Macro
13
-
14
- SDL_TTF_MAJOR_VERSION = 2
15
- SDL_TTF_MINOR_VERSION = 0
16
- SDL_TTF_PATCHLEVEL = 15
17
-
18
- # Enum
19
-
20
-
21
- # Typedef
22
-
23
-
24
- # Struct
25
-
26
-
27
- # Function
28
-
29
- def self.setup_ttf_symbols()
30
- symbols = [
31
- :TTF_Linked_Version,
32
- :TTF_ByteSwappedUNICODE,
33
- :TTF_Init,
34
- :TTF_OpenFont,
35
- :TTF_OpenFontIndex,
36
- :TTF_OpenFontRW,
37
- :TTF_OpenFontIndexRW,
38
- :TTF_GetFontStyle,
39
- :TTF_SetFontStyle,
40
- :TTF_GetFontOutline,
41
- :TTF_SetFontOutline,
42
- :TTF_GetFontHinting,
43
- :TTF_SetFontHinting,
44
- :TTF_FontHeight,
45
- :TTF_FontAscent,
46
- :TTF_FontDescent,
47
- :TTF_FontLineSkip,
48
- :TTF_GetFontKerning,
49
- :TTF_SetFontKerning,
50
- :TTF_FontFaces,
51
- :TTF_FontFaceIsFixedWidth,
52
- :TTF_FontFaceFamilyName,
53
- :TTF_FontFaceStyleName,
54
- :TTF_GlyphIsProvided,
55
- :TTF_GlyphMetrics,
56
- :TTF_SizeText,
57
- :TTF_SizeUTF8,
58
- :TTF_SizeUNICODE,
59
- :TTF_RenderText_Solid,
60
- :TTF_RenderUTF8_Solid,
61
- :TTF_RenderUNICODE_Solid,
62
- :TTF_RenderGlyph_Solid,
63
- :TTF_RenderText_Shaded,
64
- :TTF_RenderUTF8_Shaded,
65
- :TTF_RenderUNICODE_Shaded,
66
- :TTF_RenderGlyph_Shaded,
67
- :TTF_RenderText_Blended,
68
- :TTF_RenderUTF8_Blended,
69
- :TTF_RenderUNICODE_Blended,
70
- :TTF_RenderText_Blended_Wrapped,
71
- :TTF_RenderUTF8_Blended_Wrapped,
72
- :TTF_RenderUNICODE_Blended_Wrapped,
73
- :TTF_RenderGlyph_Blended,
74
- :TTF_CloseFont,
75
- :TTF_Quit,
76
- :TTF_WasInit,
77
- :TTF_GetFontKerningSize,
78
- :TTF_GetFontKerningSizeGlyphs,
79
- ]
80
- args = {
81
- :TTF_Linked_Version => [],
82
- :TTF_ByteSwappedUNICODE => [:int],
83
- :TTF_Init => [],
84
- :TTF_OpenFont => [:pointer, :int],
85
- :TTF_OpenFontIndex => [:pointer, :int, :long],
86
- :TTF_OpenFontRW => [:pointer, :int, :int],
87
- :TTF_OpenFontIndexRW => [:pointer, :int, :int, :long],
88
- :TTF_GetFontStyle => [:pointer],
89
- :TTF_SetFontStyle => [:pointer, :int],
90
- :TTF_GetFontOutline => [:pointer],
91
- :TTF_SetFontOutline => [:pointer, :int],
92
- :TTF_GetFontHinting => [:pointer],
93
- :TTF_SetFontHinting => [:pointer, :int],
94
- :TTF_FontHeight => [:pointer],
95
- :TTF_FontAscent => [:pointer],
96
- :TTF_FontDescent => [:pointer],
97
- :TTF_FontLineSkip => [:pointer],
98
- :TTF_GetFontKerning => [:pointer],
99
- :TTF_SetFontKerning => [:pointer, :int],
100
- :TTF_FontFaces => [:pointer],
101
- :TTF_FontFaceIsFixedWidth => [:pointer],
102
- :TTF_FontFaceFamilyName => [:pointer],
103
- :TTF_FontFaceStyleName => [:pointer],
104
- :TTF_GlyphIsProvided => [:pointer, :ushort],
105
- :TTF_GlyphMetrics => [:pointer, :ushort, :pointer, :pointer, :pointer, :pointer, :pointer],
106
- :TTF_SizeText => [:pointer, :pointer, :pointer, :pointer],
107
- :TTF_SizeUTF8 => [:pointer, :pointer, :pointer, :pointer],
108
- :TTF_SizeUNICODE => [:pointer, :pointer, :pointer, :pointer],
109
- :TTF_RenderText_Solid => [:pointer, :pointer, SDL_Color],
110
- :TTF_RenderUTF8_Solid => [:pointer, :pointer, SDL_Color],
111
- :TTF_RenderUNICODE_Solid => [:pointer, :pointer, SDL_Color],
112
- :TTF_RenderGlyph_Solid => [:pointer, :ushort, SDL_Color],
113
- :TTF_RenderText_Shaded => [:pointer, :pointer, SDL_Color, SDL_Color],
114
- :TTF_RenderUTF8_Shaded => [:pointer, :pointer, SDL_Color, SDL_Color],
115
- :TTF_RenderUNICODE_Shaded => [:pointer, :pointer, SDL_Color, SDL_Color],
116
- :TTF_RenderGlyph_Shaded => [:pointer, :ushort, SDL_Color, SDL_Color],
117
- :TTF_RenderText_Blended => [:pointer, :pointer, SDL_Color],
118
- :TTF_RenderUTF8_Blended => [:pointer, :pointer, SDL_Color],
119
- :TTF_RenderUNICODE_Blended => [:pointer, :pointer, SDL_Color],
120
- :TTF_RenderText_Blended_Wrapped => [:pointer, :pointer, SDL_Color, :uint],
121
- :TTF_RenderUTF8_Blended_Wrapped => [:pointer, :pointer, SDL_Color, :uint],
122
- :TTF_RenderUNICODE_Blended_Wrapped => [:pointer, :pointer, SDL_Color, :uint],
123
- :TTF_RenderGlyph_Blended => [:pointer, :ushort, SDL_Color],
124
- :TTF_CloseFont => [:pointer],
125
- :TTF_Quit => [],
126
- :TTF_WasInit => [],
127
- :TTF_GetFontKerningSize => [:pointer, :int, :int],
128
- :TTF_GetFontKerningSizeGlyphs => [:pointer, :ushort, :ushort],
129
- }
130
- retvals = {
131
- :TTF_Linked_Version => :pointer,
132
- :TTF_ByteSwappedUNICODE => :void,
133
- :TTF_Init => :int,
134
- :TTF_OpenFont => :pointer,
135
- :TTF_OpenFontIndex => :pointer,
136
- :TTF_OpenFontRW => :pointer,
137
- :TTF_OpenFontIndexRW => :pointer,
138
- :TTF_GetFontStyle => :int,
139
- :TTF_SetFontStyle => :void,
140
- :TTF_GetFontOutline => :int,
141
- :TTF_SetFontOutline => :void,
142
- :TTF_GetFontHinting => :int,
143
- :TTF_SetFontHinting => :void,
144
- :TTF_FontHeight => :int,
145
- :TTF_FontAscent => :int,
146
- :TTF_FontDescent => :int,
147
- :TTF_FontLineSkip => :int,
148
- :TTF_GetFontKerning => :int,
149
- :TTF_SetFontKerning => :void,
150
- :TTF_FontFaces => :long,
151
- :TTF_FontFaceIsFixedWidth => :int,
152
- :TTF_FontFaceFamilyName => :pointer,
153
- :TTF_FontFaceStyleName => :pointer,
154
- :TTF_GlyphIsProvided => :int,
155
- :TTF_GlyphMetrics => :int,
156
- :TTF_SizeText => :int,
157
- :TTF_SizeUTF8 => :int,
158
- :TTF_SizeUNICODE => :int,
159
- :TTF_RenderText_Solid => :pointer,
160
- :TTF_RenderUTF8_Solid => :pointer,
161
- :TTF_RenderUNICODE_Solid => :pointer,
162
- :TTF_RenderGlyph_Solid => :pointer,
163
- :TTF_RenderText_Shaded => :pointer,
164
- :TTF_RenderUTF8_Shaded => :pointer,
165
- :TTF_RenderUNICODE_Shaded => :pointer,
166
- :TTF_RenderGlyph_Shaded => :pointer,
167
- :TTF_RenderText_Blended => :pointer,
168
- :TTF_RenderUTF8_Blended => :pointer,
169
- :TTF_RenderUNICODE_Blended => :pointer,
170
- :TTF_RenderText_Blended_Wrapped => :pointer,
171
- :TTF_RenderUTF8_Blended_Wrapped => :pointer,
172
- :TTF_RenderUNICODE_Blended_Wrapped => :pointer,
173
- :TTF_RenderGlyph_Blended => :pointer,
174
- :TTF_CloseFont => :void,
175
- :TTF_Quit => :void,
176
- :TTF_WasInit => :int,
177
- :TTF_GetFontKerningSize => :int,
178
- :TTF_GetFontKerningSizeGlyphs => :int,
179
- }
180
- symbols.each do |sym|
181
- begin
182
- attach_function sym, args[sym], retvals[sym]
183
- rescue FFI::NotFoundError => error
184
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
185
- end
186
- end
187
- end
188
-
189
- end
190
-
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
+ require_relative 'sdl2_pixels'
9
+
10
+ module SDL2
11
+ extend FFI::Library
12
+ # Define/Macro
13
+
14
+ SDL_TTF_MAJOR_VERSION = 2
15
+ SDL_TTF_MINOR_VERSION = 0
16
+ SDL_TTF_PATCHLEVEL = 15
17
+ TTF_MAJOR_VERSION = SDL_TTF_MAJOR_VERSION
18
+ TTF_MINOR_VERSION = SDL_TTF_MINOR_VERSION
19
+ TTF_PATCHLEVEL = SDL_TTF_PATCHLEVEL
20
+ TTF_STYLE_NORMAL = 0x00
21
+ TTF_STYLE_BOLD = 0x01
22
+ TTF_STYLE_ITALIC = 0x02
23
+ TTF_STYLE_UNDERLINE = 0x04
24
+ TTF_STYLE_STRIKETHROUGH = 0x08
25
+ TTF_HINTING_NORMAL = 0
26
+ TTF_HINTING_LIGHT = 1
27
+ TTF_HINTING_MONO = 2
28
+ TTF_HINTING_NONE = 3
29
+
30
+ # Enum
31
+
32
+
33
+ # Typedef
34
+
35
+
36
+ # Struct
37
+
38
+
39
+ # Function
40
+
41
+ def self.setup_ttf_symbols()
42
+ symbols = [
43
+ :TTF_Linked_Version,
44
+ :TTF_ByteSwappedUNICODE,
45
+ :TTF_Init,
46
+ :TTF_OpenFont,
47
+ :TTF_OpenFontIndex,
48
+ :TTF_OpenFontRW,
49
+ :TTF_OpenFontIndexRW,
50
+ :TTF_GetFontStyle,
51
+ :TTF_SetFontStyle,
52
+ :TTF_GetFontOutline,
53
+ :TTF_SetFontOutline,
54
+ :TTF_GetFontHinting,
55
+ :TTF_SetFontHinting,
56
+ :TTF_FontHeight,
57
+ :TTF_FontAscent,
58
+ :TTF_FontDescent,
59
+ :TTF_FontLineSkip,
60
+ :TTF_GetFontKerning,
61
+ :TTF_SetFontKerning,
62
+ :TTF_FontFaces,
63
+ :TTF_FontFaceIsFixedWidth,
64
+ :TTF_FontFaceFamilyName,
65
+ :TTF_FontFaceStyleName,
66
+ :TTF_GlyphIsProvided,
67
+ :TTF_GlyphMetrics,
68
+ :TTF_SizeText,
69
+ :TTF_SizeUTF8,
70
+ :TTF_SizeUNICODE,
71
+ :TTF_RenderText_Solid,
72
+ :TTF_RenderUTF8_Solid,
73
+ :TTF_RenderUNICODE_Solid,
74
+ :TTF_RenderGlyph_Solid,
75
+ :TTF_RenderText_Shaded,
76
+ :TTF_RenderUTF8_Shaded,
77
+ :TTF_RenderUNICODE_Shaded,
78
+ :TTF_RenderGlyph_Shaded,
79
+ :TTF_RenderText_Blended,
80
+ :TTF_RenderUTF8_Blended,
81
+ :TTF_RenderUNICODE_Blended,
82
+ :TTF_RenderText_Blended_Wrapped,
83
+ :TTF_RenderUTF8_Blended_Wrapped,
84
+ :TTF_RenderUNICODE_Blended_Wrapped,
85
+ :TTF_RenderGlyph_Blended,
86
+ :TTF_CloseFont,
87
+ :TTF_Quit,
88
+ :TTF_WasInit,
89
+ :TTF_GetFontKerningSize,
90
+ :TTF_GetFontKerningSizeGlyphs,
91
+ ]
92
+ args = {
93
+ :TTF_Linked_Version => [],
94
+ :TTF_ByteSwappedUNICODE => [:int],
95
+ :TTF_Init => [],
96
+ :TTF_OpenFont => [:pointer, :int],
97
+ :TTF_OpenFontIndex => [:pointer, :int, :long],
98
+ :TTF_OpenFontRW => [:pointer, :int, :int],
99
+ :TTF_OpenFontIndexRW => [:pointer, :int, :int, :long],
100
+ :TTF_GetFontStyle => [:pointer],
101
+ :TTF_SetFontStyle => [:pointer, :int],
102
+ :TTF_GetFontOutline => [:pointer],
103
+ :TTF_SetFontOutline => [:pointer, :int],
104
+ :TTF_GetFontHinting => [:pointer],
105
+ :TTF_SetFontHinting => [:pointer, :int],
106
+ :TTF_FontHeight => [:pointer],
107
+ :TTF_FontAscent => [:pointer],
108
+ :TTF_FontDescent => [:pointer],
109
+ :TTF_FontLineSkip => [:pointer],
110
+ :TTF_GetFontKerning => [:pointer],
111
+ :TTF_SetFontKerning => [:pointer, :int],
112
+ :TTF_FontFaces => [:pointer],
113
+ :TTF_FontFaceIsFixedWidth => [:pointer],
114
+ :TTF_FontFaceFamilyName => [:pointer],
115
+ :TTF_FontFaceStyleName => [:pointer],
116
+ :TTF_GlyphIsProvided => [:pointer, :ushort],
117
+ :TTF_GlyphMetrics => [:pointer, :ushort, :pointer, :pointer, :pointer, :pointer, :pointer],
118
+ :TTF_SizeText => [:pointer, :pointer, :pointer, :pointer],
119
+ :TTF_SizeUTF8 => [:pointer, :pointer, :pointer, :pointer],
120
+ :TTF_SizeUNICODE => [:pointer, :pointer, :pointer, :pointer],
121
+ :TTF_RenderText_Solid => [:pointer, :pointer, SDL_Color],
122
+ :TTF_RenderUTF8_Solid => [:pointer, :pointer, SDL_Color],
123
+ :TTF_RenderUNICODE_Solid => [:pointer, :pointer, SDL_Color],
124
+ :TTF_RenderGlyph_Solid => [:pointer, :ushort, SDL_Color],
125
+ :TTF_RenderText_Shaded => [:pointer, :pointer, SDL_Color, SDL_Color],
126
+ :TTF_RenderUTF8_Shaded => [:pointer, :pointer, SDL_Color, SDL_Color],
127
+ :TTF_RenderUNICODE_Shaded => [:pointer, :pointer, SDL_Color, SDL_Color],
128
+ :TTF_RenderGlyph_Shaded => [:pointer, :ushort, SDL_Color, SDL_Color],
129
+ :TTF_RenderText_Blended => [:pointer, :pointer, SDL_Color],
130
+ :TTF_RenderUTF8_Blended => [:pointer, :pointer, SDL_Color],
131
+ :TTF_RenderUNICODE_Blended => [:pointer, :pointer, SDL_Color],
132
+ :TTF_RenderText_Blended_Wrapped => [:pointer, :pointer, SDL_Color, :uint],
133
+ :TTF_RenderUTF8_Blended_Wrapped => [:pointer, :pointer, SDL_Color, :uint],
134
+ :TTF_RenderUNICODE_Blended_Wrapped => [:pointer, :pointer, SDL_Color, :uint],
135
+ :TTF_RenderGlyph_Blended => [:pointer, :ushort, SDL_Color],
136
+ :TTF_CloseFont => [:pointer],
137
+ :TTF_Quit => [],
138
+ :TTF_WasInit => [],
139
+ :TTF_GetFontKerningSize => [:pointer, :int, :int],
140
+ :TTF_GetFontKerningSizeGlyphs => [:pointer, :ushort, :ushort],
141
+ }
142
+ retvals = {
143
+ :TTF_Linked_Version => :pointer,
144
+ :TTF_ByteSwappedUNICODE => :void,
145
+ :TTF_Init => :int,
146
+ :TTF_OpenFont => :pointer,
147
+ :TTF_OpenFontIndex => :pointer,
148
+ :TTF_OpenFontRW => :pointer,
149
+ :TTF_OpenFontIndexRW => :pointer,
150
+ :TTF_GetFontStyle => :int,
151
+ :TTF_SetFontStyle => :void,
152
+ :TTF_GetFontOutline => :int,
153
+ :TTF_SetFontOutline => :void,
154
+ :TTF_GetFontHinting => :int,
155
+ :TTF_SetFontHinting => :void,
156
+ :TTF_FontHeight => :int,
157
+ :TTF_FontAscent => :int,
158
+ :TTF_FontDescent => :int,
159
+ :TTF_FontLineSkip => :int,
160
+ :TTF_GetFontKerning => :int,
161
+ :TTF_SetFontKerning => :void,
162
+ :TTF_FontFaces => :long,
163
+ :TTF_FontFaceIsFixedWidth => :int,
164
+ :TTF_FontFaceFamilyName => :pointer,
165
+ :TTF_FontFaceStyleName => :pointer,
166
+ :TTF_GlyphIsProvided => :int,
167
+ :TTF_GlyphMetrics => :int,
168
+ :TTF_SizeText => :int,
169
+ :TTF_SizeUTF8 => :int,
170
+ :TTF_SizeUNICODE => :int,
171
+ :TTF_RenderText_Solid => :pointer,
172
+ :TTF_RenderUTF8_Solid => :pointer,
173
+ :TTF_RenderUNICODE_Solid => :pointer,
174
+ :TTF_RenderGlyph_Solid => :pointer,
175
+ :TTF_RenderText_Shaded => :pointer,
176
+ :TTF_RenderUTF8_Shaded => :pointer,
177
+ :TTF_RenderUNICODE_Shaded => :pointer,
178
+ :TTF_RenderGlyph_Shaded => :pointer,
179
+ :TTF_RenderText_Blended => :pointer,
180
+ :TTF_RenderUTF8_Blended => :pointer,
181
+ :TTF_RenderUNICODE_Blended => :pointer,
182
+ :TTF_RenderText_Blended_Wrapped => :pointer,
183
+ :TTF_RenderUTF8_Blended_Wrapped => :pointer,
184
+ :TTF_RenderUNICODE_Blended_Wrapped => :pointer,
185
+ :TTF_RenderGlyph_Blended => :pointer,
186
+ :TTF_CloseFont => :void,
187
+ :TTF_Quit => :void,
188
+ :TTF_WasInit => :int,
189
+ :TTF_GetFontKerningSize => :int,
190
+ :TTF_GetFontKerningSizeGlyphs => :int,
191
+ }
192
+ symbols.each do |sym|
193
+ begin
194
+ attach_function sym, args[sym], retvals[sym]
195
+ rescue FFI::NotFoundError => error
196
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
197
+ end
198
+ end
199
+ end
200
+
201
+ end
202
+