Class cc.Director
Extends
cc.Class.
Defined in: CCDirector.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Class that creates and handle the main Window and manages how |
Method Attributes | Method Name and Description |
---|---|
addRegionToDirtyRegion(rect)
|
|
calculates delta time since last time it was called
|
|
convertToGL(point)
converts a UIKit coordinate to an OpenGL coordinate |
|
convertToUI(point)
converts an OpenGL coordinate to a UIKit coordinate |
|
ctor()
Constructor
|
|
Draw the scene.
|
|
enableRetinaDisplay(enabled)
Will enable Retina Display on devices that supports it. |
|
end()
end director
|
|
Get the FPS value
|
|
get the size in pixels of the surface. |
|
<static> |
cc.Director.getInstance()
returns a shared instance of the director
|
This object will be visited after the main scene is visited. |
|
Get the CCEGLView, where everything is rendered
|
|
Sets an OpenGL projection
|
|
Get current running Scene.
|
|
(cc.Scheduler associated with this director)
|
|
seconds per frame
|
|
How many frames were called since the director started
|
|
returns the size of the OpenGL view in points. |
|
returns the size of the OpenGL view in pixels. |
|
getZEye()
|
|
init()
initializes cc.Director
|
|
Whether or not to display the FPS on the bottom-left corner
|
|
is next delta time zero
|
|
isPaused()
Whether or not the Director is paused
|
|
Whether or not the replaced scene will receive the cleanup message. |
|
pause()
pause director
|
|
popScene()
Pops out a scene from the queue. |
|
Pops out all scenes from the queue until the root scene in the queue. |
|
Removes cached all cocos2d cached data.
|
|
purge Director
|
|
pushScene(scene)
Suspends the execution of the running scene, pushing it on the stack of suspended scenes. |
|
rectIsInDirtyRegion(rect)
|
|
replaceScene(scene)
Replaces the running scene with a new one.
|
|
reshapeProjection(newWindowSize)
changes the projection size
|
|
resume()
resume director
|
|
runWithScene(scene)
Enters the Director's main loop with the given Scene. |
|
setAccelerometer(accelerometer)
|
|
setActionManager(actionManager)
|
|
setAlphaBlending(on)
enables/disables OpenGL alpha blending
|
|
setContentScaleFactor(scaleFactor)
The size in pixels of the surface. |
|
setDepthTest(on)
enables/disables OpenGL depth test
|
|
setDisplayStats(displayFPS)
Display the FPS on the bottom-left corner
|
|
sets the OpenGL default values
|
|
setKeyboardDispatcher(keyboardDispatcher)
|
|
setMouseDispatcher(mouseDispatcher)
|
|
setNextDeltaTimeZero(nextDeltaTimeZero)
set next delta time is zero
|
|
set next scene
|
|
setNotificationNode(node)
set Notification Node
|
|
setOpenGLView(openGLView)
Set the CCEGLView, where everything is rendered
|
|
setProjection(projection)
Sets an OpenGL projection
|
|
setScheduler(scheduler)
|
|
setTouchDispatcher(touchDispatcher)
|
|
setWatcherCallbackFun(pSender, func)
|
|
update content scale factor
|
Class that creates and handle the main Window and manages how
and when to execute the Scenes.
The cc.Director is also responsible for:
- initializing the OpenGL context
- setting the OpenGL pixel format (default on is RGB565)
- setting the OpenGL pixel format (default on is RGB565)
- setting the OpenGL buffer depth (default one is 0-bit)
- setting the projection (default one is 3D)
- setting the orientation (default one is Protrait)
Since the cc.Director is a singleton, the standard way to use it is by calling:
- cc.Director.getInstance().methodName();
The CCDirector 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
- Parameters:
- rect
converts a UIKit coordinate to an OpenGL coordinate
Useful to convert (multi) touches coordinates to the current layout (portrait or landscape)
- Parameters:
- {cc.Point} point
- Returns:
- {cc.Point}
converts an OpenGL coordinate to a UIKit coordinate
Useful to convert node points to window points for calls such as glScissor
- Parameters:
- {cc.Point} point
- Returns:
- {cc.Point}
Will enable Retina Display on devices that supports it.
It will enable Retina Display on iPhone4 and iPod Touch 4.
It will return YES, if it could enabled it, otherwise it will return NO.
This is the recommened way to enable Retina Display.
- Parameters:
- {Boolean} enabled
- Returns:
- {Boolean}
- Returns:
- {Number}
get the size in pixels of the surface. It could be different than the screen size.
High-res devices might have a higher surface size than the screen size.
Only available when compiled using SDK >= 4.0.
- Returns:
- {Number}
- Returns:
- {cc.Director}
This object will be visited after the main scene is visited.
This object MUST implement the "visit" selector.
Useful to hook a notification object, like CCNotifications (http://github.com/manucorporat/CCNotifications)
- Returns:
- {cc.Node}
- Returns:
- {*}
- Returns:
- {Number}
- Returns:
- {cc.Scene}
- Returns:
- {Number}
returns the size of the OpenGL view in points.
It takes into account any possible rotation (device orientation) of the window
- Returns:
- {cc.Size}
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.
- Returns:
- {cc.Size}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
Whether or not the replaced scene will receive the cleanup message.
If the new scene is pushed, then the old scene won't receive the "cleanup" message.
If the new scene replaces the old one, the it will receive the "cleanup" message.
- Returns:
- {Boolean}
Pops out a scene from the queue.
This scene will replace the running one.
The running scene will be deleted. If there are no more scenes in the stack the execution is terminated.
ONLY call it if there is a running scene.
Pops out all scenes from the queue until the root scene in the queue.
This scene will replace the running one.
The running scene will be deleted. If there are no more scenes in the stack the execution is terminated.
ONLY call it if there is a running scene.
Suspends the execution of the running scene, pushing it on the stack of suspended scenes.
The new scene will be executed.
Try to avoid big stacks of pushed scenes to reduce memory allocation.
ONLY call it if there is a running scene.
- Parameters:
- {cc.Scene} scene
- Parameters:
- rect
- Parameters:
- {cc.Scene} scene
- Parameters:
- {cc.Size} newWindowSize
Enters the Director's main loop with the given Scene.
Call it to run only your FIRST scene.
Don't call it if there is already a running scene.
- Parameters:
- {cc.Scene} scene
- Parameters:
- accelerometer
- Parameters:
- actionManager
- Parameters:
- {Boolean} on
The size in pixels of the surface. It could be different than the screen size.
High-res devices might have a higher surface size than the screen size.
Only available when compiled using SDK >= 4.0.
- Parameters:
- {Number} scaleFactor
- Parameters:
- {Boolean} on
- Parameters:
- displayFPS
- Parameters:
- keyboardDispatcher
- Parameters:
- mouseDispatcher
- Parameters:
- {Boolean} nextDeltaTimeZero
- Parameters:
- {cc.Node} node
- Parameters:
- {*} openGLView
- Parameters:
- {Number} projection
- Parameters:
- scheduler
- Parameters:
- touchDispatcher
- Parameters:
- pSender
- func