sdl2-bindings 0.1.1 → 0.1.4

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