sdl2_ffi 0.0.6 → 0.0.7

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 (204) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/Gemfile +0 -6
  4. data/Guardfile +0 -45
  5. data/README.md +11 -21
  6. data/lib/bad_sdl.rb +4 -0
  7. data/lib/{sdl2 → bad_sdl}/application.rb +47 -35
  8. data/lib/{sdl2 → bad_sdl}/engine.rb +20 -3
  9. data/lib/{sdl2 → bad_sdl}/engine/block_engine.rb +2 -2
  10. data/lib/bad_sdl/engine/engines.rb +51 -0
  11. data/lib/enumerable_constants.rb +4 -2
  12. data/lib/sdl2.rb +26 -247
  13. data/lib/sdl2/blendmode.rb +18 -0
  14. data/lib/sdl2/color.rb +1 -3
  15. data/lib/sdl2/debug.rb +58 -0
  16. data/lib/sdl2/display.rb +30 -23
  17. data/lib/sdl2/error.rb +6 -4
  18. data/lib/sdl2/event.rb +229 -0
  19. data/lib/sdl2/event/abstract.rb +11 -0
  20. data/lib/sdl2/event/action.rb +19 -0
  21. data/lib/sdl2/event/common.rb +10 -0
  22. data/lib/sdl2/event/controller_axis.rb +20 -0
  23. data/lib/sdl2/event/controller_button.rb +17 -0
  24. data/lib/sdl2/event/controller_device.rb +14 -0
  25. data/lib/sdl2/event/dollar_gesture.rb +19 -0
  26. data/lib/sdl2/event/drop.rb +18 -0
  27. data/lib/sdl2/event/joy_axis.rb +20 -0
  28. data/lib/sdl2/event/joy_ball.rb +20 -0
  29. data/lib/sdl2/event/joy_button.rb +18 -0
  30. data/lib/sdl2/event/joy_device.rb +14 -0
  31. data/lib/sdl2/event/joy_hat.rb +18 -0
  32. data/lib/sdl2/event/keyboard.rb +18 -0
  33. data/lib/sdl2/event/mouse_button.rb +21 -0
  34. data/lib/sdl2/event/mouse_motion.rb +19 -0
  35. data/lib/sdl2/event/mouse_wheel.rb +17 -0
  36. data/lib/sdl2/event/multi_gesture.rb +20 -0
  37. data/lib/sdl2/event/os.rb +12 -0
  38. data/lib/sdl2/event/quit.rb +12 -0
  39. data/lib/sdl2/event/state.rb +13 -0
  40. data/lib/sdl2/event/sys_wm.rb +15 -0
  41. data/lib/sdl2/event/text_editing.rb +17 -0
  42. data/lib/sdl2/event/text_input.rb +15 -0
  43. data/lib/sdl2/event/touch_finger.rb +20 -0
  44. data/lib/sdl2/event/type.rb +62 -0
  45. data/lib/sdl2/event/user.rb +15 -0
  46. data/lib/sdl2/event/window.rb +19 -0
  47. data/lib/sdl2/events.rb +23 -538
  48. data/lib/sdl2/gem_version.rb +1 -1
  49. data/lib/sdl2/haptic.rb +3 -3
  50. data/lib/sdl2/hints.rb +3 -1
  51. data/lib/sdl2/image.rb +20 -20
  52. data/lib/sdl2/init.rb +5 -8
  53. data/lib/sdl2/joystick.rb +104 -78
  54. data/lib/sdl2/joystick/axes.rb +22 -0
  55. data/lib/sdl2/joystick/balls.rb +24 -0
  56. data/lib/sdl2/joystick/buttons.rb +22 -0
  57. data/lib/sdl2/joystick/components.rb +23 -0
  58. data/lib/sdl2/joystick/hats.rb +22 -0
  59. data/lib/sdl2/keyboard.rb +11 -10
  60. data/lib/sdl2/keycode.rb +70 -70
  61. data/lib/sdl2/library.rb +8 -7
  62. data/lib/sdl2/log.rb +6 -0
  63. data/lib/sdl2/managed_struct.rb +17 -0
  64. data/lib/sdl2/mixer.rb +16 -12
  65. data/lib/sdl2/mixer/chunk.rb +14 -3
  66. data/lib/sdl2/mouse.rb +21 -41
  67. data/lib/sdl2/pixel_format.rb +4 -4
  68. data/lib/sdl2/pixels.rb +59 -47
  69. data/lib/sdl2/power.rb +1 -1
  70. data/lib/sdl2/rect.rb +4 -5
  71. data/lib/sdl2/render.rb +85 -170
  72. data/lib/sdl2/renderer.rb +337 -20
  73. data/lib/sdl2/rwops.rb +89 -30
  74. data/lib/sdl2/stdinc.rb +18 -21
  75. data/lib/sdl2/struct.rb +184 -0
  76. data/lib/sdl2/struct_helper.rb +32 -0
  77. data/lib/sdl2/surface.rb +15 -14
  78. data/lib/sdl2/syswm.rb +26 -10
  79. data/lib/sdl2/syswm/msg.rb +22 -4
  80. data/lib/sdl2/texture.rb +106 -0
  81. data/lib/sdl2/touch.rb +16 -20
  82. data/lib/sdl2/ttf.rb +29 -29
  83. data/lib/sdl2/ttf/sdl_ttf_module.rb +1 -1
  84. data/lib/sdl2/typed_pointer.rb +45 -0
  85. data/lib/sdl2/union.rb +7 -0
  86. data/lib/sdl2/video.rb +97 -183
  87. data/lib/sdl2/window.rb +140 -90
  88. data/lib/struct_array.rb +42 -0
  89. data/sdl2_ffi.gemspec +3 -3
  90. data/spec/fixtures/approvals/lazyfoonet_lesson_03_advanced_timers/has_a_message.approved.png +0 -0
  91. data/spec/fixtures/approvals/lazyfoonet_lesson_07_true_type_fonts/draws_the_message_to_the_screen.approved.png +0 -0
  92. data/spec/fixtures/approvals/lazyfoonet_lesson_14_advanced_timers/has_a_message.approved.png +0 -0
  93. data/spec/fixtures/approvals/lazyfoonet_lesson_14_advanced_timers/has_drawn_something.approved.png +0 -0
  94. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_clear.approved.png +0 -0
  95. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_draw_a_line_connecting_many_points.approved.png +0 -0
  96. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_draw_a_point.approved.png +0 -0
  97. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_draw_a_single_filled_rectangle.approved.png +0 -0
  98. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_draw_a_single_pixel_line.approved.png +0 -0
  99. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_draw_a_single_rectangle.approved.png +0 -0
  100. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_draw_many_filled_rectangles.approved.png +0 -0
  101. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_draw_many_rectangles_at_once.approved.png +0 -0
  102. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_draw_points.approved.png +0 -0
  103. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_render_textures.approved.png +0 -0
  104. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_be_able_to_rotate_and_flip_while_rendering_textures.approved.png +0 -0
  105. data/spec/fixtures/approvals/sdl2/sdl2_renderer/should_have_a_clip_rect.approved.png +0 -0
  106. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_clear.approved.png +0 -0
  107. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_draw_a_line_connecting_many_points.approved.png +0 -0
  108. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_draw_a_point.approved.png +0 -0
  109. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_draw_a_single_filled_rectangle.approved.png +0 -0
  110. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_draw_a_single_pixel_line.approved.png +0 -0
  111. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_draw_a_single_rectangle.approved.png +0 -0
  112. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_draw_many_filled_rectangles.approved.png +0 -0
  113. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_draw_many_rectangles_at_once.approved.png +0 -0
  114. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_draw_points.approved.png +0 -0
  115. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_render_textures.approved.png +0 -0
  116. data/spec/fixtures/approvals/sdl2_renderer/should_be_able_to_rotate_and_flip_while_rendering_textures.approved.png +0 -0
  117. data/spec/fixtures/approvals/sdl2_renderer/should_have_a_clip_rect.approved.png +0 -0
  118. data/spec/fixtures/images/finger.png +0 -0
  119. data/spec/fixtures/music/beat.wav +0 -0
  120. data/spec/fixtures/sounds/high.wav +0 -0
  121. data/spec/fixtures/sounds/low.wav +0 -0
  122. data/spec/fixtures/sounds/medium.wav +0 -0
  123. data/spec/fixtures/sounds/scratch.wav +0 -0
  124. data/spec/functional/lazy_foo_tutorial/lazy_foo_01_hello_world_spec.rb +4 -6
  125. data/spec/functional/lazy_foo_tutorial/lazy_foo_02_optimized_images_spec.rb +3 -4
  126. data/spec/functional/lazy_foo_tutorial/lazy_foo_03_extension_libraries_spec.rb +2 -2
  127. data/spec/functional/lazy_foo_tutorial/lazy_foo_04_event_driven_programming_spec.rb +3 -3
  128. data/spec/functional/lazy_foo_tutorial/lazy_foo_05_color_keying_spec.rb +1 -1
  129. data/spec/functional/lazy_foo_tutorial/lazy_foo_06_clip_blitting_and_sprite_sheets_spec.rb +1 -1
  130. data/spec/functional/lazy_foo_tutorial/lazy_foo_07_true_type_fonts_spec.rb +3 -2
  131. data/spec/functional/lazy_foo_tutorial/lazy_foo_08_key_presses_spec.rb +9 -7
  132. data/spec/functional/lazy_foo_tutorial/lazy_foo_09_mouse_events_spec.rb +11 -8
  133. data/spec/functional/lazy_foo_tutorial/lazy_foo_10_key_states_spec.rb +5 -4
  134. data/spec/functional/lazy_foo_tutorial/lazy_foo_11_playing_sounds_spec.rb +17 -9
  135. data/spec/functional/lazy_foo_tutorial/lazy_foo_12_timing_spec.rb +8 -7
  136. data/spec/functional/lazy_foo_tutorial/lazy_foo_13_advanced_timers_spec.rb +85 -0
  137. data/spec/functional/lazy_foo_tutorial/lazy_foo_14_regulating_frame_rate_spec.rb +67 -0
  138. data/spec/functional/lazy_foo_tutorial/lazy_foo_15_calculating_frame_rate_spec.rb +48 -0
  139. data/spec/functional/lazy_foo_tutorial/lazy_foo_16_motion_spec.rb +95 -0
  140. data/spec/functional/lazy_foo_tutorial/lazy_foo_helper.rb +3 -1
  141. data/spec/functional/lazy_foo_tutorial/timer.rb +55 -0
  142. data/spec/lib/bad_sdl/application_spec.rb +22 -0
  143. data/spec/{unit → lib}/sdl2/color_spec.rb +5 -1
  144. data/spec/lib/sdl2/display_spec.rb +6 -0
  145. data/spec/lib/sdl2/event_spec.rb +102 -0
  146. data/spec/lib/sdl2/events_spec.rb +12 -0
  147. data/spec/lib/sdl2/joystick_spec.rb +130 -0
  148. data/spec/lib/sdl2/keyboard_spec.rb +22 -0
  149. data/spec/lib/sdl2/mouse_spec.rb +21 -0
  150. data/spec/lib/sdl2/render_spec.rb +62 -0
  151. data/spec/lib/sdl2/renderer_spec.rb +224 -0
  152. data/spec/lib/sdl2/sdl2_helper.rb +5 -0
  153. data/spec/lib/sdl2/texture_spec.rb +65 -0
  154. data/{test/unit/sdl2/test_video.rb → spec/lib/sdl2/video_spec.rb} +82 -57
  155. data/spec/lib/sdl2/window_spec.rb +42 -0
  156. data/spec/{unit → lib}/unit_helper.rb +0 -0
  157. data/spec/png_writer.rb +9 -1
  158. data/spec/spec_helper.rb +5 -3
  159. metadata +201 -132
  160. data/lib/sdl2/engine/engines.rb +0 -46
  161. data/test/approvals/clip_blitting_and_sprite_sheets.received.bmp +0 -0
  162. data/test/approvals/color_keying_example.approved.png +0 -0
  163. data/test/approvals/hello_world_example_hello.approved.png +0 -0
  164. data/test/approvals/hello_world_example_screen.approved.png +0 -0
  165. data/test/approvals/optimized_surface_loading.approved.png +0 -0
  166. data/test/fixtures/an_example.png +0 -0
  167. data/test/fixtures/background.bmp +0 -0
  168. data/test/fixtures/background.jpg +0 -0
  169. data/test/fixtures/color_bars.jpg +0 -0
  170. data/test/fixtures/foo.jpg +0 -0
  171. data/test/fixtures/hello.bmp +0 -0
  172. data/test/fixtures/sprites.jpg +0 -0
  173. data/test/fixtures/x.png +0 -0
  174. data/test/functional/examples/lazyfoo.net_s/test_clip_blitting_and_sprite_sheets.rb +0 -50
  175. data/test/functional/examples/lazyfoo.net_s/test_color_keying.rb +0 -42
  176. data/test/functional/examples/test_lazy_foo_examples.rb +0 -195
  177. data/test/functional/examples/test_readme_examples.rb +0 -15
  178. data/test/test_helper.rb +0 -13
  179. data/test/unit/sdl2/test_assert.rb +0 -10
  180. data/test/unit/sdl2/test_audio.rb +0 -9
  181. data/test/unit/sdl2/test_clipboard.rb +0 -13
  182. data/test/unit/sdl2/test_cpuinfo.rb +0 -11
  183. data/test/unit/sdl2/test_error.rb +0 -20
  184. data/test/unit/sdl2/test_events.rb +0 -31
  185. data/test/unit/sdl2/test_haptic.rb +0 -27
  186. data/test/unit/sdl2/test_hints.rb +0 -50
  187. data/test/unit/sdl2/test_image.rb +0 -9
  188. data/test/unit/sdl2/test_init.rb +0 -29
  189. data/test/unit/sdl2/test_keyboard.rb +0 -9
  190. data/test/unit/sdl2/test_log.rb +0 -80
  191. data/test/unit/sdl2/test_palette.rb +0 -26
  192. data/test/unit/sdl2/test_pixel_format.rb +0 -38
  193. data/test/unit/sdl2/test_pixels.rb +0 -24
  194. data/test/unit/sdl2/test_power.rb +0 -11
  195. data/test/unit/sdl2/test_rect.rb +0 -19
  196. data/test/unit/sdl2/test_render.rb +0 -58
  197. data/test/unit/sdl2/test_surface.rb +0 -88
  198. data/test/unit/sdl2/test_syswm.rb +0 -11
  199. data/test/unit/sdl2/test_timer.rb +0 -9
  200. data/test/unit/sdl2/test_ttf.rb +0 -11
  201. data/test/unit/sdl2/test_version.rb +0 -16
  202. data/test/unit/sdl2/test_window.rb +0 -155
  203. data/test/unit/test_scratch.rb +0 -19
  204. data/test/unit/test_sdl2.rb +0 -16
