Class: GamesAndRpgParadise::GardenHero::GameWindow
- Inherits:
-
Gosu::Window
- Object
- Gosu::Window
- GamesAndRpgParadise::GardenHero::GameWindow
- Includes:
- Singleton
- Defined in:
- lib/games_and_rpg_paradise/gui/gosu/garden_hero/core/game_window.rb
Overview
GamesAndRpgParadise::GardenHero::GameWindow
Constant Summary collapse
- TITLE =
#
TITLE
#
'Garden Hero'
Instance Attribute Summary collapse
-
#pause ⇒ Object
Returns the value of attribute pause.
-
#total_score ⇒ Object
Returns the value of attribute total_score.
-
#win_game ⇒ Object
Returns the value of attribute win_game.
Instance Method Summary collapse
-
#button_down(key) ⇒ Object
button down event.
-
#draw ⇒ Object
# === draw ========================================================================= #.
-
#initialize ⇒ GameWindow
constructor
# === initialize ========================================================================= #.
-
#level? ⇒ Boolean
(also: #level)
# === level? ========================================================================= #.
-
#update ⇒ Object
# === update ========================================================================= #.
Methods inherited from Gosu::Window
#gosu_button_down?, #image, #image10?, #image1?, #image2?, #image3?, #image4?, #image5?, #image6?, #image7?, #image8?, #image9?, #on_left_arrow_pressed?, #on_right_arrow_pressed?, #q_means_quit, #reset, #set_font, #set_title, #sqrt, #tab_key?, #write_this_text
Constructor Details
#initialize ⇒ GameWindow
#
initialize
#
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/games_and_rpg_paradise/gui/gosu/garden_hero/core/game_window.rb', line 30 def initialize super(640, 504, false) self. = TITLE begin @level = Level.new self @menu = Menu.new self @pause, @win_game = true, false @total_score = 0 rescue Exception => e puts "#{e.class}: #{e.}" end end |
Instance Attribute Details
#pause ⇒ Object
Returns the value of attribute pause.
23 24 25 |
# File 'lib/games_and_rpg_paradise/gui/gosu/garden_hero/core/game_window.rb', line 23 def pause @pause end |
#total_score ⇒ Object
Returns the value of attribute total_score.
24 25 26 |
# File 'lib/games_and_rpg_paradise/gui/gosu/garden_hero/core/game_window.rb', line 24 def total_score @total_score end |
#win_game ⇒ Object
Returns the value of attribute win_game.
25 26 27 |
# File 'lib/games_and_rpg_paradise/gui/gosu/garden_hero/core/game_window.rb', line 25 def win_game @win_game end |
Instance Method Details
#button_down(key) ⇒ Object
button down event
68 69 70 71 72 73 74 75 |
# File 'lib/games_and_rpg_paradise/gui/gosu/garden_hero/core/game_window.rb', line 68 def (key) case key when Gosu::KbEscape close when Gosu::KbP @pause = !@pause if @menu.display === false end end |
#draw ⇒ Object
#
draw
#
53 54 55 56 |
# File 'lib/games_and_rpg_paradise/gui/gosu/garden_hero/core/game_window.rb', line 53 def draw @menu.draw @level.draw if @menu.display === false end |
#level? ⇒ Boolean Also known as: level
#
level?
#
46 47 48 |
# File 'lib/games_and_rpg_paradise/gui/gosu/garden_hero/core/game_window.rb', line 46 def level? @level end |
#update ⇒ Object
#
update
#
61 62 63 64 65 |
# File 'lib/games_and_rpg_paradise/gui/gosu/garden_hero/core/game_window.rb', line 61 def update @menu.display = true if win_game @menu.update if pause || win_game @level.update if not pause && win_game == false end |