cocos2d-x
2.2.3-gd2.113-rev1ec524e
|
Class that creates and handle the main Window and manages how and when to execute the Scenes. More...
#include <CCDirector.h>
Public Member Functions | |
CCDirector (void) | |
ctor More... | |
virtual | ~CCDirector (void) |
NA NA. More... | |
virtual bool | init (void) |
virtual long | getClassTypeInfo () |
NA NA. More... | |
CCScene * | getRunningScene (void) |
Get current running Scene. More... | |
double | getAnimationInterval (void) |
Get the FPS value. More... | |
virtual void | setAnimationInterval (double dValue)=0 |
Set the FPS value. More... | |
bool | isDisplayStats (void) |
Whether or not to display the FPS on the bottom-left corner. More... | |
void | setDisplayStats (bool bDisplayStats) |
Display the FPS on the bottom-left corner. More... | |
float | getSecondsPerFrame () |
seconds per frame More... | |
CCEGLView * | getOpenGLView (void) |
Get the CCEGLView, where everything is rendered NA. More... | |
void | setOpenGLView (CCEGLView *pobOpenGLView) |
bool | isNextDeltaTimeZero (void) |
void | setNextDeltaTimeZero (bool bNextDeltaTimeZero) |
bool | isPaused (void) |
Whether or not the Director is paused. More... | |
unsigned int | getTotalFrames (void) |
How many frames were called since the director started. More... | |
ccDirectorProjection | getProjection (void) |
Sets an OpenGL projection. More... | |
void | setProjection (ccDirectorProjection kProjection) |
void | reshapeProjection (const CCSize &newWindowSize) |
reshape projection matrix when canvas has been change" More... | |
void | setViewport () |
Sets the glViewport. More... | |
bool | isSendCleanupToScene (void) |
How many frames were called since the director started. More... | |
CCNode * | getNotificationNode () |
This object will be visited after the main scene is visited. More... | |
void | setNotificationNode (CCNode *node) |
CCDirectorDelegate * | getDelegate () const |
CCDirector delegate. More... | |
void | setDelegate (CCDirectorDelegate *pDelegate) |
CCSize | getWinSize (void) |
returns the size of the OpenGL view in points. More... | |
CCSize | getWinSizeInPixels (void) |
returns the size of the OpenGL view in pixels. More... | |
CCSize | getVisibleSize () |
returns visible size of the OpenGL view in points. More... | |
CCPoint | getVisibleOrigin () |
returns visible origin of the OpenGL view in points. More... | |
CCPoint | convertToGL (const CCPoint &obPoint) |
converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touch coordinates to the current layout (portrait or landscape) More... | |
CCPoint | convertToUI (const CCPoint &obPoint) |
converts an OpenGL coordinate to a UIKit coordinate Useful to convert node points to window points for calls such as glScissor More... | |
float | getZEye (void) |
XXX: missing description. More... | |
void | runWithScene (CCScene *pScene) |
Enters the Director's main loop with the given Scene. More... | |
void | popScene (void) |
Pops out a scene from the queue. More... | |
void | popToRootScene (void) |
Pops out all scenes from the queue until the root scene in the queue. More... | |
void | popToSceneStackLevel (int level) |
Pops out all scenes from the queue until it reaches level . More... | |
void | end (void) |
Ends the execution, releases the running scene. More... | |
void | pause (void) |
Pauses the running scene. More... | |
void | resume (void) |
Resumes the paused scene The scheduled timers will be activated again. More... | |
virtual void | stopAnimation (void)=0 |
Stops the animation. More... | |
virtual void | startAnimation (void)=0 |
The main loop is triggered again. More... | |
void | drawScene (void) |
Draw the scene. More... | |
void | purgeCachedData (void) |
Removes cached all cocos2d cached data. More... | |
void | setDefaultValues (void) |
sets the default values based on the CCConfiguration info More... | |
void | setGLDefaultValues (void) |
sets the OpenGL default values More... | |
void | setAlphaBlending (bool bOn) |
enables/disables OpenGL alpha blending More... | |
void | setDepthTest (bool bOn) |
enables/disables OpenGL depth test More... | |
virtual void | mainLoop (void)=0 |
void | setContentScaleFactor (float scaleFactor) |
The size in pixels of the surface. More... | |
float | getContentScaleFactor (void) |
virtual CCScheduler * | getScheduler (void) |
virtual void | setScheduler (CCScheduler *var) |
virtual CCActionManager * | getActionManager (void) |
virtual void | setActionManager (CCActionManager *var) |
virtual CCTouchDispatcher * | getTouchDispatcher (void) |
virtual void | setTouchDispatcher (CCTouchDispatcher *var) |
virtual CCKeypadDispatcher * | getKeypadDispatcher (void) |
virtual void | setKeypadDispatcher (CCKeypadDispatcher *var) |
virtual CCAccelerometer * | getAccelerometer (void) |
virtual void | setAccelerometer (CCAccelerometer *var) |
virtual float | getDeltaTime (void) |
bool | pushScene (CCScene *pScene) |
Suspends the execution of the running scene, pushing it on the stack of suspended scenes. More... | |
bool | replaceScene (CCScene *pScene) |
Replaces the running scene with a new one. More... | |
![]() | |
CCObject (void) | |
virtual | ~CCObject (void) |
NA. More... | |
void | release (void) |
void | retain (void) |
CCObject * | autorelease (void) |
CCObject * | copy (void) |
bool | isSingleReference (void) const |
unsigned int | retainCount (void) const |
virtual bool | isEqual (const CCObject *pObject) |
virtual void | acceptVisitor (CCDataVisitor &visitor) |
virtual void | update (float dt) |
CCObject (const CCObject &) | |
CCObject & | operator= (const CCObject &) |
virtual void | encodeWithCoder (DS_Dictionary *) |
virtual bool | canEncode () |
CCObjectType | getObjType () const |
virtual int | getTag () const |
virtual void | setTag (int nTag) |
void | setObjType (CCObjectType) |
![]() | |
virtual CCObject * | copyWithZone (CCZone *pZone) |
virtual long | getClassTypeInfo ()=0 |
Static Public Member Functions | |
static CCDirector * | sharedDirector (void) |
returns a shared instance of the director getInstance More... | |
![]() | |
static CCObject * | createWithCoder (DS_Dictionary *) |
Protected Member Functions | |
void | purgeDirector () |
void | setNextScene (void) |
void | showStats () |
void | createStatsLabel () |
void | calculateMPF () |
void | getFPSImageData (unsigned char **datapointer, unsigned int *length) |
void | calculateDeltaTime () |
calculates delta time since last time it was called More... | |
Additional Inherited Members | |
![]() | |
unsigned int | m_uID |
int | m_nLuaID |
Class that creates and handle the main Window and manages how and when to execute the Scenes.
The CCDirector is also responsible for:
Since the CCDirector is a singleton, the standard way to use it is by calling: _ CCDirector::sharedDirector()->methodName();
The CCDirector also sets the default OpenGL context:
CCDirector | ( | void | ) |
ctor
|
virtual |
NA NA.
CCDirector | ( | const CCDirector & | ) |
|
protected |
calculates delta time since last time it was called
|
protected |
void checkSceneReference | ( | void | ) |
converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touch coordinates to the current layout (portrait or landscape)
converts an OpenGL coordinate to a UIKit coordinate Useful to convert node points to window points for calls such as glScissor
|
protected |
void drawScene | ( | void | ) |
Draw the scene.
This method is called every frame. Don't call it manually.
void end | ( | void | ) |
Ends the execution, releases the running scene.
It doesn't remove the OpenGL view from its parent. You have to do it manually.
|
virtual |
|
virtual |
float getActualDeltaTime | ( | void | ) |
|
inline |
Get the FPS value.
|
inlinevirtual |
NA NA.
Implements TypeInfo.
float getContentScaleFactor | ( | void | ) |
CCDirectorDelegate * getDelegate | ( | ) | const |
|
virtual |
bool getDontCallWillSwitch | ( | void | ) |
bool getForceSmoothFix | ( | void | ) |
|
protected |
bool getIsTransitioning | ( | void | ) |
|
virtual |
|
virtual |
TextureQuality getLoadedTextureQuality | ( | void | ) | const |
|
virtual |
CCNode * getNotificationNode | ( | ) |
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)
|
inline |
Sets an OpenGL projection.
|
inline |
Get current running Scene.
Director can only run one Scene at the time
|
virtual |
|
virtual |
float getScreenBottom | ( | void | ) |
float getScreenLeft | ( | void | ) |
float getScreenRight | ( | void | ) |
float getScreenScaleFactor | ( | void | ) |
float getScreenScaleFactorH | ( | void | ) |
float getScreenScaleFactorMax | ( | void | ) |
float getScreenScaleFactorW | ( | void | ) |
float getScreenTop | ( | void | ) |
|
inline |
seconds per frame
bool getSmoothFix | ( | void | ) |
bool getSmoothFixCheck | ( | void | ) |
int getSmoothFixCounter | ( | void | ) |
|
inline |
How many frames were called since the director started.
|
virtual |
CCPoint getVisibleOrigin | ( | ) |
returns visible origin of the OpenGL view in points.
CCSize getVisibleSize | ( | ) |
returns visible size of the OpenGL view in points.
the value is equal to getWinSize if don't invoke CCEGLView::setDesignResolutionSize()
CCSize getWinSize | ( | void | ) |
returns the size of the OpenGL view in points.
CCSize getWinSizeInPixels | ( | void | ) |
returns the size of the OpenGL view in pixels.
float getZEye | ( | void | ) |
XXX: missing description.
|
virtual |
|
inline |
Whether or not to display the FPS on the bottom-left corner.
|
inline |
|
inline |
Whether or not the Director is paused.
|
inline |
How many frames were called since the director started.
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.
|
pure virtual |
Implemented in CCDisplayLinkDirector.
CCDirector & operator= | ( | const CCDirector & | ) |
void pause | ( | void | ) |
Pauses the running scene.
The running scene will be drawed but all scheduled timers will be paused While paused, the draw rate will be 4 FPS to reduce CPU consumption
void popScene | ( | void | ) |
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.
bool popSceneWithTransition | ( | float | , |
PopTransition | |||
) |
void popToRootScene | ( | void | ) |
Pops out all scenes from the queue until the root scene in the queue.
This scene will replace the running one. Internally it will call popToSceneStackLevel(1)
void popToSceneStackLevel | ( | int | level | ) |
Pops out all scenes from the queue until it reaches level
.
If level is 0, it will end the director. If level is 1, it will pop all scenes until it reaches to root scene. If level is <= than the current stack level, it won't do anything.
void purgeCachedData | ( | void | ) |
Removes cached all cocos2d cached data.
It will purge the CCTextureCache, CCSpriteFrameCache, CCLabelBMFont cache
|
protected |
bool pushScene | ( | CCScene * | pScene | ) |
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.
void removeStatsLabel | ( | void | ) |
bool replaceScene | ( | CCScene * | pScene | ) |
Replaces the running scene with a new one.
The running scene is terminated. ONLY call it if there is a running scene.
void resetSmoothFixCounter | ( | void | ) |
void reshapeProjection | ( | const CCSize & | newWindowSize | ) |
reshape projection matrix when canvas has been change"
void resume | ( | void | ) |
Resumes the paused scene The scheduled timers will be activated again.
The "delta time" will be 0 (as if the game wasn't paused)
void runWithScene | ( | CCScene * | pScene | ) |
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.
It will call pushScene: and then it will call startAnimation
int sceneCount | ( | void | ) |
|
virtual |
|
virtual |
void setActualDeltaTime | ( | float | var | ) |
void setAlphaBlending | ( | bool | bOn | ) |
enables/disables OpenGL alpha blending
|
pure virtual |
Set the FPS value.
Implemented in CCDisplayLinkDirector.
void setContentScaleFactor | ( | float | scaleFactor | ) |
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.
void setDefaultValues | ( | void | ) |
sets the default values based on the CCConfiguration info
void setDelegate | ( | CCDirectorDelegate * | pDelegate | ) |
void setDeltaTime | ( | float | ) |
void setDepthTest | ( | bool | bOn | ) |
enables/disables OpenGL depth test
|
inline |
Display the FPS on the bottom-left corner.
void setDontCallWillSwitch | ( | bool | var | ) |
void setForceSmoothFix | ( | bool | var | ) |
void setGLDefaultValues | ( | void | ) |
sets the OpenGL default values
|
virtual |
|
virtual |
|
virtual |
void setNextDeltaTimeZero | ( | bool | bNextDeltaTimeZero | ) |
|
protected |
void setNotificationNode | ( | CCNode * | node | ) |
void setOpenGLView | ( | CCEGLView * | pobOpenGLView | ) |
void setProjection | ( | ccDirectorProjection | kProjection | ) |
|
virtual |
|
virtual |
void setSmoothFix | ( | bool | var | ) |
void setSmoothFixCheck | ( | bool | var | ) |
|
virtual |
void setupScreenScale | ( | CCSize | , |
CCSize | , | ||
TextureQuality | |||
) |
void setViewport | ( | ) |
Sets the glViewport.
|
static |
returns a shared instance of the director getInstance
|
protected |
|
pure virtual |
The main loop is triggered again.
Call this function only if [stopAnimation] was called earlier
Implemented in CCDisplayLinkDirector.
|
pure virtual |
Stops the animation.
Nothing will be drawn. The main loop won't be triggered anymore. If you don't want to pause your animation call [pause] instead.
Implemented in CCDisplayLinkDirector.
void updateContentScale | ( | TextureQuality | ) |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Whether or not the Director is paused.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
TextureQuality m_eTextureQuality |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
CCAccelerometer associated with this director.
|
protected |
CCActionManager associated with this director.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
CCKeypadDispatcher associated with this director.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
CCScheduler associated with this director.
|
protected |
|
protected |
|
protected |
CCTouchDispatcher associated with this director.
|
protected |
|
protected |