@@ -2,8 +2,114 @@ require 'sdl2'
2
2
  # Stub for now.. need to implement!!!
3
3
  module SDL2
4
4
  class Texture < FFI::Struct
5
+ layout :magic, :pointer,
6
+ :format, :uint32,
7
+ :access, :int,
8
+ :w, :int,
9
+ :h, :int,
10
+ :mod_mode, :int,
11
+ :blend_mode, :blend_mode,
12
+ :r, :uint8,
13
+ :g, :uint8,
14
+ :b, :uint8,
15
+ :a, :uint8,
16
+ :renderer, :pointer,
17
+ :native, :pointer,
18
+ :yuv, :pointer, #TODO: Review SDL_SW_YUVTexture
19
+ :pixels, :pointer,
20
+ :pitch, :int,
21
+ :locked_rect, :pointer,
22
+ :driverdata, :pointer,
23
+ :prev, :pointer,
24
+ :next, :pointer
25
+
26
+ ##
27
+ # Ensures the texture is properly disposed of
5
28
  def self.release(pointer)
6
29
  SDL2.destroy_texture(pointer)
7
30
  end
31
+ ##
32
+ # Constructs a texture within a renderer
33
+ def self.create(renderer, format, access, w, h)
34
+ SDL2.create_texture!(renderer, format, access, w, h)
35
+ end
36
+ ##
37
+ # Destroy this texture
38
+ def destroy
39
+ SDL2.destroy_texture(self)
40
+ end
41
+ ##
42
+ # Returns the alpha modulation (0~255)
43
+ def alpha_mod
44
+ alpha = SDL2::TypedPointer::UInt8.new
45
+ SDL2.get_texture_alpha_mod!(self, alpha)
46
+ alpha.value
47
+ end
48
+ ##
49
+ # Sets the alpha modulation (0~255)
50
+ def alpha_mod=(uInt8)
51
+ SDL2.set_texture_alpha_mod!(self, uInt8)
52
+ end
53
+ ##
54
+ # Returns the blend mode
55
+ #NOTE: This will be a symbol of the constant value.
56
+ def blend_mode
57
+ blend_mode = SDL2::TypedPointer::BlendMode.new
58
+ SDL2.get_texture_blend_mode!(self, blend_mode)
59
+ blend_mode.value
60
+ end
61
+ ##
62
+ # Accepts a new blend mode value.
63
+ # NOTE: Accepts symbol or SDL2::BLENDMODE constant values.
64
+ def blend_mode=(blend_mode)
65
+ SDL2.set_texture_blend_mode!(self, blend_mode)
66
+ end
67
+ ##
68
+ # Returns the color modulation, an array of 3 integers (0~255)
69
+ def color_mod
70
+ colors = 3.times.map{SDL2::TypedPointer::UInt8.new}
71
+ SDL2.get_texture_color_mod!(self, *colors)
72
+ colors.map(&:value)
73
+ end
74
+ ##
75
+ # Sets the color modulation, expects an array of 3 integers (0~255)
76
+ def color_mod=(colors)
77
+ raise "At least 3 for RGB, not #{colors.count}" if colors.count < 3
78
+ SDL2.set_texture_color_mod!(self, *colors.first(3))
79
+ colors
80
+ end
81
+ ##
82
+ # Lock a portion (or all) of a texture for write access
83
+ # Returns: [pointer, pitch]
84
+ # pointer - An FFI::Pointer to the locked pixels
85
+ # pitch - An integer pitch value
86
+ def lock(rect = nil)
87
+ pointer = SDL2::TypedPointer::Pointer.new
88
+ pitch = SDL2::TypedPointer::Int.new
89
+ SDL2.lock_texture!(self, rect, pointer, pitch)
90
+ [pointer.value, pitch.value]
91
+ end
92
+ ##
93
+ # Unlock
94
+ def unlock()
95
+ SDL2.unlock_texture(self)
96
+ end
97
+ ##
98
+ # Query the texture about itself:
99
+ # Returns: [format, access, w, h]
100
+ # format - An SDL2::PIXELFORMAT value
101
+ # access - AN SDL2::TEXTUREACCESS value
102
+ # w - an integer representing the width
103
+ # h - an integer representing the height
104
+ def query()
105
+ query = [
106
+ SDL2::TypedPointer::PixelFormat.new,
107
+ SDL2::TypedPointer::TextureAccess.new,
108
+ SDL2::TypedPointer::Int.new,
109
+ SDL2::TypedPointer::Int.new
110
+ ]
111
+ SDL2.query_texture!(self, *query)
112
+ query.map(&:value)
113
+ end
8
114
  end
