samples/turtle/koch.rb in ray-0.1.0.pre1 vs samples/turtle/koch.rb in ray-0.1.0
- old
+ new
@@ -34,21 +34,26 @@
register do
add_hook :quit, method(:exit!)
end
scene :koch do
- render do |win|
- win.fill(Ray::Color.black).turtle do
- pen_up
- center
- backward 165
- left 90
- forward 95
- right 90
+ img = Ray::Image.new window.size
+ img.turtle do
+ pen_up
+ center
+ backward 165
+ left 90
+ forward 95
+ right 90
- pen_down
- snowflake(350, 4)
- end
+ pen_down
+ snowflake(350, 4)
+ end
+
+ @sprite = sprite img
+
+ render do |win|
+ win.draw @sprite
end
end
push_scene :koch
end