class GameWindow

Public Class Methods

new() click to toggle source
Calls superclass method
# File foo/foo_gosu.rb, line 63
def initialize
  super(640, 480, false)
  self.caption = "Gosu Tutorial Game"

  @background_image = Gosu::Image.new(self, IM1, true)

  @player = Player.new(self)
  @player.warp(320, 240)
end

Public Instance Methods

button_down(id) click to toggle source
# File foo/foo_gosu.rb, line 91
def button_down(id)
  if id == Gosu::KbEscape
    close
  end
end
draw() click to toggle source
# File foo/foo_gosu.rb, line 86
def draw
  @player.draw
  @background_image.draw(0, 0, 0);
end
update() click to toggle source
# File foo/foo_gosu.rb, line 73
def update
  if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then
    @player.turn_left
  end
  if button_down? Gosu::KbRight or button_down? Gosu::GpRight then
    @player.turn_right
  end
  if button_down? Gosu::KbUp or button_down? Gosu::GpButton0 then
    @player.accelerate
  end
  @player.move
end