class GameWindow
class GameWindow
Attributes
mediamanager[RW]
state[RW]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/misc/game_window.rb, line 8 def initialize super(256, 224, true) self.caption = 'Battle city' @unitsize = 8 @mediamanager = MediaManager.new(self) end
Public Instance Methods
draw()
click to toggle source
# File lib/misc/game_window.rb, line 19 def draw @state.draw end
keymap()
click to toggle source
# File lib/misc/game_window.rb, line 31 def keymap keys = [] keys.push(:p1up) if Gosu::button_down?(Gosu::KbUp) keys.push(:p1down) if Gosu::button_down?(Gosu::KbDown) keys.push(:p1left) if Gosu::button_down?(Gosu::KbLeft) keys.push(:p1right) if Gosu::button_down?(Gosu::KbRight) keys.push(:p2up) if Gosu::button_down?(Gosu::KbW) keys.push(:p2down) if Gosu::button_down?(Gosu::KbS) keys.push(:p2left) if Gosu::button_down?(Gosu::KbA) keys.push(:p2right) if Gosu::button_down?(Gosu::KbD) keys.push(:p1shoot) if Gosu::button_down?(Gosu::KbRightControl) keys.push(:p2shoot) if Gosu::button_down?(Gosu::KbLeftControl) keys end
needs_redraw?()
click to toggle source
# File lib/misc/game_window.rb, line 23 def needs_redraw? @state.needs_redraw? end
update()
click to toggle source
# File lib/misc/game_window.rb, line 15 def update @state.update(keymap) end