sdl2-bindings 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +79 -69
  3. data/LICENSE.txt +0 -0
  4. data/README.md +49 -47
  5. data/lib/sdl2.rb +170 -170
  6. data/lib/sdl2_audio.rb +201 -200
  7. data/lib/sdl2_blendmode.rb +69 -69
  8. data/lib/sdl2_clipboard.rb +51 -51
  9. data/lib/sdl2_cpuinfo.rb +106 -103
  10. data/lib/sdl2_error.rb +64 -61
  11. data/lib/sdl2_events.rb +530 -500
  12. data/lib/sdl2_filesystem.rb +48 -48
  13. data/lib/sdl2_framerate.rb +67 -67
  14. data/lib/sdl2_gamecontroller.rb +254 -207
  15. data/lib/sdl2_gesture.rb +55 -55
  16. data/lib/sdl2_gfxPrimitives.rb +222 -222
  17. data/lib/sdl2_haptic.rb +269 -268
  18. data/lib/sdl2_hints.rb +174 -159
  19. data/lib/sdl2_image.rb +185 -185
  20. data/lib/sdl2_imageFilter.rb +132 -132
  21. data/lib/sdl2_joystick.rb +230 -199
  22. data/lib/sdl2_keyboard.rb +99 -99
  23. data/lib/sdl2_keycode.rb +304 -300
  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 +307 -307
  28. data/lib/sdl2_mouse.rb +117 -117
  29. data/lib/sdl2_pixels.rb +224 -218
  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 -370
  39. data/lib/sdl2_surface.rb +182 -179
  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 +190 -190
  44. data/lib/sdl2_version.rb +62 -62
  45. data/lib/sdl2_video.rb +411 -407
  46. data/lib/sdl2_vulkan.rb +64 -64
  47. metadata +5 -5
@@ -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
+
@@ -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
+
@@ -1,190 +1,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
-
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
+
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
+