The event which will be triggered after the physics process.
物理过程之后所触发的事件。
The event which will be triggered before the physics process.
物理过程之前所触发的事件。
The event which will be triggered after launching a new scene.
The event which will be triggered after engine and components update logic.
The event which will be triggered before launching a new scene.
The event which will be triggered before loading a new scene.
The event which will be triggered at the beginning of every frame.
The event which will be triggered when the singleton of Director initialized.
The event which will be triggered when the singleton of Director reset.
Calculates delta time since last time it was called, the result is saved to an internal property.
End the life of director in the next frame
Returns the FPS value. Please use Game.setFrameRate to control animation interval.
Returns the AnimationManager
associated with this director. Please use getSystem(AnimationManager.ID)
Returns the current time.
Returns the delta time since last frame.
Returns current logic Scene.
Returns current logic Scene.
Returns the scheduler associated with this director.
get a system.
Returns how many frames were called since the director started.
Returns the total passed time since game start, unit: ms
Returns the size of the WebGL view in points.
It takes into account any possible rotation (device orientation) of the window.
Returns the size of the OpenGL view in pixels.
It takes into account any possible rotation (device orientation) of the window.
On Mac winSize and winSizeInPixels return the same value.
(The pixel here refers to the resource resolution. If you want to get the physics resolution of device, you need to use view.getFrameSize()
)
Returns whether or not the Director is paused.
Loads the scene by its name.
The name of the scene to load.
callback, will be called after scene launched.
if error, return false
Run main loop of director
Pause the director's ticker, only involve the game logic execution.
It won't pause the rendering process nor the event manager.
If you want to pause the entire game including rendering, audio and event,
please use game.pause
.
Pre-loads the scene to reduces loading time. You can call this method at any time you want.
After calling this method, you still need to launch the scene by director.loadScene
.
It will be totally fine to call director.loadScene
at any time even if the preloading is not
yet finished, the scene will be launched after loaded automatically.
场景名称。
加载回调。
Pre-loads the scene to reduces loading time. You can call this method at any time you want.
After calling this method, you still need to launch the scene by director.loadScene
.
It will be totally fine to call director.loadScene
at any time even if the preloading is not
yet finished, the scene will be launched after loaded automatically.
场景名称。
加载进度回调。
加载回调。
Removes cached all cocos2d cached data.
Purge the director
itself, including unschedule all schedule,
remove all event listeners, clean up and exit the running scene, stops all animations, clear cached data.
Register a system.
Reset the director, can be used to restart the director after purge
Resume game logic execution after pause, if the current scene is not paused, nothing will happen.
Run a scene. Replaces the running scene with a new one or enter the first scene.
The new scene will be launched at the end of the current frame.
The need run scene.
The function invoked at the scene before loading.
The function invoked at the scene after launch.
Run a scene. Replaces the running scene with a new one or enter the first scene.
The new scene will be launched immediately.
The need run scene.
The function invoked at the scene before loading.
The function invoked at the scene after launch.
Sets animation interval, this doesn't control the main loop.
To control the game's frame rate overall, please use game.setFrameRate
The animation interval desired.
Set color for clear screen.
(Implementation can be found in directorCanvas.js/directorWebGL.js)
Enables or disables WebGL depth test.
Implementation can be found in directorCanvas.js/directorWebGL.js
Sets the scheduler associated with this director.
Starts Animation
Stops animation
Generated using TypeDoc
ATTENTION: USE `director` INSTEAD OF `Director`.
`director` is a singleton object which manage your game's logic flow.
Since the `director` is a singleton, you don't need to call any constructor or create functions,
the standard way to use it is by calling:
- `director.methodName();`
It creates and handle the main Window and manages how and when to execute the Scenes.
The
director
is also responsible for:- initializing the OpenGL context
- setting the OpenGL pixel format (default on is RGB565)
- setting the OpenGL buffer depth (default on is 0-bit)
- setting the color for clear screen (default one is BLACK)
- setting the projection (default one is 3D)
- setting the orientation (default one is Portrait)
The
director
also sets the default OpenGL context:- GL_TEXTURE_2D is enabled
- GL_VERTEX_ARRAY is enabled
- GL_COLOR_ARRAY is enabled
- GL_TEXTURE_COORD_ARRAY is enabled
`director` also synchronizes timers with the refresh rate of the display.
Features and Limitations:
- Scheduled timers & drawing are synchronizes with the refresh rate of the display
- Only supports animation intervals of 1/60 1/30 & 1/15