Class: Scene

rune.scene.Scene(nameopt)

Represents a scene within the current application. A scene is a combination of visual (and logical) objects that are updated and rendered within a controlled scope of an application. An application usually consists of several scenes; one for menu system, one for gameplay, etc..

Constructor

new Scene(nameopt)

Creates a new "blank" scene.
Parameters:
Name Type Attributes Description
name string <optional>
The scene name.
Source:

Members

(readonly) application :rune.system.Main

Reference to the application's entry point class, ie. the main class of the application. Useful for accessing the application's subsystem.
Type:
  • rune.system.Main
Source:

(readonly) cameras :rune.camera.Cameras

The camera system connected to this Scene.
Type:
Source:

(readonly) console :rune.console.ConsoleManager

Reference to the developer console. This can be used during the development stage to execute tests and debugging commands during runtime.
Type:
Source:

(readonly) gamepads :rune.input.Gamepads

Reference to the application's subsystem for connected gamepad devices.
Type:
Source:

(readonly) groups :rune.display.DisplayGroups

Reference to the scene's built-in group manager. Useful when objects that appear within the scene need to be divided into groups.
Type:
Source:

(readonly) keyboard :rune.input.Keyboard

Reference to the keyboard manager. Use this reference to read the state of any keyboard key.
Type:
Source:

(readonly) name :string

Name of current scene. This string can be used to easily find a specific scene in a batch of scenes.
Type:
  • string
Source:

persistent :boolean

Determines whether the current scene should be updated even if it is not selected. Usually, the update loop is disabled for scenes that are disabled, ie. are not selected.
Type:
  • boolean
Default Value:
  • false
Source:

(readonly) stage :rune.display.Stage

Represents the main drawing area. Display objects added to the Stage are rendered by the camera system.
Type:
Source:

(readonly) states :rune.state.States

A finite-state machine.
Type:
Source:

(readonly) timers :rune.timer.Timers

Timer manager that can be used to create Timer objects for the purpose of counting down time. Useful if you want to add or remove an object after n seconds.
Type:
Source:

(readonly) tweens :rune.tween.Tweens

Subsystem for handling interpolation within the current scene.
Type:
Source:

Methods

dispose() → {undefined}

This method is activated automatically by the scene manager (Scenes) when the current scene ends, ie. is removed and deallocated.
Source:
Returns:
Type
undefined

init() → {undefined}

This method is automatically activated by the scene manager (Scenes) as soon as the current scene is initiated by the game engine. Use this method to populate the current scene.
Source:
Returns:
Type
undefined

(protected) m_initCamera() → {undefined}

Creates a camera object with the same resolution as the application. Override this method if, for example, multiple camera objects are to be created.
Source:
Returns:
Type
undefined

onDeselect(scene) → {undefined}

This method is automatically activated by the scene manager (Scenes) when the current scene is deactivated.
Parameters:
Name Type Description
scene rune.scene.Scene Reference to the scene object that replaces the existing scene.
Source:
Returns:
Type
undefined

onSelect(scene) → {undefined}

This method is activated automatically by the scene manager (Scenes) when the current object is activated, ie. is selected.
Parameters:
Name Type Description
scene rune.scene.Scene Reference to the previous scene object.
Source:
Returns:
Type
undefined

render() → {undefined}

Goes through the content of the scene and renders graphics.
Source:
Returns:
Type
undefined

update(step) → {undefined}

This method is automatically activated by the scene manager for each tick within the application. Apply scene logic to this method.
Parameters:
Name Type Description
step number Current time step.
Source:
Returns:
Type
undefined