class Scar::Scene
- Scar::Scene
- Reference
- Object
Overview
A Scene is a container for one independent state of your application, like title screen, in-game, pause menu, ...
A Scene contains Space
s.
Scenes live on an App
's scene stack, while only the topmost scene is updated and rendered. This means that you can
e. g. push your pause scene onto the stack and pop it off later and your ingame scene will get paused automatically.
You could also implement a system that updates and/or renders other scenes, so that your pause scene shows your game
in the background.
Example usage:
sc = Scene.new
sc << Space.new("ui", ...)
sc << Space.new("game", ...)
app << sc
Defined in:
scar/scene.crConstructors
Instance Method Summary
-
#<<(*spaces : Space)
Adds one or more spaces to the scene and returns self
-
#[](id : String) : Space
Returns the space with the given id
-
#[]?(id : String) : Space | Nil
Returns the space with the given id or nil when it is not found
-
#reorder_spaces
Sorts the spaces in the scene by their z value
- #spaces : Array(Scar::Space)
Constructor Detail
Instance Method Detail
Returns the space with the given id or nil when it is not found