sdl2_ffi 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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -59
  3. data/lib/sdl2.rb +52 -15
  4. data/lib/sdl2/application.rb +71 -0
  5. data/lib/sdl2/audio.rb +72 -24
  6. data/lib/sdl2/clipboard.rb +9 -3
  7. data/lib/sdl2/color.rb +8 -3
  8. data/lib/sdl2/cpuinfo.rb +30 -10
  9. data/lib/sdl2/engine.rb +52 -0
  10. data/lib/sdl2/engine/block_engine.rb +27 -0
  11. data/lib/sdl2/engine/engines.rb +46 -0
  12. data/lib/sdl2/error.rb +9 -3
  13. data/lib/sdl2/events.rb +68 -6
  14. data/lib/sdl2/gamecontroller.rb +60 -20
  15. data/lib/sdl2/gem_version.rb +1 -1
  16. data/lib/sdl2/gesture.rb +12 -4
  17. data/lib/sdl2/haptic.rb +90 -30
  18. data/lib/sdl2/hints.rb +12 -4
  19. data/lib/sdl2/image.rb +85 -3
  20. data/lib/sdl2/init.rb +15 -5
  21. data/lib/sdl2/joystick.rb +63 -21
  22. data/lib/sdl2/keyboard.rb +101 -17
  23. data/lib/sdl2/keycode.rb +72 -72
  24. data/lib/sdl2/library.rb +7 -0
  25. data/lib/sdl2/log.rb +78 -21
  26. data/lib/sdl2/mixer.rb +651 -0
  27. data/lib/sdl2/mixer/chunk.rb +47 -0
  28. data/lib/sdl2/mixer/lib_paths.rb +8 -0
  29. data/lib/sdl2/mouse.rb +39 -13
  30. data/lib/sdl2/pixels.rb +39 -13
  31. data/lib/sdl2/point.rb +29 -0
  32. data/lib/sdl2/power.rb +3 -1
  33. data/lib/sdl2/rect.rb +94 -19
  34. data/lib/sdl2/render.rb +156 -52
  35. data/lib/sdl2/rwops.rb +60 -20
  36. data/lib/sdl2/surface.rb +85 -28
  37. data/lib/sdl2/syswm.rb +3 -1
  38. data/lib/sdl2/timer.rb +18 -6
  39. data/lib/sdl2/touch.rb +12 -4
  40. data/lib/sdl2/ttf.rb +153 -59
  41. data/lib/sdl2/ttf/font.rb +21 -5
  42. data/lib/sdl2/version.rb +9 -3
  43. data/lib/sdl2/video.rb +210 -70
  44. data/lib/sdl2/window.rb +9 -3
  45. data/spec/fixtures/approvals/lazyfoonet_lesson_07_true_type_fonts/draws_the_message_to_the_screen.approved.png +0 -0
  46. data/spec/fixtures/approvals/lazyfoonet_lesson_07_true_type_fonts/writes_a_message_to_a_surface.approved.png +0 -0
  47. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/defaults_to_mouse_out.approved.png +0 -0
  48. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/has_a_button_sheet.approved.png +0 -0
  49. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/shows_mouse_down.approved.png +0 -0
  50. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/shows_mouse_in.approved.png +0 -0
  51. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/shows_mouse_out.approved.png +0 -0
  52. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/shows_mouse_up.approved.png +0 -0
  53. data/spec/fixtures/images/button_sheet.png +0 -0
  54. data/spec/functional/lazy_foo_tutorial/lazy_foo_01_hello_world_spec.rb +9 -2
  55. data/spec/functional/lazy_foo_tutorial/lazy_foo_03_extension_libraries_spec.rb +1 -0
  56. data/spec/functional/lazy_foo_tutorial/lazy_foo_04_event_driven_programming_spec.rb +4 -3
  57. data/spec/functional/lazy_foo_tutorial/lazy_foo_05_color_keying_spec.rb +1 -1
  58. data/spec/functional/lazy_foo_tutorial/lazy_foo_06_clip_blitting_and_sprite_sheets_spec.rb +4 -3
  59. data/spec/functional/lazy_foo_tutorial/lazy_foo_07_true_type_fonts_spec.rb +4 -2
  60. data/spec/functional/lazy_foo_tutorial/lazy_foo_08_key_presses_spec.rb +10 -22
  61. data/spec/functional/lazy_foo_tutorial/lazy_foo_09_mouse_events_spec.rb +121 -0
  62. data/spec/functional/lazy_foo_tutorial/lazy_foo_10_key_states_spec.rb +30 -0
  63. data/spec/functional/lazy_foo_tutorial/lazy_foo_11_playing_sounds_spec.rb +116 -0
  64. data/spec/functional/lazy_foo_tutorial/lazy_foo_12_timing_spec.rb +57 -0
  65. data/spec/spec_helper.rb +3 -1
  66. metadata +31 -2
