Class: Conjuration::SceneManager
- Inherits:
-
Object
- Object
- Conjuration::SceneManager
- Defined in:
- lib/conjuration/managers/scene_manager.rb
Instance Attribute Summary collapse
-
#current_scene ⇒ Object
readonly
Returns the value of attribute current_scene.
Instance Method Summary collapse
- #add_scene(key, scene_class) ⇒ Object
- #button_down(window, id) ⇒ Object
- #button_up(window, id) ⇒ Object
- #draw(window) ⇒ Object
-
#initialize(window) ⇒ SceneManager
constructor
A new instance of SceneManager.
- #set_scene(key, **options) ⇒ Object
-
#update(window) ⇒ Object
.
Constructor Details
#initialize(window) ⇒ SceneManager
Returns a new instance of SceneManager.
5 6 7 8 |
# File 'lib/conjuration/managers/scene_manager.rb', line 5 def initialize(window) @scenes = {} @window = window end |
Instance Attribute Details
#current_scene ⇒ Object (readonly)
Returns the value of attribute current_scene.
18 19 20 |
# File 'lib/conjuration/managers/scene_manager.rb', line 18 def current_scene @current_scene end |
Instance Method Details
#add_scene(key, scene_class) ⇒ Object
10 11 12 |
# File 'lib/conjuration/managers/scene_manager.rb', line 10 def add_scene(key, scene_class) @scenes[key] = scene_class end |
#button_down(window, id) ⇒ Object
30 31 32 |
# File 'lib/conjuration/managers/scene_manager.rb', line 30 def (window, id) current_scene.(window, id) end |
#button_up(window, id) ⇒ Object
34 35 36 |
# File 'lib/conjuration/managers/scene_manager.rb', line 34 def (window, id) current_scene.(window, id) end |
#draw(window) ⇒ Object
26 27 28 |
# File 'lib/conjuration/managers/scene_manager.rb', line 26 def draw(window) current_scene.draw(window) end |
#set_scene(key, **options) ⇒ Object
14 15 16 |
# File 'lib/conjuration/managers/scene_manager.rb', line 14 def set_scene(key, **) @current_scene = @scenes[key].new(@window, **) end |
#update(window) ⇒ Object
22 23 24 |
# File 'lib/conjuration/managers/scene_manager.rb', line 22 def update(window) current_scene.update(window) end |