Class: Onsengame::Window
- Inherits:
-
Gosu::Window
- Object
- Gosu::Window
- Onsengame::Window
- Defined in:
- lib/onsengame/window.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#scenes ⇒ Object
readonly
Returns the value of attribute scenes.
Instance Method Summary collapse
- #button_down(id) ⇒ Object
- #draw ⇒ Object
-
#initialize(options = {}) ⇒ Window
constructor
A new instance of Window.
- #update ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Window
Returns a new instance of Window.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/onsengame/window.rb', line 9 def initialize(={}) width = [:width] || 640 height = [:height] || 480 fullscreen = [:fullscreen] || false super(width, height, fullscreen) self. = "Onsengame" @options = @options[:font_dir] ||= File.("../../../data/fonts", __FILE__) @scenes = [] @scenes << Scene::Title.new(self) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/onsengame/window.rb', line 8 def @options end |
#scenes ⇒ Object (readonly)
Returns the value of attribute scenes.
8 9 10 |
# File 'lib/onsengame/window.rb', line 8 def scenes @scenes end |
Instance Method Details
#button_down(id) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/onsengame/window.rb', line 29 def (id) case id when Gosu::KbEscape close else current_scene.(id) end end |
#draw ⇒ Object
25 26 27 |
# File 'lib/onsengame/window.rb', line 25 def draw current_scene.draw end |
#update ⇒ Object
21 22 23 |
# File 'lib/onsengame/window.rb', line 21 def update current_scene.update end |