data/lib/sdl2/rwops.rb CHANGED
@@ -107,25 +107,65 @@ module SDL2
107
107
 
108
108
  end
109
109
 
110
- api :SDL_RWFromFile, [:string, :string], RWops.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
111
- api :SDL_RWFromFP, [:pointer, :bool], RWops.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
112
- api :SDL_RWFromMem, [:pointer, :count], RWops.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
113
- api :SDL_RWFromConstMem, [:pointer, :count], RWops.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
114
- api :SDL_AllocRW, [], RWops.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
115
- api :SDL_FreeRW, [RWops.by_ref], :void
116
- api :SDL_ReadU8, [RWops.by_ref], :uint8
117
- api :SDL_ReadLE16, [RWops.by_ref], :uint16
118
- api :SDL_ReadBE16, [RWops.by_ref], :uint16
119
- api :SDL_ReadLE32, [RWops.by_ref], :uint32
120
- api :SDL_ReadBE32, [RWops.by_ref], :uint32
121
- api :SDL_ReadLE64, [RWops.by_ref], :uint64
122
- api :SDL_ReadBE64, [RWops.by_ref], :uint64
110
+ ##
111
+ #
112
+ api :SDL_RWFromFile, [:string, :string], RWops.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
113
+ ##
114
+ #
115
+ api :SDL_RWFromFP, [:pointer, :bool], RWops.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
116
+ ##
117
+ #
118
+ api :SDL_RWFromMem, [:pointer, :count], RWops.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
119
+ ##
120
+ #
121
+ api :SDL_RWFromConstMem, [:pointer, :count], RWops.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
122
+ ##
123
+ #
124
+ api :SDL_AllocRW, [], RWops.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
125
+ ##
126
+ #
127
+ api :SDL_FreeRW, [RWops.by_ref], :void
128
+ ##
129
+ #
130
+ api :SDL_ReadU8, [RWops.by_ref], :uint8
131
+ ##
132
+ #
133
+ api :SDL_ReadLE16, [RWops.by_ref], :uint16
134
+ ##
135
+ #
136
+ api :SDL_ReadBE16, [RWops.by_ref], :uint16
137
+ ##
138
+ #
139
+ api :SDL_ReadLE32, [RWops.by_ref], :uint32
140
+ ##
141
+ #
142
+ api :SDL_ReadBE32, [RWops.by_ref], :uint32
143
+ ##
144
+ #
145
+ api :SDL_ReadLE64, [RWops.by_ref], :uint64
146
+ ##
147
+ #
148
+ api :SDL_ReadBE64, [RWops.by_ref], :uint64
123
149
 
