Class: QuitState
- Includes:
- Singleton
- Defined in:
- lib/lib/game_states/quit_state.rb
Overview
Game state of closing the game window
Instance Method Summary collapse
- #draw ⇒ Object
-
#update(button) ⇒ Object
Process given button to cursor.
Methods inherited from GameState
#after_start, #before_end, switch!
Instance Method Details
#draw ⇒ Object
28 29 30 31 32 |
# 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) ⇒ Object
Process given button to cursor
19 20 21 22 23 24 25 26 |
# File 'lib/lib/game_states/quit_state.rb', line 19 def update() case() when Gosu::KbY then $window.close when Gosu::KbN, Gosu::KbEscape then GameState.switch!(WelcomeState.instance) end end |