sdl2_ffi 0.0.5 → 0.0.6

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 (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/ttf/font.rb CHANGED
@@ -84,26 +84,42 @@ module SDL2
84
84
  end
85
85
 
86
86
  alias_method :free, :close
87
-
88
- def render_text_solid(text, color = [255,255,255])
87
+
88
+ def self.default_fg=(color)
89
+ @@default_fg = Color.cast(color)
90
+ end
91
+
92
+ def self.default_fg
93
+ @@default_fg ||= Color.cast([255,255,255, ALPHA_OPAQUE])
94
+ end
95
+
96
+ def self.default_bg=(color)
97
+ @@default_bg = Color.cast(color)
98
+ end
99
+
100
+ def self.default_bg
101
+ @@default_bg ||= Color.cast([0,0,0,ALPHA_OPAQUE])
102
+ end
103
+
104
+ def render_text_solid(text, color = Font::default_fg)
89
105
  color = Color.cast(color)
90
106
  TTF.render_text_solid!(self, text, color)
91
107
  end
92
108
 
93
- def render_text_shaded(text, fg = [255,255,255,255], bg = [0,0,0,0] )
109
+ def render_text_shaded(text, fg = Font::default_fg, bg = Font::default_bg )
94
110
  fg = Color.cast(fg)
95
111
  bg = Color.cast(bg)
96
112
  TTF.render_text_shaded!(self, text, fg, bg)
97
113
  end
98
114
 
99
- def render_text_blended(text, fg = [255, 255, 255, 255])
115
+ def render_text_blended(text, fg = Font::default_fg)
100
116
  #binding.pry
101
117
  fg = Color.cast(fg)
102
118
  #binding.pry
103
119
  TTF.render_text_blended!(self, text, fg)
104
120
  end
105
121
 
106
- def render_text_blended_wrapped(text, width, fg = [255,255,255,255])
122
+ def render_text_blended_wrapped(text, width, fg = default_fg)
107
123
  fg = Color.cast(fg)
108
124
  TTF.render_text_blended_wrapped!(self, text, fg, width)
109
125
  end
data/lib/sdl2/version.rb CHANGED
@@ -36,7 +36,13 @@ module SDL2
36
36
 
37
37
  end
38
38
 
39
- api :SDL_GetRevision, [], :string
40
- api :SDL_GetRevisionNumber, [], :int
41
- api :SDL_GetVersion, [Version.by_ref], :void
39
+ ##
40
+ #
41
+ api :SDL_GetRevision, [], :string
42
+ ##
43
+ #
44
+ api :SDL_GetRevisionNumber, [], :int
45
+ ##
46
+ #
47
+ api :SDL_GetVersion, [Version.by_ref], :void
42
48
  end
data/lib/sdl2/video.rb CHANGED
@@ -72,74 +72,214 @@ module SDL2
72
72
 
73
73
  # This interface represents SDL_video.h function prototypes, lines 208~
74
74
 
75
- api :SDL_GetNumVideoDrivers, [], :int
76
- api :SDL_GetVideoDriver, [:int], :string
77
- api :SDL_VideoInit, [:string], :int
78
- api :SDL_VideoQuit, [], :void
79
- api :SDL_GetCurrentVideoDriver, [], :string
80
- api :SDL_GetNumVideoDisplays, [], :int
81
- api :SDL_GetDisplayName, [:display_index], :string
82
- api :SDL_GetDisplayBounds, [:int, Rect.by_ref], :int
83
- api :SDL_GetNumDisplayModes, [:int], :int
84
- api :SDL_GetDisplayMode, [:int, :int, Display::Mode.by_ref], :int
85
- api :SDL_GetDesktopDisplayMode, [:int, Display::Mode.by_ref], :int
86
- api :SDL_GetCurrentDisplayMode, [:int, Display::Mode.by_ref], :int
87
- api :SDL_GetClosestDisplayMode, [:display_index, Display::Mode.by_ref, Display::Mode.by_ref], Display::Mode.by_ref
88
- api :SDL_GetWindowDisplayIndex, [Window.by_ref], :int
89
- api :SDL_SetWindowDisplayMode, [Window.by_ref, :uint32], :int
90
- api :SDL_GetWindowDisplayMode, [Window.by_ref, Display::Mode.by_ref], :int
91
- api :SDL_GetWindowPixelFormat, [Window.by_ref], :uint32
92
- api :SDL_CreateWindow, [:string, :int, :int, :int, :int, :window_flags], Window.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
93
- api :SDL_CreateWindowFrom, [:pointer], Window.auto_ptr
94
- api :SDL_GetWindowFromID, [:uint32], Window.by_ref
95
- api :SDL_GetWindowID, [Window.by_ref], :uint32
96
- api :SDL_GetWindowFlags, [Window.by_ref], :uint32
97
- api :SDL_GetWindowTitle, [Window.by_ref], :string
98
- api :SDL_SetWindowTitle, [Window.by_ref, :string], :void
99
- api :SDL_SetWindowIcon, [Window.by_ref, Surface.by_ref], :void
100
- api :SDL_SetWindowData, [Window.by_ref, :string, :pointer], :pointer
101
- api :SDL_GetWindowData, [Window.by_ref, :string], :pointer
102
- api :SDL_SetWindowPosition, [Window.by_ref, :int, :int], :void
103
- api :SDL_GetWindowPosition, [Window.by_ref, IntStruct.by_ref, IntStruct.by_ref], :void
104
- api :SDL_SetWindowSize, [Window.by_ref, :int, :int], :void
105
- api :SDL_GetWindowSize, [Window.by_ref, IntStruct.by_ref, IntStruct.by_ref], :void
106
- api :SDL_SetWindowMaximumSize, [Window.by_ref, :int, :int], :void
107
- api :SDL_GetWindowMaximumSize, [Window.by_ref, IntStruct.by_ref, IntStruct.by_ref], :void
108
- api :SDL_SetWindowMinimumSize, [Window.by_ref, :int, :int], :void
109
- api :SDL_GetWindowMinimumSize, [Window.by_ref, IntStruct.by_ref, IntStruct.by_ref], :void
110
- api :SDL_SetWindowBordered, [Window.by_ref, :bool], :void
111
- api :SDL_ShowWindow, [Window.by_ref], :void
112
- api :SDL_HideWindow, [Window.by_ref], :void
113
- api :SDL_RaiseWindow, [Window.by_ref], :void
114
- api :SDL_MaximizeWindow, [Window.by_ref], :void
115
- api :SDL_MinimizeWindow, [Window.by_ref], :void
116
- api :SDL_RestoreWindow, [Window.by_ref], :void
117
- api :SDL_SetWindowFullscreen, [Window.by_ref, :uint32], :int
118
- api :SDL_GetWindowSurface, [Window.by_ref], Surface.by_ref
119
- api :SDL_UpdateWindowSurface, [Window.by_ref], :int, {error: true}
120
- api :SDL_UpdateWindowSurfaceRects, [Window.by_ref, Rect.by_ref, :int], :int, {error: true}
121
- api :SDL_GetWindowGrab, [Window.by_ref], :bool
122
- api :SDL_SetWindowGrab, [Window.by_ref, :bool], :void
123
- api :SDL_GetWindowBrightness, [Window.by_ref], :float
124
- api :SDL_SetWindowBrightness, [Window.by_ref, :float], :int
125
- api :SDL_GetWindowGammaRamp, [Window.by_ref, UInt16Struct.by_ref, UInt16Struct.by_ref, UInt16Struct.by_ref], :int
126
- api :SDL_SetWindowGammaRamp, [Window.by_ref, UInt16Struct.by_ref, UInt16Struct.by_ref, UInt16Struct.by_ref], :int
127
- api :SDL_DestroyWindow, [Window.by_ref], :void
128
- api :SDL_IsScreenSaverEnabled, [], :bool
129
- api :SDL_DisableScreenSaver, [], :void
130
- api :SDL_EnableScreenSaver, [], :void
131
- api :SDL_GL_LoadLibrary, [:string], :int
132
- api :SDL_GL_GetProcAddress, [:string], :pointer
133
- api :SDL_GL_UnloadLibrary, [], :void
134
- api :SDL_GL_ExtensionSupported, [:string], :bool
135
- api :SDL_GL_SetAttribute, [:gl_attr, IntStruct], :int
136
- api :SDL_GL_GetAttribute, [:gl_attr, IntStruct.by_ref], :int
137
- api :SDL_GL_CreateContext, [Window.by_ref], :gl_context
138
- api :SDL_GL_MakeCurrent, [Window.by_ref, :gl_context], :int
139
- api :SDL_GL_GetCurrentWindow, [], Window.by_ref
140
- api :SDL_GL_GetCurrentContext, [], :gl_context
141
- api :SDL_GL_SetSwapInterval, [:int], :int
142
- api :SDL_GL_GetSwapInterval, [], :int
143
- api :SDL_GL_DeleteContext, [:gl_context], :void
144
- api :SDL_GL_SwapWindow, [Window.by_ref], :void
75
+ ##
76
+ #
77
+ api :SDL_GetNumVideoDrivers, [], :int
78
+ ##
79
+ #
80
+ api :SDL_GetVideoDriver, [:int], :string
81
+ ##
82
+ #
83
+ api :SDL_VideoInit, [:string], :int
84
+ ##
85
+ #
86
+ api :SDL_VideoQuit, [], :void
87
+ ##
88
+ #
89
+ api :SDL_GetCurrentVideoDriver, [], :string
90
+ ##
91
+ #
92
+ api :SDL_GetNumVideoDisplays, [], :int
93
+ ##
94
+ #
95
+ api :SDL_GetDisplayName, [:display_index], :string
96
+ ##
97
+ #
98
+ api :SDL_GetDisplayBounds, [:int, Rect.by_ref], :int
99
+ ##
100
+ #
101
+ api :SDL_GetNumDisplayModes, [:int], :int
102
+ ##
103
+ #
104
+ api :SDL_GetDisplayMode, [:int, :int, Display::Mode.by_ref], :int
105
+ ##
106
+ #
107
+ 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
+ #
116
+ api :SDL_GetWindowDisplayIndex, [Window.by_ref], :int
117
+ ##
118
+ #
119
+ api :SDL_SetWindowDisplayMode, [Window.by_ref, :uint32], :int
120
+ ##
121
+ #
122
+ 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
+ #
137
+ api :SDL_GetWindowID, [Window.by_ref], :uint32
138
+ ##
139
+ #
140
+ api :SDL_GetWindowFlags, [Window.by_ref], :uint32
141
+ ##
142
+ #
143
+ api :SDL_GetWindowTitle, [Window.by_ref], :string
144
+ ##
145
+ #
146
+ api :SDL_SetWindowTitle, [Window.by_ref, :string], :void
147
+ ##
148
+ #
149
+ api :SDL_SetWindowIcon, [Window.by_ref, Surface.by_ref], :void
150
+ ##
151
+ #
152
+ api :SDL_SetWindowData, [Window.by_ref, :string, :pointer], :pointer
153
+ ##
154
+ #
155
+ api :SDL_GetWindowData, [Window.by_ref, :string], :pointer
156
+ ##
157
+ #
158
+ 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
+ #
164
+ 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
+ #
170
+ 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
+ #
176
+ 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
+ #
182
+ api :SDL_SetWindowBordered, [Window.by_ref, :bool], :void
183
+ ##
184
+ #
185
+ api :SDL_ShowWindow, [Window.by_ref], :void
186
+ ##
187
+ #
188
+ api :SDL_HideWindow, [Window.by_ref], :void
189
+ ##
190
+ #
191
+ api :SDL_RaiseWindow, [Window.by_ref], :void
192
+ ##
193
+ #
194
+ api :SDL_MaximizeWindow, [Window.by_ref], :void
195
+ ##
196
+ #
197
+ api :SDL_MinimizeWindow, [Window.by_ref], :void
198
+ ##
199
+ #
200
+ api :SDL_RestoreWindow, [Window.by_ref], :void
201
+ ##
202
+ #
203
+ api :SDL_SetWindowFullscreen, [Window.by_ref, :uint32], :int
204
+ ##
205
+ #
206
+ api :SDL_GetWindowSurface, [Window.by_ref], Surface.by_ref
207
+ ##
208
+ #
209
+ api :SDL_UpdateWindowSurface, [Window.by_ref], :int, {error: true}
210
+ ##
211
+ #
212
+ api :SDL_UpdateWindowSurfaceRects, [Window.by_ref, Rect.by_ref, :int], :int, {error: true}
213
+ ##
214
+ #
215
+ api :SDL_GetWindowGrab, [Window.by_ref], :bool
216
+ ##
217
+ #
218
+ api :SDL_SetWindowGrab, [Window.by_ref, :bool], :void
219
+ ##
220
+ #
221
+ api :SDL_GetWindowBrightness, [Window.by_ref], :float
222
+ ##
223
+ #
224
+ 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
+ #
233
+ api :SDL_DestroyWindow, [Window.by_ref], :void
234
+ ##
235
+ #
236
+ api :SDL_IsScreenSaverEnabled, [], :bool
237
+ ##
238
+ #
239
+ api :SDL_DisableScreenSaver, [], :void
240
+ ##
241
+ #
242
+ api :SDL_EnableScreenSaver, [], :void
243
+ ##
244
+ #
245
+ api :SDL_GL_LoadLibrary, [:string], :int
246
+ ##
247
+ #
248
+ api :SDL_GL_GetProcAddress, [:string], :pointer
249
+ ##
250
+ #
251
+ api :SDL_GL_UnloadLibrary, [], :void
252
+ ##
253
+ #
254
+ 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
+ #
263
+ api :SDL_GL_CreateContext, [Window.by_ref], :gl_context
264
+ ##
265
+ #
266
+ api :SDL_GL_MakeCurrent, [Window.by_ref, :gl_context], :int
267
+ ##
268
+ #
269
+ api :SDL_GL_GetCurrentWindow, [], Window.by_ref
270
+ ##
271
+ #
272
+ api :SDL_GL_GetCurrentContext, [], :gl_context
273
+ ##
274
+ #
275
+ api :SDL_GL_SetSwapInterval, [:int], :int
276
+ ##
277
+ #
278
+ api :SDL_GL_GetSwapInterval, [], :int
279
+ ##
280
+ #
281
+ api :SDL_GL_DeleteContext, [:gl_context], :void
282
+ ##
283
+ #
284
+ api :SDL_GL_SwapWindow, [Window.by_ref], :void
145
285
  end
data/lib/sdl2/window.rb CHANGED
@@ -182,8 +182,14 @@ module SDL2
182
182
 
183
183
  # Release memory utilized by structure
184
184
  def self.release(pointer)
185
- destroy_window(pointer)
185
+ destroy_window(self.new pointer)
186
186
  end
187
+
188
+ def destroy
189
+ destroy_window(self)
190
+ end
191
+
192
+ alias_method :destroy, :free
187
193
 
188
194
  # Return the brightness level
189
195
  def brightness
@@ -288,7 +294,7 @@ module SDL2
288
294
 
289
295
  # Update the window's surface
290
296
  def update_surface()
291
- SDL2.update_window_surface!(self)
297
+ SDL2.update_window_surface!(self)
292
298
  end
293
299
 
294
300
  # Get the window's current size
@@ -342,7 +348,7 @@ module SDL2
342
348
  position = [IntStruct.new, IntStruct.new]
343
349
  SDL2::get_window_position(self, position[0], position[1])
344
350
  x, y = position[0][:value], position[1][:value]
345
- position.each{|struct|struct.pointer.free}
351
+ position.each(&:free)
346
352
  [x, y]
347
353
  end
348
354
 
@@ -1,25 +1,31 @@
1
1
  require_relative 'lazy_foo_helper'
2
2
 
3
+ require 'sdl2/ttf'
4
+
5
+
3
6
  # ORIGINAL: http://lazyfoo.net/SDL_tutorials/lesson01/index2.php
4
7
  # Adapted for Ruby & SDL 2.0 as functional test by BadQuanta
5
8
  describe "LazyFoo.net: Lesson 01: Hello World" do
6
9
 
7
10
  before do
8
- expect(init(:EVERYTHING)).to eq(0)
11
+ #expect(init(:EVERYTHING)).to eq(0)
9
12
 
10
13
  @window = Window.create(subject, :CENTERED, :CENTERED, 640, 480, :SHOWN)
11
14
 
12
15
  @screen = @window.surface
16
+ @screen.fill_rect(@screen.rect, [0,0,0,SDL2::ALPHA_OPAQUE])
13
17
 
14
18
  @hello = @screen.convert(SDL2.load_bmp!(img_path('hello.bmp')))
15
19
  @screen.blit_in(@hello)
20
+ @hello.blit_out(@screen)
16
21
  @window.update_surface
17
22
  # If you want to see it, uncomment the following:
18
23
  #delay(2000)
19
24
  end
20
25
 
21
26
  it 'loaded and optimizes hello bitmap' do
22
- verify(){@hello}
27
+ #binding.pry
28
+ verify(format: :png){@hello}
23
29
  end
24
30
 
25
31
  it 'created a window surface' do
@@ -28,6 +34,7 @@ describe "LazyFoo.net: Lesson 01: Hello World" do
28
34
  end
29
35
 
30
36
  it 'draws hello to the window surface' do
37
+ #binding.pry
31
38
  verify(format: :png){@screen}
32
39
  end
33
40
 
@@ -11,6 +11,7 @@ describe "LazyFoo.net: Lesson 03: Extension Libraries" do
11
11
  @window = Window.create(subject, :CENTERED, :CENTERED, 640, 480)
12
12
 
13
13
  @screen = @window.surface
14
+ @screen.fill_rect(@screen.rect, [0,0,0,SDL2::ALPHA_OPAQUE])
14
15
 
15
16
  a_png = @screen.convert(Image.load!(img_path('an_example.png')))
16
17