Members
(readonly) batchSize :number
The number of scenes that exist within the current batch, i.e. how many
Scene objects currently exist in memory. Note that a batch can contain
multiple scenes, but only one scene can be selected at a time.
Type:
- number
- Source:
paused :boolean
Pauses updates for all scenes, including persistent scenes. Rendering and
lifecycle callbacks continue. Input and screen objects remain active, so
pause controls must run outside the paused scene updates.
Type:
- boolean
- Default Value:
- false
- Source:
(readonly) pending :boolean
Whether a requested batch or selection still awaits lifecycle processing.
Type:
- boolean
- Source:
(readonly) selected :rune.scene.Scene
The currently selected scene.
Type:
- Source:
Methods
find(name) → {rune.scene.Scene}
Searches for a specific scene in the current batch of scene objects. The
search is based on scene name.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The name of the searched scene. |
- Source:
Returns:
- Type
- rune.scene.Scene
findAndSelect(name) → {boolean}
Requests selection by name in the pending batch, or the current batch if
no load is pending. Uses the same batch as select(); activation is deferred
until update(). A missing name returns false without changing the request.
Unlike find(), this searches the pending batch when one exists.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The name of the searched scene. |
- Source:
Returns:
- Type
- boolean
load(batch) → {undefined}
Activates a batch of scenes. This process removes any previous scenes and
frees up allocated memory, hence the process can not be undone. All scenes
in the batch are initialized on the next update tick. A load requested
during init() or old-batch dispose() remains pending until the following
update. If several loads are requested before then, the latest request
replaces the pending batch.
Replacing a pending batch disposes its abandoned scenes immediately; scenes
still in the current or new pending batch are retained.
The array is copied; later array edits do not affect the manager. Scene
objects are retained by reference and disposed when removed by the manager.
Every scene must provide callable init, update, render, dispose, onSelect
and onDeselect methods. A scene object may occur only once per batch;
distinct objects may share a name. Objects in the current batch cannot be
loaded again: use select() to switch scenes, or create a new instance to
restart one. Invalid input leaves current and pending batches unchanged.
Parameters:
| Name | Type | Description |
|---|---|---|
batch |
Array.<rune.scene.Scene> | Scene list to copy into the manager. |
- Source:
Throws:
-
If the batch is empty, is not an array or contains invalid, duplicate or current scenes.
- Type
- Error
Returns:
- Type
- undefined
select(index) → {undefined}
Select a scene from the current batch. Note that only the selected scene is
rendered. Inactive scenes remain unchanged during their time as inactive.
Parameters:
| Name | Type | Description |
|---|---|---|
index |
number | Zero-based integer index in the pending or current batch. |
- Source:
Throws:
-
If index is not an integer number within the batch bounds.
- Type
- RangeError
Returns:
- Type
- undefined