9
115
  end
@@ -2,31 +2,27 @@ require 'sdl2'
2
2
  require 'sdl2/video'
3
3
 
4
4
  module SDL2
5
-
5
+
6
6
  typedef :int64, :touch_id
7
7
  typedef :int64, :finger_id
8
-
9
- class Finger < Struct
10
- layout :id, :finger_id,
8
+
9
+ TOUCH_MOUSEID = -1
10
+ ##
11
+ # SDL's touch functionality.
12
+ module Touch
13
+
14
+ class Finger < Struct
15
+
16
+ layout :id, :int64,#:finger_id,
11
17
  :x, :float,
12
18
  :y, :float,
13
19
  :pressure, :float
20
+ end
14
21
  end
15
22
 
16
- TOUCH_MOUSEID = -1
17
-
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
30
-
31
-
23
+ api :SDL_GetNumTouchDevices, [], :int
24
+ api :SDL_GetTouchDevice, [:int], :touch_id
25
+ api :SDL_GetNumTouchFingers, [:touch_id], :int
26
+ api :SDL_GetTouchFinger, [:touch_id, :int], Touch::Finger.by_ref
27
+
32
28
  end
@@ -17,7 +17,7 @@ module SDL2
17
17
 
18
18
  ##
19
19
  #
20
- api :TTF_Linked_Version, [], Version.auto_ptr
20
+ api :TTF_Linked_Version, [], Version.ptr
21
21
 
