/test/z_order_test.rb
http://jgosu.googlecode.com/ · Ruby · 29 lines · 24 code · 5 blank · 0 comment · 1 complexity · 4bead29f6a22250555c3645802087f9f MD5 · raw file
- $: << File.expand_path(File.join(File.dirname(__FILE__), '../lib'))
- require 'rubygems'
- require 'gosu'
- include Gosu
- class ZOrderTest < Window
- def initialize
- super(640, 480, false)
- @image = Image.new(self, File.join(File.dirname(__FILE__), 'LargeStar.png'))
- @clockwise = 0
- @c_clockwise = 0
- end
- def draw
- @image.draw_rot(320, 240, 3, @c_clockwise, 0.5, 0.5, 0.1, 0.1)
- @image.draw_rot(320, 240, 2, @clockwise, 0.5, 0.5, 0.4, 0.4)
- @image.draw_rot(320, 240, 1, @c_clockwise, 0.5, 0.5, 0.7, 0.7)
- @image.draw_rot(320, 240, 0, @clockwise)
- end
- def update
- @clockwise = (@clockwise + 1) % 360
- @c_clockwise = (@c_clockwise - 1) % 360
- close if button_down? KbEscape
- end
- end
- ZOrderTest.new.show