Class: GameStack

GameStack

The game stack that is organizing the game scenes

new GameStack ()

Properties:
Name Type Description
content Array.<SceneGame> The stack content
top Array.<SceneGame> The stack top content
subTop Array.<SceneGame> The stack top - 1 content
bot Array.<SceneGame> The stack bot content

Methods

push (scene)

Push a new scene in the stack
Name Type Description
scene SceneGame The scene to push

pop ()SceneGame

Pop (remove) the last scene in the stack
Returns:
Type Description
SceneGame The last scene that is removed

popAll ()

Pop (remove) all the scene in the stack

replace (scene)SceneGame

Replace the last scene in the stack by a new scene
Name Type Description
scene SceneGame The scene to replace
Returns:
Type Description
SceneGame The last scene that is replaced

at (i)SceneGame

Get the scene at a specific index in the stack. 0 is the bottom of the stack
Name Type Description
i number Index in the stack
Returns:
Type Description
SceneGame The scene in the index of the stack

isEmpty ()boolean

Check if the stack is empty
Returns:
Type Description
boolean

isLoading ()boolean

Check if top content is loading
Returns:
Type Description
boolean

pushTitleScreen ()SceneTitleScreen

Push the title screen when empty
Returns:
Type Description
SceneTitleScreen

update ()

Update the stack

onKeyPressed (key)

First key press handle for the current stack
Name Type Description
key number The key ID pressed

onKeyReleased (key)

First key release handle for the current stack
Name Type Description
key number The key ID released

onKeyPressedRepeat (key)boolean

Key pressed repeat handle for the current stack
Name Type Description
key number The key ID pressed
Returns:
Type Description
boolean false if the other keys are blocked after it

onKeyPressedAndRepeat (key)boolean

Key pressed repeat handle for the current stack, but with a small wait after the first pressure (generally used for menus)
Name Type Description
key number The key ID pressed
Returns:
Type Description
boolean false if the other keys are blocked after it

draw3D ()

Draw the 3D for the current stack

drawHUD ()

Draw HUD for the current stack