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

Class Method Summary collapse

Class Attribute Details

.scenesArray<Scene>

Contains all the Scenes added to the Stage

Returns:

  • (Array<Scene>)


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

Returns:

  • (Boolean)

    true



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

.callBoolean

Executes one frame of the game. This executes all the Scenes added to the Stage in order of their priority.

Returns:

  • (Boolean)

    true



35
36
37
38
# File 'lib/felflame/stage_manager.rb', line 35

def call
  self.scenes.each(&:call)
  true
end

.clearBoolean

Clears all Scenes that were added to the Stage

Returns:

  • (Boolean)

    true



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

Returns:

  • (Boolean)

    true



21
22
23
24
# File 'lib/felflame/stage_manager.rb', line 21

def remove(*scenes_to_remove)
  self.scenes -= scenes_to_remove
  true
end