CORE/docs/references/smgr.gd.md

138 lines
4.6 KiB
Markdown
Raw Normal View History

---
hide:
- navigation
---
# Scene Manager (core.smgr)
Responsible for displaying scenes in order.
## Overlays
The scene manager uses something called **overlays**. They hold scenes while keeping order. You can think of them like organized collections of scenes *(because they are exactly that)*. There are four **configurable** and one **unconfigurable** overlay.
### Overlay #1 - `debug`
- description `The debug overlay should contain things like a FPS counter, debug menu, etc..`
- configurable `yes`
- more than one scene `yes`
- adding a scene **[add_debug()](#add_debug)**
- removing a scene **[remove_debug()](#remove_debug)**
### Overlay #2 - `cutscene`
- description `The cutscene should contain... well a cutscene.`
- configurable `yes`
- more than one scene `no`
- adding a scene **[add_cutscene()](#add_cutscene)**
- removing a scene **[remove_cutscene()](#remove_cutscene)**
### Overlay #3 - `menu`
- description `The menu overlay should contain multiple menu scenes.`
- configurable `yes`
- more than one scene `yes`
- adding a scene **[add_menu()](#add_menu)**
- removing a scene **[remove_menu()](#remove_menu)**
### Overlay #4 - `game`
- description `The game overlay should contain a game scene. We recommend displaying main menus under the game instead of the menu overlay.`
- configurable `yes`
- more than one scene `no`
- adding a scene **[add_game()](#add_game)**
- removing a scene **[remove_game()](#remove_game)**
### Overlay #5 - `COREBackground`
- description `COREBackground is a unconfigurable overlay responsible for displaying the log and serves as a background if nothing is displayed.`
- configurable `no`
- more than one scene `no`
## Methods
### add_debug()
- returns `bool`
- description `Adds a PackedScene to the debug overlay.`
- argument `resource_name`
- type `String`
- mandatory `yes`
- description `Used for loading the scene and the loaded scene name.`
### remove_debug()
- returns `bool`
- description `Removes a menu scene from the debug overlay.`
- argument `scene_name`
- type `String`
- mandatory `yes`
- description `Should be the same as the "resource_name" argument used previously in add_debug().`
### add_cutscene()
- returns `bool`
- description `Adds a PackedScene to the cutscene overlay.`
- argument `resource_name`
- type `String`
- mandatory `yes`
- description `Used for loading the scene and the loaded scene name.`
### remove_cutscene()
- returns `bool`
- description `Removes the game scene from the cutscene overlay.`
### add_menu()
- returns `bool`
- description `Adds a PackedScene to the menu overlay.`
- argument `resource_name`
- type `String`
- mandatory `yes`
- description `Used for loading the scene and the loaded scene name.`
### remove_menu()
- returns `bool`
- description `Removes a menu scene from the menu overlay.`
- argument `scene_name`
- type `String`
- mandatory `yes`
- description `Should be the same as the "resource_name" argument used previously in add_menu().`
### add_game()
- returns `bool`
- description `Adds a PackedScene to the game overlay.`
- argument `resource_name`
- type `String`
- mandatory `yes`
- description `Used for loading the scene and the loaded scene name.`
### remove_game()
- returns `bool`
- description `Removes the game scene from the game overlay.`
## Internal Variables
Do not touch or you will cause breakage.
### ccr
- type `Control`
- default value `null`
- description `The CORE Scene Root.`
### ccr_debug
- type `Control`
- default value `null`
- description `The debug overlay.`
### ccr_debug_names
- type `Array`
- default value `[]`
- description `A collection of all resource names loaded in the debug overlay.`
- Format `["resource_name"]`
### ccr_cutscene
- type `Control`
- default value `null`
- description `The cutscene overlay.`
### ccr_cutscene_inuse
- type `bool`
- default value `null`
- description `Used for checking if a cutscene scene has been loaded already.`
### ccr_menu
- type `Control`
- default value `null`
- description `The menu overlay.`
### ccr_menu_names
- type `Array`
- default value `[]`
- description `A collection of all resource names loaded in the menu overlay.`
- Format `["resource_name"]`
### ccr_game
- type `Control`
- default value `null`
- description `The game overlay.`
### ccr_game_inuse
- type `bool`
- default value `null`
- description `Used for checking if a game scene has been loaded already.`
## Internal methods
Do not execute these or you will cause breakage.
### _ready()
- returns `void`
- description `Adds the CORE Scene Root, migrates it and executes add_overlays()`
### add_overlays()
- returns `void`
- description `Adds all configurable overlays.`