The canvas of the game.
The current game configuration, please be noticed any modification directly on this object after the game initialization won't take effect.
The container of game canvas.
The outer frame of the game canvas; parent of game container.
Callback when the scripts of engine have been load.
The renderer backend of the game.
Event triggered after engine inited, at this point you will be able to use all engine classes.
It was defined as EVENT_RENDERER_INITED in cocos creator v1.x and renamed in v2.0.
In cocos creator 3d, EVENT_RENDERER_INITED is a new event, look up define for details.
Event triggered after game inited, at this point all engine objects and game scripts are loaded
Event triggered when game hide to background.
Please note that this event is not 100% guaranteed to be fired on Web platform,
on native platforms, it corresponds to enter background event, os status bar or notification center may not trigger this event.
Event triggered after renderer inited, at this point you will be able to use all gfx renderer feature.
Event triggered when game restart
Event triggered when game back to foreground
Please note that this event is not 100% guaranteed to be fired on Web platform,
on native platforms, it corresponds to enter foreground event.
Web Canvas 2d API as renderer backend.
OpenGL API as renderer backend.
WebGL API as renderer backend.
Indicates whether the engine has inited
Add a persistent root node to the game, the persistent node won't be destroyed during scene transition.
The target node must be placed in the root level of hierarchy, otherwise this API won't have any effect.
The node to be made persistent
Trigger an event directly with the event name and necessary arguments.
event type
End game, it will close the game window
Get frame rate set for the game, it doesn't represent the real frame rate.
frame rate
Checks whether there is correspond event listener registered on the given event.
Event type.
Callback function when event triggered.
Callback callee.
Init game with configuration object.
Pass configuration object
Check whether the game is paused.
Check whether the node is a persistent root node.
The node to be checked
Removes the listeners previously registered with the same type, callback, target and or useCapture, if only type is passed as parameter, all listeners registered with that type will be removed.
A string representing the event type being removed.
The callback to remove.
Register an callback of a specific event type on the game object.
This type of event should be triggered via emit
.
A string representing the event type to listen for.
The callback that will be invoked when the event is dispatched.
The callback is ignored if it is a duplicate (the callbacks are unique).
The target (this object) to invoke the callback, can be null
After the first invocation, whether the callback should be unregistered.
Register an callback of a specific event type on the game object,
the callback will remove itself after the first time it is triggered.
A string representing the event type to listen for.
The callback that will be invoked when the event is dispatched.
The callback is ignored if it is a duplicate (the callbacks are unique).
The target (this object) to invoke the callback, can be null
Pause the game main loop. This will pause:
game logic execution, rendering process, event manager, background music and all audio effects.
This is different with director.pause
which only pause the game logic execution.
Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
The event type or target with which the listeners will be removed
Remove a persistent root node.
The node to be removed from persistent node list
Restart game.
Resume the game from pause. This will resume:
game logic execution, rendering process, event manager, background music and all audio effects.
Run game with configuration object and onStart function.
function to be executed after game initialized
Set frame rate of game.
Run the game frame by frame.
Removes all callbacks previously registered with the same target (passed as parameter). This is not for removing all listeners in the current event target, and this is not for removing all listeners the target parameter have registered. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
The target to be searched for all related listeners
Generated using TypeDoc
An object to boot the game.