class QuitState

Game state of closing the game window

Public Instance Methods

draw() click to toggle source
# File lib/lib/game_states/quit_state.rb, line 28
def draw
   confirmation = Gosu::Image.from_text(
     "Are you sure you want to quit? Y/N", 20)
   confirmation.draw((3*TILESIZE) + XTEXT, (4*TILESIZE) + YTEXT, ZTEXT)
end
update(button) click to toggle source

Process given button

# File lib/lib/game_states/quit_state.rb, line 19
def update(button)
  case(button)
  when Gosu::KbY then
    $window.close
  when Gosu::KbN, Gosu::KbEscape then
    GameState.switch!(WelcomeState.instance)
  end
end