Module: FelFlame::Stage
- Defined in:
- lib/felflame.rb,
lib/felflame/stage_manager.rb
Overview
Stores Scenes you add to it which you want to execute on each frame. When called upon will execute all Systems in the Scenes in the Stage and will execute them according to their priority order.
Class Attribute Summary collapse
-
.scenes ⇒ Array<Scene>
readonly
Contains all the Scenes added to the Stage.
Class Method Summary collapse
-
.add(*scenes_to_add) ⇒ Boolean
Add any number of Scenes to the Stage.
-
.call ⇒ Boolean
Executes one frame of the game.
-
.clear ⇒ Boolean
Clears all Scenes that were added to the Stage.
-
.remove(*scenes_to_remove) ⇒ Boolean
Remove any number of Scenes from the Stage.
Class Attribute Details
.scenes ⇒ Array<Scene>
Contains all the Scenes added to the Stage
42 43 44 |
# File 'lib/felflame/stage_manager.rb', line 42 def scenes @scenes ||= [] end |
Class Method Details
.add(*scenes_to_add) ⇒ Boolean
Add any number of Scenes to the Stage
13 14 15 16 17 |
# File 'lib/felflame/stage_manager.rb', line 13 def add(*scenes_to_add) self.scenes |= scenes_to_add self.scenes = scenes.sort_by(&:priority) true end |
.call ⇒ Boolean
Executes one frame of the game. This executes all the Scenes added to the Stage in order of their priority.
35 36 37 38 |
# File 'lib/felflame/stage_manager.rb', line 35 def call self.scenes.each(&:call) true end |
.clear ⇒ Boolean
Clears all Scenes that were added to the Stage
28 29 30 31 |
# File 'lib/felflame/stage_manager.rb', line 28 def clear self.scenes.clear true end |
.remove(*scenes_to_remove) ⇒ Boolean
Remove any number of Scenes from the Stage
21 22 23 24 |
# File 'lib/felflame/stage_manager.rb', line 21 def remove(*scenes_to_remove) self.scenes -= scenes_to_remove true end |