124
- api :SDL_WriteU8, [RWops.by_ref, :uint8], :size_t
125
- api :SDL_WriteLE16, [RWops.by_ref, :uint16], :size_t
126
- api :SDL_WriteBE16, [RWops.by_ref, :uint16], :size_t
127
- api :SDL_WriteLE32, [RWops.by_ref, :uint32], :size_t
128
- api :SDL_WriteBE32, [RWops.by_ref, :uint32], :size_t
129
- api :SDL_WriteLE64, [RWops.by_ref, :uint64], :size_t
130
- api :SDL_WriteBE64, [RWops.by_ref, :uint64], :size_t
150
+ ##
151
+ #
152
+ api :SDL_WriteU8, [RWops.by_ref, :uint8], :size_t
153
+ ##
154
+ #
155
+ api :SDL_WriteLE16, [RWops.by_ref, :uint16], :size_t
156
+ ##
157
+ #
158
+ api :SDL_WriteBE16, [RWops.by_ref, :uint16], :size_t
159
+ ##
160
+ #
161
+ api :SDL_WriteLE32, [RWops.by_ref, :uint32], :size_t
162
+ ##
163
+ #
164
+ api :SDL_WriteBE32, [RWops.by_ref, :uint32], :size_t
165
+ ##
166
+ #
167
+ api :SDL_WriteLE64, [RWops.by_ref, :uint64], :size_t
168
+ ##
169
+ #
170
+ api :SDL_WriteBE64, [RWops.by_ref, :uint64], :size_t
131
171
  end
data/lib/sdl2/surface.rb CHANGED
@@ -141,6 +141,7 @@ module SDL2
141
141
  if key.nil?#then disable color keying
142
142
  SDL2.set_color_key(self, false, 0)
143
143
  else# Enable color key by value
144
+ #binding.pry
144
145
  SDL2.set_color_key(self, true, pixel_value)
145
146
  end
146
147
  end
@@ -187,12 +188,24 @@ module SDL2
187
188
 
188
189
  callback :blit, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
189
190
 
190
- api :SDL_CreateRGBSurface, [:surface_flags, :int, :int, :int, :uint32, :uint32, :uint32, :uint32], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
191
- api :SDL_FreeSurface, [Surface.by_ref], :void
192
- api :SDL_SetSurfacePalette, [Surface.by_ref, Palette.by_ref], :int, {error: true}
193
- api :SDL_LockSurface, [Surface.by_ref], :int
194
- api :SDL_UnlockSurface, [Surface.by_ref], :void
195
- api :SDL_LoadBMP_RW, [RWops.by_ref, :int], Surface.auto_ptr
191
+ ##
192
+ #
193
+ api :SDL_CreateRGBSurface, [:surface_flags, :int, :int, :int, :uint32, :uint32, :uint32, :uint32], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
194
+ ##
195
+ #
196
+ api :SDL_FreeSurface, [Surface.by_ref], :void
197
+ ##
198
+ #
199
+ api :SDL_SetSurfacePalette, [Surface.by_ref, Palette.by_ref], :int, {error: true}
200
+ ##
201
+ #
202
+ api :SDL_LockSurface, [Surface.by_ref], :int
203
+ ##
204
+ #
205
+ api :SDL_UnlockSurface, [Surface.by_ref], :void
206
+ ##
207
+ #
208
+ api :SDL_LoadBMP_RW, [RWops.by_ref, :int], Surface.auto_ptr
196
209
 
197
210
  # Redefine SDL_LoadBMP macro:
198
211
  def self.load_bmp(file)
@@ -201,31 +214,67 @@ module SDL2
201
214
 
202
215
  returns_error(:load_bmp,TRUE_WHEN_NOT_NULL)
203
216
 
204
- api :SDL_SaveBMP_RW, [Surface.by_ref, RWops.by_ref, :int], :int
217
+ ##
218
+ #
219
+ api :SDL_SaveBMP_RW, [Surface.by_ref, RWops.by_ref, :int], :int
205
220
 
206
221
  def self.save_bmp(surface, file)
207
222
  SDL2.save_bmp_rw(surface, RWops.from_file(file, 'wb'), 1)
208
223
  end
209
224
 
