class FelFlame::Stage

Stores Scenes 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.

Attributes

scenes[W]

Allows clearing of scenes and systems. Used internally by FelFlame and shouldn't need to be ever used by developers @!visibility private

systems[W]

Allows clearing of scenes and systems. Used internally by FelFlame and shouldn't need to be ever used by developers @!visibility private

Public Class Methods

add(*scenes_to_add) click to toggle source

Add any number of Scenes to the Stage @return [Boolean] true

# File lib/felflame/stage_manager.rb, line 11
def add(*scenes_to_add)
  self.scenes |= scenes_to_add
  scenes_to_add.each do |scene|
    self.systems |= scene.systems
  end
  systems.sort_by!(&:priority)
  true
end
call() click to toggle source

Executes one frame of the game. This executes all the Systems in the Scenes added to the Stage. Systems that exist in two or more different Scenes will still only get executed once. @return [Boolean] true

# File lib/felflame/stage_manager.rb, line 51
def call
  systems.each(&:call)
  true
end
clear() click to toggle source

Clears all Scenes that were added to the Stage @return [Boolean] true

# File lib/felflame/stage_manager.rb, line 43
def clear
  systems.clear
  scenes.clear
  true
end
remove(*scenes_to_remove) click to toggle source

Remove any number of Scenes from the Stage @return [Boolean] true

# File lib/felflame/stage_manager.rb, line 22
def remove(*scenes_to_remove)
  self.scenes -= scenes_to_remove
  update_systems_list
  true
end
scenes() click to toggle source

Contains all the Scenes added to the Stage @return [Array<Scene>]

# File lib/felflame/stage_manager.rb, line 58
def scenes
  @scenes ||= []
end
systems() click to toggle source

Stores systems in the order the stage manager needs to call them This method should generally only need to be used internally and not by a game developer @!visibility private

# File lib/felflame/stage_manager.rb, line 65
def systems
  @systems ||= []
end
update_systems_list() click to toggle source

Updates the list of systems from the Scenes added to the Stage and make sure they are ordered correctly This is used internally by FelFlame and shouldn't need to be ever used by developers @return [Boolean] true @!visibility private

# File lib/felflame/stage_manager.rb, line 32
def update_systems_list
  systems.clear
  scenes.each do |scene|
    self.systems |= scene.systems
  end
  systems.sort_by!(&:priority)
  true
end