22
22
  UNICODE_BOM_NATIVE = 0xFEFF
23
23
  UNICODE_BOM_SWAPPED = 0xFFFE
@@ -28,19 +28,19 @@ module SDL2
28
28
 
29
29
  ##
30
30
  #
31
- api :TTF_Init, [], :int, {error: true, filter: TRUE_WHEN_ZERO}
31
+ api :TTF_Init, [], :int, {error: true, filter: OK_WHEN_ZERO}
32
32
  ##
33
33
  #
34
- api :TTF_OpenFont, [:string, :int], Font.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
34
+ api :TTF_OpenFont, [:string, :int], Font.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
35
35
  ##
36
36
  #
37
- api :TTF_OpenFontIndex, [:string, :int, :long], Font.auto_ptr
37
+ api :TTF_OpenFontIndex, [:string, :int, :long], Font.ptr
38
38
  ##
39
39
  #
40
- api :TTF_OpenFontRW, [RWops.by_ref, :int, :int], Font.auto_ptr
40
+ api :TTF_OpenFontRW, [RWops.by_ref, :int, :int], Font.ptr
41
41
  ##
42
42
  #
43
- api :TTF_OpenFontIndexRW, [RWops.by_ref, :int, :int, :long], Font.auto_ptr
43
+ api :TTF_OpenFontIndexRW, [RWops.by_ref, :int, :int, :long], Font.ptr
44
44
 