210
- api :SDL_SetSurfaceRLE, [Surface.by_ref, :int], :int
211
- api :SDL_SetColorKey, [Surface.by_ref, :bool, :int], :int, {error: true}
212
- api :SDL_GetColorKey, [Surface.by_ref, UInt32Struct.by_ref], :int, {error: true}
225
+ ##
226
+ #
227
+ api :SDL_SetSurfaceRLE, [Surface.by_ref, :int], :int
228
+ ##
229
+ #
230
+ api :SDL_SetColorKey, [Surface.by_ref, :bool, :uint32], :int, {error: true}
231
+ ##
232
+ #
233
+ api :SDL_GetColorKey, [Surface.by_ref, UInt32Struct.by_ref], :uint32, {error: true}
213
234
  # Could mean an SDL error... or maybe not?
214
235
  boolean? :get_color_key, TRUE_WHEN_ZERO
215
- api :SDL_SetSurfaceColorMod, [Surface.by_ref, :uint8, :uint8, :uint8], :int
216
- api :SDL_GetSurfaceColorMod, [Surface.by_ref, UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref], :int
217
- api :SDL_SetSurfaceAlphaMod, [Surface.by_ref, :uint8], :int, {error: true}
218
- api :SDL_GetSurfaceAlphaMod, [Surface.by_ref,UInt8Struct.by_ref], :int, {error: true}
219
- api :SDL_SetSurfaceBlendMode, [Surface.by_ref, :blend_mode], :int, {error: true}
220
- api :SDL_GetSurfaceBlendMode, [Surface.by_ref, BlendModeStruct.by_ref], :int, {error: true}
221
- api :SDL_SetClipRect, [Surface.by_ref, Rect.by_ref], :int, {error: true}
222
- api :SDL_GetClipRect, [Surface.by_ref, Rect.by_ref], :int, {error: true}
223
- api :SDL_ConvertSurface, [Surface.by_ref, PixelFormat.by_ref, :surface_flags], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
224
- api :SDL_ConvertSurfaceFormat, [Surface.by_ref, :pixel_format, :surface_flags], Surface.auto_ptr
225
- api :SDL_ConvertPixels, [:int, :int, :pixel_format, :pointer, :int, :pixel_format, :pointer, :int], :int, {error: true}
226
- api :SDL_FillRect, [Surface.by_ref, Rect.by_ref, :uint32], :int, {error: true}
227
- api :SDL_FillRects, [Surface.by_ref, Rect.by_ref, :count, :uint32], :int, {error: true}
228
- api :SDL_UpperBlit, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int, {error: true}
236
+ ##
237
+ #
238
+ api :SDL_SetSurfaceColorMod, [Surface.by_ref, :uint8, :uint8, :uint8], :int
239
+ ##
240
+ #
241
+ api :SDL_GetSurfaceColorMod, [Surface.by_ref, UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref], :int
242
+ ##
243
+ #
244
+ api :SDL_SetSurfaceAlphaMod, [Surface.by_ref, :uint8], :int, {error: true}
245
+ ##
246
+ #
247
+ api :SDL_GetSurfaceAlphaMod, [Surface.by_ref,UInt8Struct.by_ref], :int, {error: true}
248
+ ##
249
+ #
250
+ api :SDL_SetSurfaceBlendMode, [Surface.by_ref, :blend_mode], :int, {error: true}
251
+ ##
252
+ #
253
+ api :SDL_GetSurfaceBlendMode, [Surface.by_ref, BlendModeStruct.by_ref], :int, {error: true}
254
+ ##
255
+ #
256
+ api :SDL_SetClipRect, [Surface.by_ref, Rect.by_ref], :int, {error: true}
257
+ ##
258
+ #
259
+ api :SDL_GetClipRect, [Surface.by_ref, Rect.by_ref], :int, {error: true}
260
+ ##
261
+ #
262
+ api :SDL_ConvertSurface, [Surface.by_ref, PixelFormat.by_ref, :surface_flags], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
263
+ ##
264
+ #
265
+ api :SDL_ConvertSurfaceFormat, [Surface.by_ref, :pixel_format, :surface_flags], Surface.auto_ptr
266
+ ##
267
+ #
268
+ api :SDL_ConvertPixels, [:int, :int, :pixel_format, :pointer, :int, :pixel_format, :pointer, :int], :int, {error: true}
269
+ ##
270
+ #
271
+ api :SDL_FillRect, [Surface.by_ref, Rect.by_ref, :uint32], :int, {error: true}
272
+ ##
273
+ #
274
+ api :SDL_FillRects, [Surface.by_ref, Rect.by_ref, :count, :uint32], :int, {error: true}
275
+ ##
276
+ #
277
+ api :SDL_UpperBlit, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int, {error: true}
229
278
 
