PageRenderTime 33ms CodeModel.GetById 9ms app.highlight 20ms RepoModel.GetById 1ms app.codeStats 0ms

/test/z_order_test.rb

http://jgosu.googlecode.com/
Ruby | 29 lines | 24 code | 5 blank | 0 comment | 1 complexity | 4bead29f6a22250555c3645802087f9f MD5 | raw file
 1$: << File.expand_path(File.join(File.dirname(__FILE__), '../lib'))
 2require 'rubygems'
 3require 'gosu'
 4
 5include Gosu
 6
 7class ZOrderTest < Window
 8  def initialize
 9    super(640, 480, false)
10    @image = Image.new(self, File.join(File.dirname(__FILE__), 'LargeStar.png'))
11    @clockwise = 0
12    @c_clockwise = 0
13  end
14
15  def draw
16    @image.draw_rot(320, 240, 3, @c_clockwise, 0.5, 0.5, 0.1, 0.1)
17    @image.draw_rot(320, 240, 2, @clockwise, 0.5, 0.5, 0.4, 0.4)
18    @image.draw_rot(320, 240, 1, @c_clockwise, 0.5, 0.5, 0.7, 0.7)
19    @image.draw_rot(320, 240, 0, @clockwise)
20  end
21
22  def update
23    @clockwise = (@clockwise + 1) % 360
24    @c_clockwise = (@c_clockwise - 1) % 360
25    close if button_down? KbEscape
26  end
27end
28
29ZOrderTest.new.show