sdl2-bindings 0.0.8 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +124 -92
  3. data/LICENSE.txt +1 -1
  4. data/README.md +77 -53
  5. data/lib/sdl2.rb +131 -172
  6. data/lib/sdl2_audio.rb +261 -222
  7. data/lib/sdl2_blendmode.rb +72 -69
  8. data/lib/sdl2_clipboard.rb +56 -51
  9. data/lib/sdl2_cpuinfo.rb +129 -106
  10. data/lib/sdl2_error.rb +71 -64
  11. data/lib/sdl2_events.rb +564 -533
  12. data/lib/sdl2_filesystem.rb +52 -48
  13. data/lib/sdl2_framerate.rb +74 -67
  14. data/lib/sdl2_gamecontroller.rb +329 -274
  15. data/lib/sdl2_gesture.rb +61 -55
  16. data/lib/sdl2_gfxPrimitives.rb +283 -222
  17. data/lib/sdl2_haptic.rb +301 -269
  18. data/lib/sdl2_hidapi.rb +139 -118
  19. data/lib/sdl2_hints.rb +221 -197
  20. data/lib/sdl2_image.rb +232 -185
  21. data/lib/sdl2_imageFilter.rb +164 -132
  22. data/lib/sdl2_joystick.rb +294 -239
  23. data/lib/sdl2_keyboard.rb +125 -99
  24. data/lib/sdl2_keycode.rb +307 -305
  25. data/lib/sdl2_log.rb +131 -115
  26. data/lib/sdl2_main.rb +74 -67
  27. data/lib/sdl2_messagebox.rb +102 -98
  28. data/lib/sdl2_misc.rb +48 -45
  29. data/lib/sdl2_mixer.rb +392 -317
  30. data/lib/sdl2_mouse.rb +136 -117
  31. data/lib/sdl2_pixels.rb +240 -224
  32. data/lib/sdl2_platform.rb +48 -45
  33. data/lib/sdl2_power.rb +54 -51
  34. data/lib/sdl2_rect.rb +145 -102
  35. data/lib/sdl2_render.rb +408 -322
  36. data/lib/sdl2_rotozoom.rb +76 -66
  37. data/lib/sdl2_rwops.rb +238 -208
  38. data/lib/sdl2_scancode.rb +289 -287
  39. data/lib/sdl2_sensor.rb +115 -97
  40. data/lib/sdl2_shape.rb +83 -77
  41. data/lib/sdl2_sound.rb +154 -0
  42. data/lib/sdl2_stdinc.rb +556 -439
  43. data/lib/sdl2_surface.rb +229 -188
  44. data/lib/sdl2_syswm.rb +160 -156
  45. data/lib/sdl2_timer.rb +74 -65
  46. data/lib/sdl2_touch.rb +86 -75
  47. data/lib/sdl2_ttf.rb +358 -202
  48. data/lib/sdl2_version.rb +67 -62
  49. data/lib/sdl2_video.rb +540 -446
  50. data/lib/sdl2_vulkan.rb +72 -64
  51. metadata +19 -4