230
279
  # using upper_blit
231
280
  def self.blit_surface(src, srcrect, dst, dstrect)
@@ -235,9 +284,15 @@ module SDL2
235
284
 
236
285
  returns_error(:blit_surface, TRUE_WHEN_ZERO)
237
286
 
238
- api :SDL_LowerBlit, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
239
- api :SDL_SoftStretch, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
240
- api :SDL_UpperBlitScaled, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
287
+ ##
288
+ #
289
+ api :SDL_LowerBlit, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
290
+ ##
291
+ #
292
+ api :SDL_SoftStretch, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
293
+ ##
294
+ #
295
+ api :SDL_UpperBlitScaled, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
241
296
 
242
297
  # using upper_blit_scaled
243
298
  def self.blit_scaled(src, srcrect, dst, dstrect)
@@ -246,6 +301,8 @@ module SDL2
246
301
 
247
302
  returns_error(:blit_scaled, TRUE_WHEN_ZERO)
248
303
 
249
- api :SDL_LowerBlitScaled, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
304
+ ##
305
+ #
306
+ api :SDL_LowerBlitScaled, [Surface.by_ref, Rect.by_ref, Surface.by_ref, Rect.by_ref], :int
250
307
 
251
308
  end
data/lib/sdl2/syswm.rb CHANGED
@@ -15,6 +15,8 @@ module SDL2 # SDL_syswm.h
15
15
  # Line 99~107
16
16
  enum :syswm_type, [:unkown, :window, :x11, :directfb, :cocoa, :uikit]
17
17
 
18
- api :SDL_GetWindowWMInfo, [Window.by_ref, SYSWM::Info.by_ref], :bool
18
+ ##
19
+ #
20
+ api :SDL_GetWindowWMInfo, [Window.by_ref, SYSWM::Info.by_ref], :bool
19
21
 
20
22
  end
data/lib/sdl2/timer.rb CHANGED
@@ -2,16 +2,28 @@ require 'sdl2'
2
2
 
3
3
  module SDL2
4
4
 
5
- api :SDL_GetTicks, [], :uint32
6
- api :SDL_GetPerformanceCounter, [], :uint64
7
- api :SDL_GetPerformanceFrequency, [], :uint64
8
- api :SDL_Delay, [:uint32], :void
5
+ ##
6
+ #
7
+ api :SDL_GetTicks, [], :uint32
8
+ ##
9
+ #
10
+ api :SDL_GetPerformanceCounter, [], :uint64
11
+ ##
12
+ #
13
+ api :SDL_GetPerformanceFrequency, [], :uint64
14
+ ##
15
+ #
16
+ api :SDL_Delay, [:uint32], :void
9
17
 
10
18
  callback :timer_callback, [:uint32, :pointer], :uint32
11
19
 
12
20
  typedef :int, :timer_id
13
21
 
14
- api :SDL_AddTimer, [:uint32, :timer_callback, :pointer], :timer_id
15
- api :SDL_RemoveTimer, [:timer_id], :bool
22
+ ##
23
+ #
24
+ api :SDL_AddTimer, [:uint32, :timer_callback, :pointer], :timer_id
25
+ ##
26
+ #
27
+ api :SDL_RemoveTimer, [:timer_id], :bool
16
28
 
17
29
  end
data/lib/sdl2/touch.rb CHANGED
@@ -15,10 +15,18 @@ module SDL2
15
15
 