45
45
  module STYLE
46
46
  include EnumerableConstants
@@ -122,74 +122,74 @@ module SDL2
122
122
  api :TTF_GlyphMetrics, [
123
123
  Font.by_ref,
124
124
  :uint16,
125
- IntStruct.by_ref,
126
- IntStruct.by_ref,
127
- IntStruct.by_ref,
128
- IntStruct.by_ref,
129
- IntStruct.by_ref
125
+ TypedPointer::Int.by_ref,
126
+ TypedPointer::Int.by_ref,
127
+ TypedPointer::Int.by_ref,
128
+ TypedPointer::Int.by_ref,
129
+ TypedPointer::Int.by_ref
130
130
  ], :int
131
131
 
132
132
  ##
133
133
  #
134
- api :TTF_SizeText, [Font.by_ref, :string, IntStruct.by_ref, IntStruct.by_ref], :int
134
+ api :TTF_SizeText, [Font.by_ref, :string, TypedPointer::Int.by_ref, TypedPointer::Int.by_ref], :int
135
135
  ##
136
136
  #
137
- api :TTF_SizeUTF8, [Font.by_ref, :string, IntStruct.by_ref, IntStruct.by_ref], :int
137
+ api :TTF_SizeUTF8, [Font.by_ref, :string, TypedPointer::Int.by_ref, TypedPointer::Int.by_ref], :int
138
138
  ##
139
139
  #
140
- api :TTF_SizeUNICODE, [Font.by_ref, :string, IntStruct.by_ref, IntStruct.by_ref], :int
140
+ api :TTF_SizeUNICODE, [Font.by_ref, :string, TypedPointer::Int.by_ref, TypedPointer::Int.by_ref], :int
141
141
 
142
142
  ##
143
143
  #