data/lib/sdl2_ttf.rb CHANGED
@@ -1,202 +1,358 @@
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
-
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 SDL
11
+ extend FFI::Library
12
+ # Define/Macro
13
+
14
+ TTF_MAJOR_VERSION = 2
15
+ TTF_MINOR_VERSION = 0
16
+ TTF_PATCHLEVEL = 15
17
+ TTF_STYLE_NORMAL = 0x00
18
+ TTF_STYLE_BOLD = 0x01
19
+ TTF_STYLE_ITALIC = 0x02
20
+ TTF_STYLE_UNDERLINE = 0x04
21
+ TTF_STYLE_STRIKETHROUGH = 0x08
22
+ TTF_HINTING_NORMAL = 0
23
+ TTF_HINTING_LIGHT = 1
24
+ TTF_HINTING_MONO = 2
25
+ TTF_HINTING_NONE = 3
26
+ TTF_HINTING_LIGHT_SUBPIXEL = 4
27
+
28
+ # Enum
29
+
30
+
31
+ # Typedef
32
+
33
+
34
+ # Struct
35
+
36
+
37
+ # Function
38
+
39
+ def self.setup_ttf_symbols(output_error = false)
40
+ symbols = [
41
+ :TTF_Linked_Version,
42
+ :TTF_GetFreeTypeVersion,
43
+ :TTF_GetHarfBuzzVersion,
44
+ :TTF_ByteSwappedUNICODE,
45
+ :TTF_Init,
46
+ :TTF_OpenFont,
47
+ :TTF_OpenFontIndex,
48
+ :TTF_OpenFontRW,
49
+ :TTF_OpenFontIndexRW,
50
+ :TTF_OpenFontDPI,
51
+ :TTF_OpenFontIndexDPI,
52
+ :TTF_OpenFontDPIRW,
53
+ :TTF_OpenFontIndexDPIRW,
54
+ :TTF_SetFontSize,
55
+ :TTF_SetFontSizeDPI,
56
+ :TTF_GetFontStyle,
57
+ :TTF_SetFontStyle,
58
+ :TTF_GetFontOutline,
59
+ :TTF_SetFontOutline,
60
+ :TTF_GetFontHinting,
61
+ :TTF_SetFontHinting,
62
+ :TTF_FontHeight,
63
+ :TTF_FontAscent,
64
+ :TTF_FontDescent,
65
+ :TTF_FontLineSkip,
66
+ :TTF_GetFontKerning,
67
+ :TTF_SetFontKerning,
68
+ :TTF_FontFaces,
69
+ :TTF_FontFaceIsFixedWidth,
70
+ :TTF_FontFaceFamilyName,
71
+ :TTF_FontFaceStyleName,
72
+ :TTF_GlyphIsProvided,
73
+ :TTF_GlyphIsProvided32,
74
+ :TTF_GlyphMetrics,
75
+ :TTF_GlyphMetrics32,
76
+ :TTF_SizeText,
77
+ :TTF_SizeUTF8,
78
+ :TTF_SizeUNICODE,
79
+ :TTF_MeasureText,
80
+ :TTF_MeasureUTF8,
81
+ :TTF_MeasureUNICODE,
82
+ :TTF_RenderText_Solid,
83
+ :TTF_RenderUTF8_Solid,
84
+ :TTF_RenderUNICODE_Solid,
85
+ :TTF_RenderText_Solid_Wrapped,
86
+ :TTF_RenderUTF8_Solid_Wrapped,
87
+ :TTF_RenderUNICODE_Solid_Wrapped,
88
+ :TTF_RenderGlyph_Solid,
89
+ :TTF_RenderGlyph32_Solid,
90
+ :TTF_RenderText_Shaded,
91
+ :TTF_RenderUTF8_Shaded,
92
+ :TTF_RenderUNICODE_Shaded,
93
+ :TTF_RenderText_Shaded_Wrapped,
94
+ :TTF_RenderUTF8_Shaded_Wrapped,
95
+ :TTF_RenderUNICODE_Shaded_Wrapped,
96
+ :TTF_RenderGlyph_Shaded,
97
+ :TTF_RenderGlyph32_Shaded,
98
+ :TTF_RenderText_Blended,
99
+ :TTF_RenderUTF8_Blended,
100
+ :TTF_RenderUNICODE_Blended,
101
+ :TTF_RenderText_Blended_Wrapped,
102
+ :TTF_RenderUTF8_Blended_Wrapped,
103
+ :TTF_RenderUNICODE_Blended_Wrapped,
104
+ :TTF_RenderGlyph_Blended,
105
+ :TTF_RenderGlyph32_Blended,
106
+ :TTF_SetDirection,
107
+ :TTF_SetScript,
108
+ :TTF_CloseFont,
109
+ :TTF_Quit,
110
+ :TTF_WasInit,
111
+ :TTF_GetFontKerningSize,
112
+ :TTF_GetFontKerningSizeGlyphs,
113
+ :TTF_GetFontKerningSizeGlyphs32,
114
+ :TTF_SetFontSDF,
115
+ :TTF_GetFontSDF,
116
+ ]
117
+ apis = {
118
+ :TTF_Linked_Version => :TTF_Linked_Version,
119
+ :TTF_GetFreeTypeVersion => :TTF_GetFreeTypeVersion,
120
+ :TTF_GetHarfBuzzVersion => :TTF_GetHarfBuzzVersion,
121
+ :TTF_ByteSwappedUNICODE => :TTF_ByteSwappedUNICODE,
122
+ :TTF_Init => :TTF_Init,
123
+ :TTF_OpenFont => :TTF_OpenFont,
124
+ :TTF_OpenFontIndex => :TTF_OpenFontIndex,
125
+ :TTF_OpenFontRW => :TTF_OpenFontRW,
126
+ :TTF_OpenFontIndexRW => :TTF_OpenFontIndexRW,
127
+ :TTF_OpenFontDPI => :TTF_OpenFontDPI,
128
+ :TTF_OpenFontIndexDPI => :TTF_OpenFontIndexDPI,
129
+ :TTF_OpenFontDPIRW => :TTF_OpenFontDPIRW,
130
+ :TTF_OpenFontIndexDPIRW => :TTF_OpenFontIndexDPIRW,
131
+ :TTF_SetFontSize => :TTF_SetFontSize,
132
+ :TTF_SetFontSizeDPI => :TTF_SetFontSizeDPI,
133
+ :TTF_GetFontStyle => :TTF_GetFontStyle,
134
+ :TTF_SetFontStyle => :TTF_SetFontStyle,
135
+ :TTF_GetFontOutline => :TTF_GetFontOutline,
136
+ :TTF_SetFontOutline => :TTF_SetFontOutline,
137
+ :TTF_GetFontHinting => :TTF_GetFontHinting,
138
+ :TTF_SetFontHinting => :TTF_SetFontHinting,
139
+ :TTF_FontHeight => :TTF_FontHeight,
140
+ :TTF_FontAscent => :TTF_FontAscent,
141
+ :TTF_FontDescent => :TTF_FontDescent,
142
+ :TTF_FontLineSkip => :TTF_FontLineSkip,
143
+ :TTF_GetFontKerning => :TTF_GetFontKerning,
144
+ :TTF_SetFontKerning => :TTF_SetFontKerning,
145
+ :TTF_FontFaces => :TTF_FontFaces,
146
+ :TTF_FontFaceIsFixedWidth => :TTF_FontFaceIsFixedWidth,
147
+ :TTF_FontFaceFamilyName => :TTF_FontFaceFamilyName,
148
+ :TTF_FontFaceStyleName => :TTF_FontFaceStyleName,
149
+ :TTF_GlyphIsProvided => :TTF_GlyphIsProvided,
150
+ :TTF_GlyphIsProvided32 => :TTF_GlyphIsProvided32,
151
+ :TTF_GlyphMetrics => :TTF_GlyphMetrics,
152
+ :TTF_GlyphMetrics32 => :TTF_GlyphMetrics32,
153
+ :TTF_SizeText => :TTF_SizeText,
154
+ :TTF_SizeUTF8 => :TTF_SizeUTF8,
155
+ :TTF_SizeUNICODE => :TTF_SizeUNICODE,
156
+ :TTF_MeasureText => :TTF_MeasureText,
157
+ :TTF_MeasureUTF8 => :TTF_MeasureUTF8,
158
+ :TTF_MeasureUNICODE => :TTF_MeasureUNICODE,
159
+ :TTF_RenderText_Solid => :TTF_RenderText_Solid,
160
+ :TTF_RenderUTF8_Solid => :TTF_RenderUTF8_Solid,
161
+ :TTF_RenderUNICODE_Solid => :TTF_RenderUNICODE_Solid,
162
+ :TTF_RenderText_Solid_Wrapped => :TTF_RenderText_Solid_Wrapped,
163
+ :TTF_RenderUTF8_Solid_Wrapped => :TTF_RenderUTF8_Solid_Wrapped,
164
+ :TTF_RenderUNICODE_Solid_Wrapped => :TTF_RenderUNICODE_Solid_Wrapped,
165
+ :TTF_RenderGlyph_Solid => :TTF_RenderGlyph_Solid,
166
+ :TTF_RenderGlyph32_Solid => :TTF_RenderGlyph32_Solid,
167
+ :TTF_RenderText_Shaded => :TTF_RenderText_Shaded,
168
+ :TTF_RenderUTF8_Shaded => :TTF_RenderUTF8_Shaded,
169
+ :TTF_RenderUNICODE_Shaded => :TTF_RenderUNICODE_Shaded,
170
+ :TTF_RenderText_Shaded_Wrapped => :TTF_RenderText_Shaded_Wrapped,
171
+ :TTF_RenderUTF8_Shaded_Wrapped => :TTF_RenderUTF8_Shaded_Wrapped,
172
+ :TTF_RenderUNICODE_Shaded_Wrapped => :TTF_RenderUNICODE_Shaded_Wrapped,
173
+ :TTF_RenderGlyph_Shaded => :TTF_RenderGlyph_Shaded,
174
+ :TTF_RenderGlyph32_Shaded => :TTF_RenderGlyph32_Shaded,
175
+ :TTF_RenderText_Blended => :TTF_RenderText_Blended,
176
+ :TTF_RenderUTF8_Blended => :TTF_RenderUTF8_Blended,
177
+ :TTF_RenderUNICODE_Blended => :TTF_RenderUNICODE_Blended,
178
+ :TTF_RenderText_Blended_Wrapped => :TTF_RenderText_Blended_Wrapped,
179
+ :TTF_RenderUTF8_Blended_Wrapped => :TTF_RenderUTF8_Blended_Wrapped,
180
+ :TTF_RenderUNICODE_Blended_Wrapped => :TTF_RenderUNICODE_Blended_Wrapped,
181
+ :TTF_RenderGlyph_Blended => :TTF_RenderGlyph_Blended,
182
+ :TTF_RenderGlyph32_Blended => :TTF_RenderGlyph32_Blended,
183
+ :TTF_SetDirection => :TTF_SetDirection,
184
+ :TTF_SetScript => :TTF_SetScript,
185
+ :TTF_CloseFont => :TTF_CloseFont,
186
+ :TTF_Quit => :TTF_Quit,
187
+ :TTF_WasInit => :TTF_WasInit,
188
+ :TTF_GetFontKerningSize => :TTF_GetFontKerningSize,
189
+ :TTF_GetFontKerningSizeGlyphs => :TTF_GetFontKerningSizeGlyphs,
190
+ :TTF_GetFontKerningSizeGlyphs32 => :TTF_GetFontKerningSizeGlyphs32,
191
+ :TTF_SetFontSDF => :TTF_SetFontSDF,
192
+ :TTF_GetFontSDF => :TTF_GetFontSDF,
193
+ }
194
+ args = {
195
+ :TTF_Linked_Version => [],
196
+ :TTF_GetFreeTypeVersion => [:pointer, :pointer, :pointer],
197
+ :TTF_GetHarfBuzzVersion => [:pointer, :pointer, :pointer],
198
+ :TTF_ByteSwappedUNICODE => [:int],
199
+ :TTF_Init => [],
200
+ :TTF_OpenFont => [:pointer, :int],
201
+ :TTF_OpenFontIndex => [:pointer, :int, :long],
202
+ :TTF_OpenFontRW => [:pointer, :int, :int],
203
+ :TTF_OpenFontIndexRW => [:pointer, :int, :int, :long],
204
+ :TTF_OpenFontDPI => [:pointer, :int, :uint, :uint],
205
+ :TTF_OpenFontIndexDPI => [:pointer, :int, :long, :uint, :uint],
206
+ :TTF_OpenFontDPIRW => [:pointer, :int, :int, :uint, :uint],
207
+ :TTF_OpenFontIndexDPIRW => [:pointer, :int, :int, :long, :uint, :uint],
208
+ :TTF_SetFontSize => [:pointer, :int],
209
+ :TTF_SetFontSizeDPI => [:pointer, :int, :uint, :uint],
210
+ :TTF_GetFontStyle => [:pointer],
211
+ :TTF_SetFontStyle => [:pointer, :int],
212
+ :TTF_GetFontOutline => [:pointer],
213
+ :TTF_SetFontOutline => [:pointer, :int],
214
+ :TTF_GetFontHinting => [:pointer],
215
+ :TTF_SetFontHinting => [:pointer, :int],
216
+ :TTF_FontHeight => [:pointer],
217
+ :TTF_FontAscent => [:pointer],
218
+ :TTF_FontDescent => [:pointer],
219
+ :TTF_FontLineSkip => [:pointer],
220
+ :TTF_GetFontKerning => [:pointer],
221
+ :TTF_SetFontKerning => [:pointer, :int],
222
+ :TTF_FontFaces => [:pointer],
223
+ :TTF_FontFaceIsFixedWidth => [:pointer],
224
+ :TTF_FontFaceFamilyName => [:pointer],
225
+ :TTF_FontFaceStyleName => [:pointer],
226
+ :TTF_GlyphIsProvided => [:pointer, :ushort],
227
+ :TTF_GlyphIsProvided32 => [:pointer, :uint],
228
+ :TTF_GlyphMetrics => [:pointer, :ushort, :pointer, :pointer, :pointer, :pointer, :pointer],
229
+ :TTF_GlyphMetrics32 => [:pointer, :uint, :pointer, :pointer, :pointer, :pointer, :pointer],
230
+ :TTF_SizeText => [:pointer, :pointer, :pointer, :pointer],
231
+ :TTF_SizeUTF8 => [:pointer, :pointer, :pointer, :pointer],
232
+ :TTF_SizeUNICODE => [:pointer, :pointer, :pointer, :pointer],
233
+ :TTF_MeasureText => [:pointer, :pointer, :int, :pointer, :pointer],
234
+ :TTF_MeasureUTF8 => [:pointer, :pointer, :int, :pointer, :pointer],
235
+ :TTF_MeasureUNICODE => [:pointer, :pointer, :int, :pointer, :pointer],
236
+ :TTF_RenderText_Solid => [:pointer, :pointer, Color.by_value],
237
+ :TTF_RenderUTF8_Solid => [:pointer, :pointer, Color.by_value],
238
+ :TTF_RenderUNICODE_Solid => [:pointer, :pointer, Color.by_value],
239
+ :TTF_RenderText_Solid_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
240
+ :TTF_RenderUTF8_Solid_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
241
+ :TTF_RenderUNICODE_Solid_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
242
+ :TTF_RenderGlyph_Solid => [:pointer, :ushort, Color.by_value],
243
+ :TTF_RenderGlyph32_Solid => [:pointer, :uint, Color.by_value],
244
+ :TTF_RenderText_Shaded => [:pointer, :pointer, Color.by_value, Color.by_value],
245
+ :TTF_RenderUTF8_Shaded => [:pointer, :pointer, Color.by_value, Color.by_value],
246
+ :TTF_RenderUNICODE_Shaded => [:pointer, :pointer, Color.by_value, Color.by_value],
247
+ :TTF_RenderText_Shaded_Wrapped => [:pointer, :pointer, Color.by_value, Color.by_value, :uint],
248
+ :TTF_RenderUTF8_Shaded_Wrapped => [:pointer, :pointer, Color.by_value, Color.by_value, :uint],
249
+ :TTF_RenderUNICODE_Shaded_Wrapped => [:pointer, :pointer, Color.by_value, Color.by_value, :uint],
250
+ :TTF_RenderGlyph_Shaded => [:pointer, :ushort, Color.by_value, Color.by_value],
251
+ :TTF_RenderGlyph32_Shaded => [:pointer, :uint, Color.by_value, Color.by_value],
252
+ :TTF_RenderText_Blended => [:pointer, :pointer, Color.by_value],
253
+ :TTF_RenderUTF8_Blended => [:pointer, :pointer, Color.by_value],
254
+ :TTF_RenderUNICODE_Blended => [:pointer, :pointer, Color.by_value],
255
+ :TTF_RenderText_Blended_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
256
+ :TTF_RenderUTF8_Blended_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
257
+ :TTF_RenderUNICODE_Blended_Wrapped => [:pointer, :pointer, Color.by_value, :uint],
258
+ :TTF_RenderGlyph_Blended => [:pointer, :ushort, Color.by_value],
259
+ :TTF_RenderGlyph32_Blended => [:pointer, :uint, Color.by_value],
260
+ :TTF_SetDirection => [:int],
261
+ :TTF_SetScript => [:int],
262
+ :TTF_CloseFont => [:pointer],
263
+ :TTF_Quit => [],
264
+ :TTF_WasInit => [],
265
+ :TTF_GetFontKerningSize => [:pointer, :int, :int],
266
+ :TTF_GetFontKerningSizeGlyphs => [:pointer, :ushort, :ushort],
267
+ :TTF_GetFontKerningSizeGlyphs32 => [:pointer, :uint, :uint],
268
+ :TTF_SetFontSDF => [:pointer, :int],
269
+ :TTF_GetFontSDF => [:pointer],
270
+ }
271
+ retvals = {
272
+ :TTF_Linked_Version => :pointer,
273
+ :TTF_GetFreeTypeVersion => :void,
274
+ :TTF_GetHarfBuzzVersion => :void,
275
+ :TTF_ByteSwappedUNICODE => :void,
276
+ :TTF_Init => :int,
277
+ :TTF_OpenFont => :pointer,
278
+ :TTF_OpenFontIndex => :pointer,
279
+ :TTF_OpenFontRW => :pointer,
280
+ :TTF_OpenFontIndexRW => :pointer,
281
+ :TTF_OpenFontDPI => :pointer,
282
+ :TTF_OpenFontIndexDPI => :pointer,
283
+ :TTF_OpenFontDPIRW => :pointer,
284
+ :TTF_OpenFontIndexDPIRW => :pointer,
285
+ :TTF_SetFontSize => :int,
286
+ :TTF_SetFontSizeDPI => :int,
287
+ :TTF_GetFontStyle => :int,
288
+ :TTF_SetFontStyle => :void,
289
+ :TTF_GetFontOutline => :int,
290
+ :TTF_SetFontOutline => :void,
291
+ :TTF_GetFontHinting => :int,
292
+ :TTF_SetFontHinting => :void,
293
+ :TTF_FontHeight => :int,
294
+ :TTF_FontAscent => :int,
295
+ :TTF_FontDescent => :int,
296
+ :TTF_FontLineSkip => :int,
297
+ :TTF_GetFontKerning => :int,
298
+ :TTF_SetFontKerning => :void,
299
+ :TTF_FontFaces => :long,
300
+ :TTF_FontFaceIsFixedWidth => :int,
301
+ :TTF_FontFaceFamilyName => :pointer,
302
+ :TTF_FontFaceStyleName => :pointer,
303
+ :TTF_GlyphIsProvided => :int,
304
+ :TTF_GlyphIsProvided32 => :int,
305
+ :TTF_GlyphMetrics => :int,
306
+ :TTF_GlyphMetrics32 => :int,
307
+ :TTF_SizeText => :int,
308
+ :TTF_SizeUTF8 => :int,
309
+ :TTF_SizeUNICODE => :int,
310
+ :TTF_MeasureText => :int,
311
+ :TTF_MeasureUTF8 => :int,
312
+ :TTF_MeasureUNICODE => :int,
313
+ :TTF_RenderText_Solid => :pointer,
314
+ :TTF_RenderUTF8_Solid => :pointer,
315
+ :TTF_RenderUNICODE_Solid => :pointer,
316
+ :TTF_RenderText_Solid_Wrapped => :pointer,
317
+ :TTF_RenderUTF8_Solid_Wrapped => :pointer,
318
+ :TTF_RenderUNICODE_Solid_Wrapped => :pointer,
319
+ :TTF_RenderGlyph_Solid => :pointer,
320
+ :TTF_RenderGlyph32_Solid => :pointer,
321
+ :TTF_RenderText_Shaded => :pointer,
322
+ :TTF_RenderUTF8_Shaded => :pointer,
323
+ :TTF_RenderUNICODE_Shaded => :pointer,
324
+ :TTF_RenderText_Shaded_Wrapped => :pointer,
325
+ :TTF_RenderUTF8_Shaded_Wrapped => :pointer,
326
+ :TTF_RenderUNICODE_Shaded_Wrapped => :pointer,
327
+ :TTF_RenderGlyph_Shaded => :pointer,
328
+ :TTF_RenderGlyph32_Shaded => :pointer,
329
+ :TTF_RenderText_Blended => :pointer,
330
+ :TTF_RenderUTF8_Blended => :pointer,
331
+ :TTF_RenderUNICODE_Blended => :pointer,
332
+ :TTF_RenderText_Blended_Wrapped => :pointer,
333
+ :TTF_RenderUTF8_Blended_Wrapped => :pointer,
334
+ :TTF_RenderUNICODE_Blended_Wrapped => :pointer,
335
+ :TTF_RenderGlyph_Blended => :pointer,
336
+ :TTF_RenderGlyph32_Blended => :pointer,
337
+ :TTF_SetDirection => :int,
338
+ :TTF_SetScript => :int,
339
+ :TTF_CloseFont => :void,
340
+ :TTF_Quit => :void,
341
+ :TTF_WasInit => :int,
342
+ :TTF_GetFontKerningSize => :int,
343
+ :TTF_GetFontKerningSizeGlyphs => :int,
344
+ :TTF_GetFontKerningSizeGlyphs32 => :int,
345
+ :TTF_SetFontSDF => :int,
346
+ :TTF_GetFontSDF => :int,
347
+ }
348
+ symbols.each do |sym|
349
+ begin
350
+ attach_function apis[sym], sym, args[sym], retvals[sym]
351
+ rescue FFI::NotFoundError => error
352
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
353
+ end
354
+ end
355
+ end
356
+
357
+ end
358
+