class GameWindow
Main class
Attributes
state[RW]
Public Class Methods
new(width = (MAPX + 1) * TILESIZE, \ height = (MAPY + 2) * TILESIZE, \ fullscreen = false)
click to toggle source
Calls superclass method
# File lib/empi.rb, line 18 def initialize(width = (MAPX + 1) * TILESIZE, \ height = (MAPY + 2) * TILESIZE, \ fullscreen = false) super # Set version name version = '0.25' self.caption = "Empi: Ruby Edition #{version}" WelcomeState.instance.version = version # Activate first state $window = self GameState.switch!(WelcomeState.instance) end
Public Instance Methods
draw()
click to toggle source
Draw according to current state
# File lib/empi.rb, line 52 def draw @button = BUTTON_PROCESSED # draw just once after each button release unless $window.state.nil? @state.draw end end
needs_redraw?()
click to toggle source
Draw only after some button was released and in the start
# File lib/empi.rb, line 47 def needs_redraw? @button != BUTTON_PROCESSED end
update()
click to toggle source
Process given button according to current state
# File lib/empi.rb, line 39 def update # No (new) keys unless @button == BUTTON_PROCESSED || @button.nil? @state.update(@button) end end