16
16
  TOUCH_MOUSEID = -1
17
17
 
18
- api :SDL_GetNumTouchDevices, [], :int
19
- api :SDL_GetTouchDevice, [:int], :touch_id
20
- api :SDL_GetNumTouchFingers, [:touch_id], :int
21
- api :SDL_GetTouchFinger, [:touch_id, :int], Finger.by_ref
18
+ ##
19
+ #
20
+ api :SDL_GetNumTouchDevices, [], :int
21
+ ##
22
+ #
23
+ api :SDL_GetTouchDevice, [:int], :touch_id
24
+ ##
25
+ #
26
+ api :SDL_GetNumTouchFingers, [:touch_id], :int
27
+ ##
28
+ #
29
+ api :SDL_GetTouchFinger, [:touch_id, :int], Finger.by_ref
22
30
 
23
31
 
24
32
  end
data/lib/sdl2/ttf.rb CHANGED
@@ -15,18 +15,32 @@ module SDL2
15
15
  extend SDL2::Library
16
16
  ffi_lib SDL_TTF_MODULE
17
17
 
18
- api :TTF_Linked_Version, [], Version.auto_ptr
18
+ ##
19
+ #
20
+ api :TTF_Linked_Version, [], Version.auto_ptr
19
21
 
20
22
  UNICODE_BOM_NATIVE = 0xFEFF
21
23
  UNICODE_BOM_SWAPPED = 0xFFFE
22
24
 
23
- api :TTF_ByteSwappedUNICODE, [:int], :void
24
-
25
- api :TTF_Init, [], :int, {error: true, filter: TRUE_WHEN_ZERO}
26
- api :TTF_OpenFont, [:string, :int], Font.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
27
- api :TTF_OpenFontIndex, [:string, :int, :long], Font.auto_ptr
28
- api :TTF_OpenFontRW, [RWops.by_ref, :int, :int], Font.auto_ptr
29
- api :TTF_OpenFontIndexRW, [RWops.by_ref, :int, :int, :long], Font.auto_ptr
25
+ ##
26
+ #
27
+ api :TTF_ByteSwappedUNICODE, [:int], :void
28
+
29
+ ##
30
+ #
31
+ api :TTF_Init, [], :int, {error: true, filter: TRUE_WHEN_ZERO}
32
+ ##
33
+ #
34
+ api :TTF_OpenFont, [:string, :int], Font.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
35
+ ##
36
+ #
37
+ api :TTF_OpenFontIndex, [:string, :int, :long], Font.auto_ptr
38
+ ##
39
+ #
40
+ api :TTF_OpenFontRW, [RWops.by_ref, :int, :int], Font.auto_ptr
41
+ ##
42
+ #
43
+ api :TTF_OpenFontIndexRW, [RWops.by_ref, :int, :int, :long], Font.auto_ptr
30
44
 
31
45
  module STYLE
32
46
  include EnumerableConstants
@@ -39,10 +53,18 @@ module SDL2
39
53
 
40
54
  enum :font_style, STYLE.flatten_consts
41
55
 
42
- api :TTF_GetFontStyle, [Font.by_ref], :int
43
- api :TTF_SetFontStyle, [Font.by_ref, :int], :void
44
- api :TTF_GetFontOutline, [Font.by_ref], :int
45
- api :TTF_SetFontOutline, [Font.by_ref, :int], :void
56
+ ##
57
+ #
58
+ api :TTF_GetFontStyle, [Font.by_ref], :int
59
+ ##
60
+ #
61
+ api :TTF_SetFontStyle, [Font.by_ref, :int], :void
62
+ ##
63
+ #
64
+ api :TTF_GetFontOutline, [Font.by_ref], :int
65
+ ##
66
+ #
67
+ api :TTF_SetFontOutline, [Font.by_ref, :int], :void
46
68
 
47
69
  module HINTING
48
70
  include EnumerableConstants
@@ -53,23 +75,51 @@ module SDL2
53
75
  end
