examples/sample11a.rb in sgl-0.4.0 vs examples/sample11a.rb in sgl-1.0.0

- old
+ new

@@ -1,33 +1,33 @@ -require "sgl" - -def setup - window -200, -200, 200, 200 - background 0 - $x1 = 0 - $y1 = 0 - $x2 = 0 - $y2 = 0 -end - -def display - x = mouseX - y = mouseY - - speed = 20.0 - vx = (x - $x1)/speed - vy = (y - $y1)/speed - $x1 = $x1 + vx - $y1 = $y1 + vy - color (200+$x1)/4, 0, 0 - circle($x1, $y1, 50, POLYGON) ## polygonは塗りつぶし - - speed = 10.0 - vx = (x - $x2)/speed - vy = (y - $y2)/speed - $x2 = $x2 + vx - $y2 = $y2 + vy - color 0,(200+$y2)/4,0 - circle($x2+30,$y2+30,80) -end - -mainloop +require "sgl" + +def setup + window -200, -200, 200, 200 + background 0 + $x1 = 0 + $y1 = 0 + $x2 = 0 + $y2 = 0 +end + +def display + x = mouseX + y = mouseY + + speed = 20.0 + vx = (x - $x1)/speed + vy = (y - $y1)/speed + $x1 = $x1 + vx + $y1 = $y1 + vy + color (200+$x1)/4, 0, 0 + circle($x1, $y1, 50, POLYGON) ## polygonは塗りつぶし + + speed = 10.0 + vx = (x - $x2)/speed + vy = (y - $y2)/speed + $x2 = $x2 + vx + $y2 = $y2 + vy + color 0,(200+$y2)/4,0 + circle($x2+30,$y2+30,80) +end + +mainloop