Skip to main content

CCDirector

CCDirector

Cocos2D

Class that creates and handle the main Window and manages how and when to execute the Scenes. The CCDirector is also responsible for: - initializing the OpenGL context - 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 Portrait) 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: - GL_TEXTURE_2D is enabled - GL_VERTEX_ARRAY is enabled - GL_COLOR_ARRAY is enabled - GL_TEXTURE_COORD_ARRAY is enabled.

Inheritance: System.Object

Constructors

CCDirector()

CCDirector()()

Fields

m_bPurgeDirectorInNextLoop(System.Boolean)
m_dAnimationInterval(System.Double)
m_dOldAnimationInterval(System.Double)

Properties

Accelerometer(Cocos2D.CCAccelerometer)
ActionManager(Cocos2D.CCActionManager)
AnimationInterval(System.Double)
CanPopScene(System.Boolean)

Returns true if there is more than 1 scene on the stack.

ContentScaleFactor(System.Single)
Delegate(Cocos2D.ICCDirectorDelegate)
DisplayStats(System.Boolean)
GamePadEnabled(System.Boolean)

Set to true if this platform has a game pad connected.

GraphIndex(System.Int32)
IsPaused(System.Boolean)
KeyboardDispatcher(Cocos2D.CCKeyboardDispatcher)
KeypadDispatcher(Cocos2D.CCKeypadDispatcher)
NeedsInit(System.Boolean)
NotificationNode(Cocos2D.CCNode)
Projection(Cocos2D.CCDirectorProjection)
RunningScene(Cocos2D.CCScene)
SceneCount(System.Int32)
Scheduler(Cocos2D.CCScheduler)
SharedDirector(Cocos2D.CCDirector)

returns a shared instance of the director

TouchDispatcher(Cocos2D.CCTouchDispatcher)
VisibleOrigin(Cocos2D.CCPoint)
VisibleSize(Cocos2D.CCSize)
WinSize(Cocos2D.CCSize)
WinSizeInPixels(Cocos2D.CCSize)
ZEye(System.Single)

Methods

ConvertToGl(CCPoint)

Cocos2D.CCPoint ConvertToGl(CCPoint)(Cocos2D.CCPoint uiPoint)
Parameters:
uiPoint (Cocos2D.CCPoint)
Returns:
Cocos2D.CCPoint

ConvertToUi(CCPoint)

Cocos2D.CCPoint ConvertToUi(CCPoint)(Cocos2D.CCPoint glPoint)
Parameters:
glPoint (Cocos2D.CCPoint)
Returns:
Cocos2D.CCPoint

CreateStatsLabel()

CreateStatsLabel()()

DeserializeState()

System.Boolean DeserializeState()()
Returns:
System.Boolean

DrawScene(GameTime)

DrawScene(GameTime)(Microsoft.Xna.Framework.GameTime gameTime)

Draw the scene. This method is called every frame. Don't call it manually.

Parameters:
gameTime (Microsoft.Xna.Framework.GameTime)
Example

EnableTouchDispatcher()

EnableTouchDispatcher()()

End()

End()()

Init()

System.Boolean Init()()
Returns:
System.Boolean

IsSendCleanupToScene()

System.Boolean IsSendCleanupToScene()()
Returns:
System.Boolean

MainLoop(GameTime)

MainLoop(GameTime)(Microsoft.Xna.Framework.GameTime gameTime)
Parameters:
gameTime (Microsoft.Xna.Framework.GameTime)

Pause()

Pause()()

PopScene()

PopScene()()

PopScene(float, CCTransitionScene)

PopScene(float, CCTransitionScene)(System.Single t, Cocos2D.CCTransitionScene s)
Parameters:
t (System.Single)
s (Cocos2D.CCTransitionScene)

PopToRootScene()

PopToRootScene()()
Example

PopToSceneStackLevel(int)

PopToSceneStackLevel(int)(System.Int32 level)
Parameters:
level (System.Int32)

PurgeCachedData()

PurgeCachedData()()

PurgeDirector()

PurgeDirector()()

PushScene(CCScene)

PushScene(CCScene)(Cocos2D.CCScene pScene)

Push the given scene to the top of the scene stack.

Parameters:
pScene (Cocos2D.CCScene)
Example

ReplaceScene(CCScene)

ReplaceScene(CCScene)(Cocos2D.CCScene pScene)

Replaces the current scene at the top of the stack with the given scene.

Parameters:
pScene (Cocos2D.CCScene)
Example

ResetSceneStack()

ResetSceneStack()()

ResetStats()

ResetStats()()

Resume()

Resume()()

ResumeFromBackground()

ResumeFromBackground()()

RunWithScene(CCScene)

RunWithScene(CCScene)(Cocos2D.CCScene pScene)
Parameters:
pScene (Cocos2D.CCScene)

SerializeState()

SerializeState()()

Write out the current state of the director and all of its scenes.

Example

SetAlphaBlending(bool)

SetAlphaBlending(bool)(System.Boolean bOn)

enables/disables OpenGL alpha blending

Parameters:
bOn (System.Boolean)
Example

SetDefaultValues()

SetDefaultValues()()

SetDepthTest(bool)

SetDepthTest(bool)(System.Boolean bOn)

enables/disables OpenGL depth test

Parameters:
bOn (System.Boolean)
Example

SetNextDeltaTimeZero(bool)

SetNextDeltaTimeZero(bool)(System.Boolean bNextDeltaTimeZero)
Parameters:
bNextDeltaTimeZero (System.Boolean)

SetNextScene()

SetNextScene()()

SetOpenGlView()

SetOpenGlView()()

SetViewport()

SetViewport()()

Calls SetViewPortInPoints found in CCDrawManager. This will setup the project viewport.

Example

StartAnimation()

StartAnimation()()

StopAnimation()

StopAnimation()()

Update(GameTime)

Update(GameTime)(Microsoft.Xna.Framework.GameTime gameTime)
Parameters:
gameTime (Microsoft.Xna.Framework.GameTime)