Class: LunarLander::Pause

Inherits:
Chingu::GameState
  • Object
show all
Defined in:
lib/lunar_lander/game_states/pause.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Pause

Returns a new instance of Pause.



4
5
6
7
8
9
10
11
12
# File 'lib/lunar_lander/game_states/pause.rb', line 4

def initialize(options = {})
  super
  @white = Gosu::Color.new(255,255,255,255)
  @color = Gosu::Color.new(200,0,0,0)
  @font = Gosu::Font[35]
  @text = "PAUSADO - pressione 'p' para retornar."
  
  self.input = { :p => :resume }
end

Instance Method Details

#drawObject



18
19
20
21
22
23
24
25
26
# File 'lib/lunar_lander/game_states/pause.rb', line 18

def draw
  previous_game_state.draw    # Draw prev game state onto screen (in this case our level)
  $window.draw_quad(  0,0,@color,
                      $window.width,0,@color,
                      $window.width,$window.height,@color,
                      0,$window.height,@color, Chingu::DEBUG_ZORDER)
                      
  @font.draw(@text, ($window.width/2 - @font.text_width(@text)/2), $window.height/2 - @font.height, Chingu::DEBUG_ZORDER + 1)
end

#resumeObject



14
15
16
# File 'lib/lunar_lander/game_states/pause.rb', line 14

def resume
  pop_game_state(:setup => false)
end