/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'))
  2. require 'rubygems'
  3. require 'gosu'
  4. include Gosu
  5. class ZOrderTest < Window
  6. def initialize
  7. super(640, 480, false)
  8. @image = Image.new(self, File.join(File.dirname(__FILE__), 'LargeStar.png'))
  9. @clockwise = 0
  10. @c_clockwise = 0
  11. end
  12. def draw
  13. @image.draw_rot(320, 240, 3, @c_clockwise, 0.5, 0.5, 0.1, 0.1)
  14. @image.draw_rot(320, 240, 2, @clockwise, 0.5, 0.5, 0.4, 0.4)
  15. @image.draw_rot(320, 240, 1, @c_clockwise, 0.5, 0.5, 0.7, 0.7)
  16. @image.draw_rot(320, 240, 0, @clockwise)
  17. end
  18. def update
  19. @clockwise = (@clockwise + 1) % 360
  20. @c_clockwise = (@c_clockwise - 1) % 360
  21. close if button_down? KbEscape
  22. end
  23. end
  24. ZOrderTest.new.show