scar
  • The scar game library
  • Application Structure
    • App
    • Scenes
    • Spaces
    • Entities
    • Components
    • Systems
    • Objects
    • Drawing
    • Events
  • Builtin Features
    • Actions
    • Assets
    • Config
    • Input
    • Logger
    • Music
    • Tweens
    • Util
    • Vectors & Rects
  • Builtin Components
    • Text
    • Sprite
    • Animated Sprite
  • Builtin Systems
    • Animate Sprites
Powered by GitBook
On this page

Was this helpful?

  1. Application Structure

Scenes

PreviousAppNextSpaces

Last updated 5 years ago

Was this helpful?

Every scar app is organized in scenes. A scene is a container for . It should contain everything that has to exist in one single game scene. For instance, there could be a splashscreen scene, a main menu scene and a gameplay scene.

Scenes can be created with as parameters or without without them. << and pop can then be used afterwards to add or remove them, [] or []? or spaces to get specific spaces. Calling update and render are handled by the containing the scene.

The scenes are managed by the App scene stack. You can access it via App#<<, App#pop, or the scene_stack getter. App#scene returns the topmost scene for convenient access. Only the scene on top of the scene stack gets updated and rendered.

Because of the stack structure, scenes can be inserted one after another and afterwards pop'ed off the stack. This can be used to e. g. show a main menu scene, then start the gameplay scene and then popping it to see the menu again. Scenes on the stack are not deleted until they are popped.

An example can be found in the .

spaces
spaces
App
next section