54
76
  enum :hinting, HINTING.flatten_consts
55
77
 
56
- api :TTF_GetFontHinting, [Font.by_ref], :hinting
57
- api :TTF_SetFontHinting, [Font.by_ref, :int], :void
58
-
59
- api :TTF_FontHeight, [Font.by_ref], :int
60
- api :TTF_FontAscent, [Font.by_ref], :int
61
- api :TTF_FontDescent, [Font.by_ref], :int
62
- api :TTF_FontLineSkip, [Font.by_ref], :int
63
- api :TTF_GetFontKerning, [Font.by_ref], :int
64
- api :TTF_SetFontKerning, [Font.by_ref], :int
65
- api :TTF_FontFaces, [Font.by_ref], :long
66
- api :TTF_FontFaceIsFixedWidth, [Font.by_ref], :int
67
- api :TTF_FontFaceFamilyName, [Font.by_ref], :string
68
- api :TTF_FontFaceStyleName, [Font.by_ref], :string
69
-
70
- api :TTF_GlyphIsProvided, [Font.by_ref, :uint16], :int
71
-
72
- api :TTF_GlyphMetrics, [
78
+ ##
79
+ #
80
+ api :TTF_GetFontHinting, [Font.by_ref], :hinting
81
+ ##
82
+ #
83
+ api :TTF_SetFontHinting, [Font.by_ref, :int], :void
84
+
85
+ ##
86
+ #
87
+ api :TTF_FontHeight, [Font.by_ref], :int
88
+ ##
89
+ #
90
+ api :TTF_FontAscent, [Font.by_ref], :int
91
+ ##
92
+ #
93
+ api :TTF_FontDescent, [Font.by_ref], :int
94
+ ##
95
+ #
96
+ api :TTF_FontLineSkip, [Font.by_ref], :int
97
+ ##
98
+ #
99
+ api :TTF_GetFontKerning, [Font.by_ref], :int
100
+ ##
101
+ #
102
+ api :TTF_SetFontKerning, [Font.by_ref], :int
103
+ ##
104
+ #
105
+ api :TTF_FontFaces, [Font.by_ref], :long
106
+ ##
107
+ #
108
+ api :TTF_FontFaceIsFixedWidth, [Font.by_ref], :int
109
+ ##
110
+ #
111
+ api :TTF_FontFaceFamilyName, [Font.by_ref], :string
112
+ ##
113
+ #
114
+ api :TTF_FontFaceStyleName, [Font.by_ref], :string
115
+
116
+ ##
117
+ #
118
+ api :TTF_GlyphIsProvided, [Font.by_ref, :uint16], :int
119
+
120
+ ##
121
+ #
122
+ api :TTF_GlyphMetrics, [
73
123
  Font.by_ref,
74
124
  :uint16,
75
125
  IntStruct.by_ref,
@@ -79,36 +129,80 @@ module SDL2
79
129
  IntStruct.by_ref
80
130
  ], :int
81
131
 
82
- api :TTF_SizeText, [Font.by_ref, :string, IntStruct.by_ref, IntStruct.by_ref], :int
83
- api :TTF_SizeUTF8, [Font.by_ref, :string, IntStruct.by_ref, IntStruct.by_ref], :int
84
- api :TTF_SizeUNICODE, [Font.by_ref, :string, IntStruct.by_ref, IntStruct.by_ref], :int
85
-
86
- api :TTF_RenderText_Solid, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
87
- api :TTF_RenderUTF8_Solid, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
88
- api :TTF_RenderUNICODE_Solid, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
89
-
90
- api :TTF_RenderGlyph_Solid, [Font.by_ref, :uint16, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
91
-
92
- api :TTF_RenderText_Shaded, [Font.by_ref, :string, Color.by_value, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
93
- api :TTF_RenderUTF8_Shaded, [Font.by_ref, :string, Color.by_value, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
94
- api :TTF_RenderUNICODE_Shaded, [Font.by_ref, :string, Color.by_value, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
95
-
96
- api :TTF_RenderGlyph_Shaded, [Font.by_ref, :uint16, Color.by_value, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
97
-
98
- api :TTF_RenderText_Blended, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
99
- api :TTF_RenderUTF8_Blended, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
100
- api :TTF_RenderUNICODE_Blended, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
101
-
102
- api :TTF_RenderText_Blended_Wrapped, [Font.by_ref, :string, Color.by_value, :uint32], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
103
- api :TTF_RenderUTF8_Blended_Wrapped, [Font.by_ref, :string, Color.by_value, :uint32], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
104
- api :TTF_RenderUNICODE_Blended_Wrapped, [Font.by_ref, :string, Color.by_value, :uint32], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
105
-
106
- api :TTF_RenderGlyph_Blended, [Font.by_ref, :uint16, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
107
-
108
- api :TTF_CloseFont, [Font.by_ref], :void
109
- api :TTF_Quit, [], :void
110
- api :TTF_WasInit, [], :int
111
- api :TTF_GetFontKerningSize, [Font.by_ref, :int, :int], :int
132
+ ##
133
+ #
134
+ api :TTF_SizeText, [Font.by_ref, :string, IntStruct.by_ref, IntStruct.by_ref], :int
135
+ ##
136
+ #
137
+ api :TTF_SizeUTF8, [Font.by_ref, :string, IntStruct.by_ref, IntStruct.by_ref], :int
138
+ ##
139
+ #
140
+ api :TTF_SizeUNICODE, [Font.by_ref, :string, IntStruct.by_ref, IntStruct.by_ref], :int
141
+
142
+ ##
143
+ #
144
+ api :TTF_RenderText_Solid, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
145
+ ##
146
+ #
147
+ api :TTF_RenderUTF8_Solid, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
148
+ ##
149
+ #
150
+ api :TTF_RenderUNICODE_Solid, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
151
+
152
+ ##
153
+ #
154
+ api :TTF_RenderGlyph_Solid, [Font.by_ref, :uint16, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
155
+
156
+ ##
157
+ #
158
+ api :TTF_RenderText_Shaded, [Font.by_ref, :string, Color.by_value, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
159
+ ##
160
+ #
161
+ api :TTF_RenderUTF8_Shaded, [Font.by_ref, :string, Color.by_value, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
162
+ ##
163
+ #
164
+ api :TTF_RenderUNICODE_Shaded, [Font.by_ref, :string, Color.by_value, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
165
+
166
+ ##
167
+ #
168
+ api :TTF_RenderGlyph_Shaded, [Font.by_ref, :uint16, Color.by_value, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
169
+
170
+ ##
171
+ #
172
+ api :TTF_RenderText_Blended, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
173
+ ##
174
+ #
175
+ api :TTF_RenderUTF8_Blended, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
176
+ ##
177
+ #
178
+ api :TTF_RenderUNICODE_Blended, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
179
+
180
+ ##
181
+ #
182
+ api :TTF_RenderText_Blended_Wrapped, [Font.by_ref, :string, Color.by_value, :uint32], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
183
+ ##
184
+ #
185
+ api :TTF_RenderUTF8_Blended_Wrapped, [Font.by_ref, :string, Color.by_value, :uint32], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
186
+ ##
187
+ #
188
+ api :TTF_RenderUNICODE_Blended_Wrapped, [Font.by_ref, :string, Color.by_value, :uint32], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
189
+
190
+ ##
191
+ #
192
+ api :TTF_RenderGlyph_Blended, [Font.by_ref, :uint16, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
193
+
194
+ ##
195
+ #
196
+ api :TTF_CloseFont, [Font.by_ref], :void
197
+ ##
198
+ #
199
+ api :TTF_Quit, [], :void
200
+ ##
201
+ #
202
+ api :TTF_WasInit, [], :int
203
+ ##
204
+ #
205
+ api :TTF_GetFontKerningSize, [Font.by_ref, :int, :int], :int
112
206
 
113
207
  end
114
208