144
- api :TTF_RenderText_Solid, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
144
+ api :TTF_RenderText_Solid, [Font.by_ref, :string, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
145
145
  ##
146
146
  #
147
- api :TTF_RenderUTF8_Solid, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
147
+ api :TTF_RenderUTF8_Solid, [Font.by_ref, :string, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
148
148
  ##
149
149
  #
150
- api :TTF_RenderUNICODE_Solid, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
150
+ api :TTF_RenderUNICODE_Solid, [Font.by_ref, :string, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
151
151
 
152
152
  ##
153
153
  #
154
- api :TTF_RenderGlyph_Solid, [Font.by_ref, :uint16, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
154
+ api :TTF_RenderGlyph_Solid, [Font.by_ref, :uint16, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
155
155
 
156
156
  ##
157
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}
158
+ api :TTF_RenderText_Shaded, [Font.by_ref, :string, Color.by_value, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
159
159
  ##
160
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}
161
+ api :TTF_RenderUTF8_Shaded, [Font.by_ref, :string, Color.by_value, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
162
162
  ##
163
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}
164
+ api :TTF_RenderUNICODE_Shaded, [Font.by_ref, :string, Color.by_value, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
165
165
 
166
166
  ##
167
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}
168
+ api :TTF_RenderGlyph_Shaded, [Font.by_ref, :uint16, Color.by_value, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
169
169
 
170
170
  ##
171
171
  #
172
- api :TTF_RenderText_Blended, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
172
+ api :TTF_RenderText_Blended, [Font.by_ref, :string, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
173
173
  ##
174
174
  #
175
- api :TTF_RenderUTF8_Blended, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
175
+ api :TTF_RenderUTF8_Blended, [Font.by_ref, :string, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
176
176
  ##
177
177
  #
178
- api :TTF_RenderUNICODE_Blended, [Font.by_ref, :string, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
178
+ api :TTF_RenderUNICODE_Blended, [Font.by_ref, :string, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
179
179
 
180
180
  ##
181
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}
182
+ api :TTF_RenderText_Blended_Wrapped, [Font.by_ref, :string, Color.by_value, :uint32], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
183
183
  ##
184
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}
185
+ api :TTF_RenderUTF8_Blended_Wrapped, [Font.by_ref, :string, Color.by_value, :uint32], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
186
186
  ##
187
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}
188
+ api :TTF_RenderUNICODE_Blended_Wrapped, [Font.by_ref, :string, Color.by_value, :uint32], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
189
189
 
190
190
  ##
191
191
  #
192
- api :TTF_RenderGlyph_Blended, [Font.by_ref, :uint16, Color.by_value], Surface.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
192
+ api :TTF_RenderGlyph_Blended, [Font.by_ref, :uint16, Color.by_value], Surface.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
193
193
 
194
194
  ##
195
195
  #
@@ -1,5 +1,5 @@
1
1
  module SDL2
2
2
  module TTF
3
- SDL_TTF_MODULE = ['libSDL2_ttf', '/usr/local/lib/libSDL2_ttf.so']
3
+ SDL_TTF_MODULE = ['libSDL2_ttf-2.0.so.0','libSDL2_ttf', '/usr/local/lib/libSDL2_ttf.so']
4
4
  end
5
5
  end
@@ -0,0 +1,45 @@
1
+ module SDL2
2
+ ##
3
+ # BadQuanta says: "Typed pointes let you get to the value."
4
+ class TypedPointer < Struct
5
+ def self.type(kind)
6
+ layout :value, kind
7
+ end
8
+
9
+ def value
10
+ self[:value]
11
+ end
12
+
13
+ alias_method :deref, :value
14
+
15
+ # Simple Type Structures to interface 'typed-pointers'
16
+ # TODO: Research if this is the best way to handle 'typed-pointers'
17
+ class Float < TypedPointer
18
+ type :float
19
+ end
20
+
21
+ # Int-typed pointer
22
+ class Int < TypedPointer
23
+ type :int
24
+ end
25
+
26
+ #
27
+ class UInt16 < TypedPointer
28
+ type :uint16
29
+ end
30
+
31
+ class UInt32 < TypedPointer
32
+ type :uint32
33
+ end
34
+
35
+ class UInt8 < TypedPointer
36
+ type :uint8
37
+ end
38
+
39
+ class Pointer < TypedPointer
40
+ type :pointer
41
+ end
42
+
43
+
44
+ end
45
+ end
@@ -0,0 +1,7 @@
1
+ module SDL2
2
+ ##
3
+ # BadQuanta says: "Even FFI::Unions can be helped."
4
+ class Union < FFI::Union
5
+ extend StructHelper
6
+ end
7
+ end
@@ -11,7 +11,7 @@ require 'sdl2/syswm/info'
11
11
  module SDL2
12
12
  typedef :int, :display_index
13
13
 
14
- enum :window_flags, WINDOW.flatten_consts
14
+ enum :window_flags, Window::FLAGS.flatten_consts
15
15
  # TODO: SDL_video.h lines 113~129
16
16
  enum :window_event_id, WINDOWEVENT.flatten_consts
17
17
 
@@ -22,29 +22,29 @@ module SDL2
22
22
  # OpenGL configuration attributes
23
23
  module GLattr
24
24
  include EnumerableConstants
25
- RED_SIZE
26
- GREEN_SIZE
27
- BLUE_SIZE
28
- ALPHA_SIZE
29
- BUFFER_SIZE
30
- DOUBLEBUFFER
31
- DEPTH_SIZE
32
- STENCIL_SIZE
33
- ACCUM_RED_SIZE
34
- ACCUM_GREEN_SIZE
35
- ACCUM_BLUE_SIZE
36
- ACCUM_ALPHA_SIZE
37
- STEREO
38
- MULTISAMPLEBUFFERS
39
- MULTISAMPLESAMPLES
40
- ACCELERATED_VISUAL
41
- RETAINED_BACKING
42
- CONTEXT_MAJOR_VERSION
43
- CONTEXT_MINOR_VERSION
44
- CONTEXT_EGL
45
- CONTEXT_FLAGS
46
- CONTEXT_PROFILE_MASK
47
- SHARE_WITH_CURRENT_CONTEXT
25
+ RED_SIZE = next_const_value
26
+ GREEN_SIZE = next_const_value
27
+ BLUE_SIZE = next_const_value
28
+ ALPHA_SIZE = next_const_value
29
+ BUFFER_SIZE = next_const_value
30
+ DOUBLEBUFFER = next_const_value
31
+ DEPTH_SIZE = next_const_value
32
+ STENCIL_SIZE = next_const_value
33
+ ACCUM_RED_SIZE = next_const_value
34
+ ACCUM_GREEN_SIZE = next_const_value
35
+ ACCUM_BLUE_SIZE = next_const_value
36
+ ACCUM_ALPHA_SIZE = next_const_value
37
+ STEREO = next_const_value
38
+ MULTISAMPLEBUFFERS = next_const_value
39
+ MULTISAMPLESAMPLES = next_const_value
40
+ ACCELERATED_VISUAL = next_const_value
41
+ RETAINED_BACKING = next_const_value
42
+ CONTEXT_MAJOR_VERSION = next_const_value
43
+ CONTEXT_MINOR_VERSION = next_const_value
44
+ CONTEXT_EGL= next_const_value
45
+ CONTEXT_FLAGS= next_const_value
46
+ CONTEXT_PROFILE_MASK = next_const_value
47
+ SHARE_WITH_CURRENT_CONTEXT= next_const_value
48
48
  end
49
49
 
50
50
  # lines 165~190
@@ -70,216 +70,130 @@ module SDL2
70
70
  # lines 199~205
71
71
  enum :gl_context_flag, GLcontextFlag.flatten_consts
72
72
 
73
- # This interface represents SDL_video.h function prototypes, lines 208~
74
-
75
- ##
76
- #
77
- api :SDL_GetNumVideoDrivers, [], :int
78
73
  ##
79
- #
74
+ # Abstraction of SDL's video interface.
75
+ module Video
76
+ ##
77
+ # Abstract enumeration of SDL's VideoDrivers concept.
78
+ module Drivers
79
+ ##
80
+ # Returns the number of video drivers available.
81
+ def self.num
82
+ SDL2.get_num_video_drivers!()
83
+ end
84
+ ##
85
+ # Returns the name of the video driver
86
+ def self.[](index)
87
+ SDL2.get_video_driver(index)
88
+ end
89
+ ##
90
+ # Enumerates the drivers
91
+ def self.each(&block)
92
+ self.lazy(&block)
93
+ end
94
+ ##
95
+ # Constructs a ?lazy? enumerator
96
+ def self.lazy(&block)
97
+ self.num.times.lazy.map{|idx|self[idx]}.each(&block)
98
+ end
99
+ end
100
+ ##
101
+ # Initialize a specific video driver named or nil for default.
102
+ def self.init(video_driver_name = nil)
103
+ SDL2.video_init!(video_driver_name)
104
+ end
105
+ ##
106
+ # Shut down Video subsystem
107
+ def self.quit()
108
+ SDL2.video_quit
109
+ end
110
+ ##
111
+ # Resturns the current video driver
112
+ def self.current_driver()
113
+ SDL2.get_current_video_driver()
114
+ end
115
+ end
116
+
117
+ module ScreenSaver
118
+ def self.enabled?
119
+ SDL2.is_screen_saver_enabled?
120
+ end
121
+ def self.disable
122
+ SDL2.disable_screen_saver
123
+ end
124
+ def self.enable
125
+ SDL2.enable_screen_saver
126
+ end
127
+ end
128
+ # This interface represents SDL_video.h function prototypes, lines 208~
129
+ api :SDL_GetNumVideoDrivers, [], :int, {error: true, filter: OK_WHEN_GTE_ZERO}
80
130
  api :SDL_GetVideoDriver, [:int], :string
81
- ##
82
- #
83
- api :SDL_VideoInit, [:string], :int
84
- ##
85
- #
131
+ api :SDL_VideoInit, [:string], :int, {error: true, filter: OK_WHEN_ZERO}
86
132
  api :SDL_VideoQuit, [], :void
87
- ##
88
- #
89
133
  api :SDL_GetCurrentVideoDriver, [], :string
90
- ##
91
- #
92
- api :SDL_GetNumVideoDisplays, [], :int
93
- ##
94
- #
134
+ api :SDL_GetNumVideoDisplays, [], :int, {error: true, filter: OK_WHEN_GTE_ZERO}
95
135
  api :SDL_GetDisplayName, [:display_index], :string
96
- ##
97
- #
98
136
  api :SDL_GetDisplayBounds, [:int, Rect.by_ref], :int
99
- ##
100
- #
101
- api :SDL_GetNumDisplayModes, [:int], :int
102
- ##
103
- #
137
+ api :SDL_GetNumDisplayModes, [:int], :int, {error: true, filter: OK_WHEN_GTE_ZERO}
104
138
  api :SDL_GetDisplayMode, [:int, :int, Display::Mode.by_ref], :int
105
- ##
106
- #
107
139
  api :SDL_GetDesktopDisplayMode, [:int, Display::Mode.by_ref], :int
108
- ##
109
- #
110
- api :SDL_GetCurrentDisplayMode, [:int, Display::Mode.by_ref], :int
111
- ##
112
- #
113
- api :SDL_GetClosestDisplayMode, [:display_index, Display::Mode.by_ref, Display::Mode.by_ref], Display::Mode.by_ref
114
- ##
115
- #
140
+ api :SDL_GetCurrentDisplayMode, [:int, Display::Mode.by_ref], :int, {error: true, filter: OK_WHEN_ZERO}
141
+ api :SDL_GetClosestDisplayMode, [:display_index, Display::Mode.by_ref, Display::Mode.by_ref], Display::Mode.by_ref, {error: true, filter: OK_WHEN_NOT_NULL}
116
142
  api :SDL_GetWindowDisplayIndex, [Window.by_ref], :int
117
- ##
118
- #
119
143
  api :SDL_SetWindowDisplayMode, [Window.by_ref, :uint32], :int
120
- ##
121
- #
122
144
  api :SDL_GetWindowDisplayMode, [Window.by_ref, Display::Mode.by_ref], :int
123
- ##
124
- #
125
- api :SDL_GetWindowPixelFormat, [Window.by_ref], :uint32
126
- ##
127
- #
128
- api :SDL_CreateWindow, [:string, :int, :int, :int, :int, :window_flags], Window.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
129
- ##
130
- #
131
- api :SDL_CreateWindowFrom, [:pointer], Window.auto_ptr
132
- ##
133
- #
134
- api :SDL_GetWindowFromID, [:uint32], Window.by_ref
135
- ##
136
- #
145
+ api :SDL_GetWindowPixelFormat, [Window.by_ref], :pixel_format
146
+ api :SDL_CreateWindow, [:string, :int, :int, :int, :int, :window_flags], Window.ptr, {error: true, filter: OK_WHEN_NOT_NULL}
147
+ api :SDL_CreateWindowFrom, [:pointer], Window.ptr
148
+ api :SDL_GetWindowFromID, [:uint32], Window.ptr
137
149
  api :SDL_GetWindowID, [Window.by_ref], :uint32
138
- ##
139
- #
140
150
  api :SDL_GetWindowFlags, [Window.by_ref], :uint32
141
- ##
142
- #
143
151
  api :SDL_GetWindowTitle, [Window.by_ref], :string
144
- ##
145
- #
146
152
  api :SDL_SetWindowTitle, [Window.by_ref, :string], :void
147
- ##
148
- #
149
153
  api :SDL_SetWindowIcon, [Window.by_ref, Surface.by_ref], :void
150
- ##
151
- #
152
154
  api :SDL_SetWindowData, [Window.by_ref, :string, :pointer], :pointer
153
- ##
154
- #
155
155
  api :SDL_GetWindowData, [Window.by_ref, :string], :pointer
156
- ##
157
- #
158
156
  api :SDL_SetWindowPosition, [Window.by_ref, :int, :int], :void
159
- ##
160
- #
161
- api :SDL_GetWindowPosition, [Window.by_ref, IntStruct.by_ref, IntStruct.by_ref], :void
162
- ##
163
- #
157
+ api :SDL_GetWindowPosition, [Window.by_ref, TypedPointer::Int.by_ref, TypedPointer::Int.by_ref], :void
164
158
  api :SDL_SetWindowSize, [Window.by_ref, :int, :int], :void
165
- ##
166
- #
167
- api :SDL_GetWindowSize, [Window.by_ref, IntStruct.by_ref, IntStruct.by_ref], :void
168
- ##
169
- #
159
+ api :SDL_GetWindowSize, [Window.by_ref, TypedPointer::Int.by_ref, TypedPointer::Int.by_ref], :void
170
160
  api :SDL_SetWindowMaximumSize, [Window.by_ref, :int, :int], :void
171
- ##
172
- #
173
- api :SDL_GetWindowMaximumSize, [Window.by_ref, IntStruct.by_ref, IntStruct.by_ref], :void
174
- ##
175
- #
161
+ api :SDL_GetWindowMaximumSize, [Window.by_ref, TypedPointer::Int.by_ref, TypedPointer::Int.by_ref], :void
176
162
  api :SDL_SetWindowMinimumSize, [Window.by_ref, :int, :int], :void
177
- ##
178
- #
179
- api :SDL_GetWindowMinimumSize, [Window.by_ref, IntStruct.by_ref, IntStruct.by_ref], :void
180
- ##
181
- #
163
+ api :SDL_GetWindowMinimumSize, [Window.by_ref, TypedPointer::Int.by_ref, TypedPointer::Int.by_ref], :void
182
164
  api :SDL_SetWindowBordered, [Window.by_ref, :bool], :void
183
- ##
184
- #
185
165
  api :SDL_ShowWindow, [Window.by_ref], :void
186
- ##
187
- #
188
166
  api :SDL_HideWindow, [Window.by_ref], :void
189
- ##
190
- #
191
167
  api :SDL_RaiseWindow, [Window.by_ref], :void
192
- ##
193
- #
194
168
  api :SDL_MaximizeWindow, [Window.by_ref], :void
195
- ##
196
- #
197
169
  api :SDL_MinimizeWindow, [Window.by_ref], :void
198
- ##
199
- #
200
170
  api :SDL_RestoreWindow, [Window.by_ref], :void
201
- ##
202
- #
203
171
  api :SDL_SetWindowFullscreen, [Window.by_ref, :uint32], :int
204
- ##
205
- #
206
172
  api :SDL_GetWindowSurface, [Window.by_ref], Surface.by_ref
207
- ##
208
- #
209
173
  api :SDL_UpdateWindowSurface, [Window.by_ref], :int, {error: true}
210
- ##
211
- #
212
174
  api :SDL_UpdateWindowSurfaceRects, [Window.by_ref, Rect.by_ref, :int], :int, {error: true}
213
- ##
214
- #
215
175
  api :SDL_GetWindowGrab, [Window.by_ref], :bool
216
- ##
217
- #
218
176
  api :SDL_SetWindowGrab, [Window.by_ref, :bool], :void
219
- ##
220
- #
221
177
  api :SDL_GetWindowBrightness, [Window.by_ref], :float
222
- ##
223
- #
224
178
  api :SDL_SetWindowBrightness, [Window.by_ref, :float], :int
225
- ##
226
- #
227
- api :SDL_GetWindowGammaRamp, [Window.by_ref, UInt16Struct.by_ref, UInt16Struct.by_ref, UInt16Struct.by_ref], :int
228
- ##
229
- #
230
- api :SDL_SetWindowGammaRamp, [Window.by_ref, UInt16Struct.by_ref, UInt16Struct.by_ref, UInt16Struct.by_ref], :int
231
- ##
232
- #
179
+ api :SDL_GetWindowGammaRamp, [Window.by_ref, TypedPointer::UInt16.by_ref, TypedPointer::UInt16.by_ref, TypedPointer::UInt16.by_ref], :int
180
+ api :SDL_SetWindowGammaRamp, [Window.by_ref, TypedPointer::UInt16.by_ref, TypedPointer::UInt16.by_ref, TypedPointer::UInt16.by_ref], :int
233
181
  api :SDL_DestroyWindow, [Window.by_ref], :void
234
- ##
235
- #
236
182
  api :SDL_IsScreenSaverEnabled, [], :bool
237
- ##
238
- #
239
183
  api :SDL_DisableScreenSaver, [], :void
240
- ##
241
- #
242
184
  api :SDL_EnableScreenSaver, [], :void
243
- ##
244
- #
245
185
  api :SDL_GL_LoadLibrary, [:string], :int
246
- ##
247
- #
248
186
  api :SDL_GL_GetProcAddress, [:string], :pointer
249
- ##
250
- #
251
187
  api :SDL_GL_UnloadLibrary, [], :void
252
- ##
253
- #
254
188
  api :SDL_GL_ExtensionSupported, [:string], :bool
255
- ##
256
- #
257
- api :SDL_GL_SetAttribute, [:gl_attr, IntStruct], :int
258
- ##
259
- #
260
- api :SDL_GL_GetAttribute, [:gl_attr, IntStruct.by_ref], :int
261
- ##
262
- #
189
+ api :SDL_GL_SetAttribute, [:gl_attr, TypedPointer::Int], :int
190
+ api :SDL_GL_GetAttribute, [:gl_attr, TypedPointer::Int.by_ref], :int
263
191
  api :SDL_GL_CreateContext, [Window.by_ref], :gl_context
264
- ##
265
- #
266
192
  api :SDL_GL_MakeCurrent, [Window.by_ref, :gl_context], :int
267
- ##
268
- #
269
193
  api :SDL_GL_GetCurrentWindow, [], Window.by_ref
270
- ##
271
- #
272
194
  api :SDL_GL_GetCurrentContext, [], :gl_context
273
- ##
274
- #
275
195
  api :SDL_GL_SetSwapInterval, [:int], :int
276
- ##
277
- #
278
196
  api :SDL_GL_GetSwapInterval, [], :int
279
- ##
280
- #
281
197
  api :SDL_GL_DeleteContext, [:gl_context], :void
282
- ##
283
- #
284
198
  api :SDL_GL_SwapWindow, [Window.by_ref], :void
285
199
  end