cocos2d-x  3.0alpha1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Director Class Referenceabstract

Class that creates and handles the main Window and manages how and when to execute the Scenes. More...

#include <CCDirector.h>

Inheritance diagram for Director:
Object DisplayLinkDirector

Public Types

enum  Projection { _2D, _3D, CUSTOM, DEFAULT = _3D }
 

Public Member Functions

 Director (void)
 ctor ()
 Director ()
virtual ~Director (void)
virtual bool init (void)
var init ()
local init ()
ScenegetRunningScene ()
 Get current running Scene. More...
 
var getRunningScene ()
 Get current running Scene. More...
 
local getRunningScene ()
 Get current running Scene. More...
 
double getAnimationInterval ()
 Get the FPS value. More...
 
local getAnimationInterval ()
 Get the FPS value. More...
 
virtual void setAnimationInterval (double interval)=0
 Set the FPS value. More...
 
bool isDisplayStats ()
 Whether or not to display the FPS on the bottom-left corner. More...
 
void setDisplayStats (bool displayStats)
 Display the FPS on the bottom-left corner. More...
 
var setDisplayStats ( var displayStats)
 Display the FPS on the bottom-left corner. More...
 
local setDisplayStats ( local displayStats)
 Display the FPS on the bottom-left corner. More...
 
float getSecondsPerFrame ()
 seconds per frame More...
 
EGLViewgetOpenGLView ()
 Get the EGLView, where everything is rendered. More...
 
void setOpenGLView (EGLView *openGLView)
var setOpenGLView ( var openGLView)
local setOpenGLView ( local openGLView)
TextureCachegetTextureCache () const
var getTextureCache ()
local getTextureCache ()
bool isNextDeltaTimeZero ()
var isNextDeltaTimeZero ()
local isNextDeltaTimeZero ()
void setNextDeltaTimeZero (bool nextDeltaTimeZero)
var setNextDeltaTimeZero ( var nextDeltaTimeZero)
local setNextDeltaTimeZero ( local nextDeltaTimeZero)
bool isPaused ()
 Whether or not the Director is paused. More...
 
var isPaused ()
 Whether or not the Director is paused. More...
 
local isPaused ()
 Whether or not the Director is paused. More...
 
unsigned int getTotalFrames ()
 How many frames were called since the director started. More...
 
local getTotalFrames ()
 How many frames were called since the director started. More...
 
Projection getProjection ()
 Sets an OpenGL projection. More...
 
void setProjection (Projection projection)
void setViewport ()
 Sets the glViewport. More...
 
var setViewport ()
 Sets the glViewport. More...
 
local setViewport ()
 Sets the glViewport. More...
 
bool isSendCleanupToScene ()
 How many frames were called since the director started. More...
 
local isSendCleanupToScene ()
 How many frames were called since the director started. More...
 
NodegetNotificationNode ()
 This object will be visited after the main scene is visited. More...
 
var getNotificationNode ()
 This object will be visited after the main scene is visited. More...
 
local getNotificationNode ()
 This object will be visited after the main scene is visited. More...
 
void setNotificationNode (Node *node)
DirectorDelegategetDelegate () const
 Director delegate. More...
 
void setDelegate (DirectorDelegate *delegate)
const SizegetWinSize () const
 returns the size of the OpenGL view in points. More...
 
Size getWinSizeInPixels () const
 returns the size of the OpenGL view in pixels. More...
 
var getWinSizeInPixels ()
 returns the size of the OpenGL view in pixels. More...
 
local getWinSizeInPixels ()
 returns the size of the OpenGL view in pixels. More...
 
Size getVisibleSize () const
 returns visible size of the OpenGL view in points. More...
 
Point getVisibleOrigin () const
 returns visible origin of the OpenGL view in points. More...
 
var getVisibleOrigin ()
 returns visible origin of the OpenGL view in points. More...
 
local getVisibleOrigin ()
 returns visible origin of the OpenGL view in points. More...
 
Point convertToGL (const Point &point)
 converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touch coordinates to the current layout (portrait or landscape) More...
 
var convertToGL ( var point)
 converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touch coordinates to the current layout (portrait or landscape) More...
 
local convertToGL ( local point)
 converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touch coordinates to the current layout (portrait or landscape) More...
 
Point convertToUI (const Point &point)
 converts an OpenGL coordinate to a UIKit coordinate Useful to convert node points to window points for calls such as glScissor More...
 
var convertToUI ( var point)
 converts an OpenGL coordinate to a UIKit coordinate Useful to convert node points to window points for calls such as glScissor More...
 
local convertToUI ( local point)
 converts an OpenGL coordinate to a UIKit coordinate Useful to convert node points to window points for calls such as glScissor More...
 
float getZEye () const
 XXX: missing description. More...
 
void runWithScene (Scene *scene)
 Enters the Director's main loop with the given Scene. More...
 
void pushScene (Scene *scene)
 Suspends the execution of the running scene, pushing it on the stack of suspended scenes. More...
 
void popScene ()
 Pops out a scene from the stack. More...
 
void popToRootScene ()
 Pops out all scenes from the stack until the root scene in the queue. More...
 
void popToSceneStackLevel (int level)
 Pops out all scenes from the stack until it reaches level. More...
 
var popToSceneStackLevel ( var level)
 Pops out all scenes from the stack until it reaches level. More...
 
local popToSceneStackLevel ( local level)
 Pops out all scenes from the stack until it reaches level. More...
 
void replaceScene (Scene *scene)
 Replaces the running scene with a new one. More...
 
void end ()
 Ends the execution, releases the running scene. More...
 
var end ()
 Ends the execution, releases the running scene. More...
 
local endToLua ()
 Ends the execution, releases the running scene. More...
 
void pause ()
 Pauses the running scene. More...
 
var pause ()
 Pauses the running scene. More...
 
local pause ()
 Pauses the running scene. More...
 
void resume ()
 Resumes the paused scene The scheduled timers will be activated again. More...
 
var resume ()
 Resumes the paused scene The scheduled timers will be activated again. More...
 
local resume ()
 Resumes the paused scene The scheduled timers will be activated again. More...
 
virtual void stopAnimation ()=0
 Stops the animation. More...
 
var stopAnimation ()
 Stops the animation. More...
 
local stopAnimation ()
 Stops the animation. More...
 
virtual void startAnimation ()=0
 The main loop is triggered again. More...
 
var startAnimation ()
 The main loop is triggered again. More...
 
local startAnimation ()
 The main loop is triggered again. More...
 
void drawScene ()
 Draw the scene. More...
 
local drawScene ()
 Draw the scene. More...
 
void purgeCachedData ()
 Removes all cocos2d cached data. More...
 
var purgeCachedData ()
 Removes all cocos2d cached data. More...
 
local purgeCachedData ()
 Removes all cocos2d cached data. More...
 
void setDefaultValues ()
 sets the default values based on the Configuration info More...
 
var setDefaultValues ()
 sets the default values based on the Configuration info More...
 
local setDefaultValues ()
 sets the default values based on the Configuration info More...
 
void setGLDefaultValues ()
 sets the OpenGL default values More...
 
var setGLDefaultValues ()
 sets the OpenGL default values More...
 
local setGLDefaultValues ()
 sets the OpenGL default values More...
 
void setAlphaBlending (bool on)
 enables/disables OpenGL alpha blending More...
 
var setAlphaBlending ( var on)
 enables/disables OpenGL alpha blending More...
 
local setAlphaBlending ( local on)
 enables/disables OpenGL alpha blending More...
 
void setDepthTest (bool on)
 enables/disables OpenGL depth test More...
 
var setDepthTest ( var on)
 enables/disables OpenGL depth test More...
 
local setDepthTest ( local on)
 enables/disables OpenGL depth test More...
 
virtual void mainLoop ()=0
void setContentScaleFactor (float scaleFactor)
 The size in pixels of the surface. More...
 
var setContentScaleFactor ( var scaleFactor)
 The size in pixels of the surface. More...
 
local setContentScaleFactor ( local scaleFactor)
 The size in pixels of the surface. More...
 
float getContentScaleFactor () const
var getContentScaleFactor ()
local getContentScaleFactor ()
SchedulergetScheduler () const
 Gets the Scheduler associated with this director. More...
 
var getScheduler ()
 Gets the Scheduler associated with this director. More...
 
local getScheduler ()
 Gets the Scheduler associated with this director. More...
 
void setScheduler (Scheduler *scheduler)
 Sets the Scheduler associated with this director. More...
 
var setScheduler ( var scheduler)
 Sets the Scheduler associated with this director. More...
 
local setScheduler ( local scheduler)
 Sets the Scheduler associated with this director. More...
 
ActionManagergetActionManager () const
 Gets the ActionManager associated with this director. More...
 
local getActionManager ()
 Gets the ActionManager associated with this director. More...
 
void setActionManager (ActionManager *actionManager)
 Sets the ActionManager associated with this director. More...
 
var setActionManager ( var actionManager)
 Sets the ActionManager associated with this director. More...
 
local setActionManager ( local actionManager)
 Sets the ActionManager associated with this director. More...
 
EventDispatchergetEventDispatcher () const
 Gets the EventDispatcher associated with this director. More...
 
local getEventDispatcher ()
 Gets the EventDispatcher associated with this director. More...
 
void setEventDispatcher (EventDispatcher *dispatcher)
 Sets the EventDispatcher associated with this director. More...
 
var setEventDispatcher ( var dispatcher)
 Sets the EventDispatcher associated with this director. More...
 
local setEventDispatcher ( local dispatcher)
 Sets the EventDispatcher associated with this director. More...
 
float getDeltaTime () const
float getFrameRate () const
 get Frame Rate More...
 
var getFrameRate ()
 get Frame Rate More...
 
local getFrameRate ()
 get Frame Rate More...
 
- Public Member Functions inherited from Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
void release ()
 Release the ownership immediately. More...
 
void retain ()
 Retains the ownership. More...
 
Objectautorelease ()
 Release the ownership sometime soon automatically. More...
 
bool isSingleReference () const
 Returns a boolean value that indicates whether there is only one reference to the object. More...
 
unsigned int retainCount () const
 Returns the object's current reference count. More...
 
virtual bool isEqual (const Object *object)
 Returns a boolean value that indicates whether this object and a given object are equal. More...
 
virtual void acceptVisitor (DataVisitor &visitor)
virtual void update (float dt)

Static Public Member Functions

static DirectorgetInstance ()
 returns a shared instance of the director More...
 
static CC_DEPRECATED_ATTRIBUTE
Director
sharedDirector ()

Protected Member Functions

void purgeDirector ()
var purgeDirector ()
local purgeDirector ()
void setNextScene ()
var setNextScene ()
local setNextScene ()
void showStats ()
var showStats ()
local showStats ()
void createStatsLabel ()
var createStatsLabel ()
local createStatsLabel ()
void calculateMPF ()
var calculateMPF ()
local calculateMPF ()
void getFPSImageData (unsigned char **datapointer, long *length)
void calculateDeltaTime ()
 calculates delta time since last time it was called More...
 
var calculateDeltaTime ()
 calculates delta time since last time it was called More...
 
local calculateDeltaTime ()
 calculates delta time since last time it was called More...
 
void initTextureCache ()
void destroyTextureCache ()
var destroyTextureCache ()
local destroyTextureCache ()

Protected Attributes

bool _purgeDirecotorInNextLoop
Scheduler_scheduler
 Scheduler associated with this director. More...
 
var _scheduler
 Scheduler associated with this director. More...
 
local _scheduler
 Scheduler associated with this director. More...
 
ActionManager_actionManager
 ActionManager associated with this director. More...
 
var _actionManager
 ActionManager associated with this director. More...
 
local _actionManager
 ActionManager associated with this director. More...
 
EventDispatcher_eventDispatcher
 EventDispatcher associated with this director. More...
 
var _eventDispatcher
 EventDispatcher associated with this director. More...
 
local _eventDispatcher
 EventDispatcher associated with this director. More...
 
float _deltaTime
local _deltaTime
EGLView_openGLView
var _openGLView
local _openGLView
TextureCache_textureCache
var _textureCache
local _textureCache
double _animationInterval
var _animationInterval
local _animationInterval
double _oldAnimationInterval
var _oldAnimationInterval
local _oldAnimationInterval
bool _landscape
var _landscape
local _landscape
bool _displayStats
var _displayStats
local _displayStats
float _accumDt
var _accumDt
local _accumDt
float _frameRate
var _frameRate
local _frameRate
LabelAtlas_FPSLabel
var _FPSLabel
local _FPSLabel
LabelAtlas_SPFLabel
var _SPFLabel
local _SPFLabel
LabelAtlas_drawsLabel
var _drawsLabel
local _drawsLabel
bool _paused
 Whether or not the Director is paused. More...
 
var _paused
 Whether or not the Director is paused. More...
 
local _paused
 Whether or not the Director is paused. More...
 
unsigned int _totalFrames
var _totalFrames
local _totalFrames
unsigned int _frames
float _secondsPerFrame
var _secondsPerFrame
local _secondsPerFrame
Scene_runningScene
var _runningScene
local _runningScene
Scene_nextScene
var _nextScene
local _nextScene
bool _sendCleanupToScene
var _sendCleanupToScene
local _sendCleanupToScene
Array_scenesStack
var _scenesStack
local _scenesStack
struct timeval * _lastUpdate
var _lastUpdate
local _lastUpdate
bool _nextDeltaTimeZero
var _nextDeltaTimeZero
local _nextDeltaTimeZero
Projection _projection
var _projection
local _projection
Size _winSizeInPoints
var _winSizeInPoints
local _winSizeInPoints
float _contentScaleFactor
var _contentScaleFactor
local _contentScaleFactor
char * _FPS
var _FPS
local _FPS
Node_notificationNode
var _notificationNode
local _notificationNode
DirectorDelegate_projectionDelegate
var _projectionDelegate
local _projectionDelegate
- Protected Attributes inherited from Object
unsigned int _reference
 count of references More...
 
unsigned int _autoReleaseCount
 count of autorelease More...
 

Friends

class EGLViewProtocol

Additional Inherited Members

- Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. More...
 

Detailed Description

Class that creates and handles 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 one is 0-bit)
  • setting the projection (default one is 3D)
  • setting the orientation (default one is Portrait)

Since the Director is a singleton, the standard way to use it is by calling: _ Director::getInstance()->methodName();

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

Member Enumeration Documentation

enum Projection
strong
Enumerator
_2D 

sets a 2D projection (orthogonal projection)

_3D 

sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.

CUSTOM 

it calls "updateProjection" on the projection delegate.

DEFAULT 

Default projection is 3D projection.

var Projection
strong
Enumerator
_2D 

sets a 2D projection (orthogonal projection)

_3D 

sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.

CUSTOM 

it calls "updateProjection" on the projection delegate.

DEFAULT 

Default projection is 3D projection.

local Projection
strong
Enumerator
_2D 

sets a 2D projection (orthogonal projection)

_3D 

sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.

CUSTOM 

it calls "updateProjection" on the projection delegate.

DEFAULT 

Default projection is 3D projection.

Constructor & Destructor Documentation

Director ( void  )
var ctor (   )
local Director (   )
virtual ~Director ( void  )
virtual

Member Function Documentation

void calculateDeltaTime ( )
protected

calculates delta time since last time it was called

var calculateDeltaTime ( )
protected

calculates delta time since last time it was called

local calculateDeltaTime ( )
protected

calculates delta time since last time it was called

void calculateMPF ( )
protected
var calculateMPF ( )
protected
local calculateMPF ( )
protected
Point convertToGL ( const Point point)

converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touch coordinates to the current layout (portrait or landscape)

var convertToGL ( var  point)

converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touch coordinates to the current layout (portrait or landscape)

local convertToGL ( local  point)

converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touch coordinates to the current layout (portrait or landscape)

Point convertToUI ( const Point point)

converts an OpenGL coordinate to a UIKit coordinate Useful to convert node points to window points for calls such as glScissor

var convertToUI ( var  point)

converts an OpenGL coordinate to a UIKit coordinate Useful to convert node points to window points for calls such as glScissor

local convertToUI ( local  point)

converts an OpenGL coordinate to a UIKit coordinate Useful to convert node points to window points for calls such as glScissor

void createStatsLabel ( )
protected
var createStatsLabel ( )
protected
local createStatsLabel ( )
protected
void destroyTextureCache ( )
protected
var destroyTextureCache ( )
protected
local destroyTextureCache ( )
protected
void drawScene ( )

Draw the scene.

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

var drawScene ( )

Draw the scene.

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

local drawScene ( )

Draw the scene.

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

void end ( )

Ends the execution, releases the running scene.

It doesn't remove the OpenGL view from its parent. You have to do it manually.

var end ( )

Ends the execution, releases the running scene.

It doesn't remove the OpenGL view from its parent. You have to do it manually.

local endToLua ( )

Ends the execution, releases the running scene.

It doesn't remove the OpenGL view from its parent. You have to do it manually.

ActionManager* getActionManager ( ) const

Gets the ActionManager associated with this director.

Since
v2.0
var getActionManager ( )

Gets the ActionManager associated with this director.

Since
v2.0
local getActionManager ( )

Gets the ActionManager associated with this director.

Since
v2.0
double getAnimationInterval ( )
inline

Get the FPS value.

var getAnimationInterval ( )
inline

Get the FPS value.

local getAnimationInterval ( )
inline

Get the FPS value.

float getContentScaleFactor ( ) const
var getContentScaleFactor ( )
local getContentScaleFactor ( )
DirectorDelegate* getDelegate ( ) const

Director delegate.

It shall implement the DirectorDelegate protocol

Since
v0.99.5
float getDeltaTime ( ) const
var getDeltaTime ( )
local getDeltaTime ( )
EventDispatcher* getEventDispatcher ( ) const

Gets the EventDispatcher associated with this director.

Since
v3.0
var getEventDispatcher ( )

Gets the EventDispatcher associated with this director.

Since
v3.0
local getEventDispatcher ( )

Gets the EventDispatcher associated with this director.

Since
v3.0
void getFPSImageData ( unsigned char **  datapointer,
long *  length 
)
protected
var getFPSImageData ( var  datapointer,
var  length 
)
protected
local getFPSImageData ( local  datapointer,
local  length 
)
protected
float getFrameRate ( ) const
inline

get Frame Rate

var getFrameRate ( )
inline

get Frame Rate

local getFrameRate ( )
inline

get Frame Rate

static Director* getInstance ( )
static

returns a shared instance of the director

Node* 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 Notifications (http://github.com/manucorporat/CCNotifications)

Since
v0.99.5
var 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 Notifications (http://github.com/manucorporat/CCNotifications)

Since
v0.99.5
local 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 Notifications (http://github.com/manucorporat/CCNotifications)

Since
v0.99.5
EGLView* getOpenGLView ( )
inline

Get the EGLView, where everything is rendered.

Projection getProjection ( )
inline

Sets an OpenGL projection.

Since
v0.8.2
Scene* getRunningScene ( )
inline

Get current running Scene.

Director can only run one Scene at a time

var getRunningScene ( )
inline

Get current running Scene.

Director can only run one Scene at a time

local getRunningScene ( )
inline

Get current running Scene.

Director can only run one Scene at a time

Scheduler* getScheduler ( ) const

Gets the Scheduler associated with this director.

Since
v2.0
var getScheduler ( )

Gets the Scheduler associated with this director.

Since
v2.0
local getScheduler ( )

Gets the Scheduler associated with this director.

Since
v2.0
float getSecondsPerFrame ( )
inline

seconds per frame

var getSecondsPerFrame ( )
inline

seconds per frame

local getSecondsPerFrame ( )
inline

seconds per frame

TextureCache* getTextureCache ( ) const
var getTextureCache ( )
local getTextureCache ( )
unsigned int getTotalFrames ( )
inline

How many frames were called since the director started.

var getTotalFrames ( )
inline

How many frames were called since the director started.

local getTotalFrames ( )
inline

How many frames were called since the director started.

Point getVisibleOrigin ( ) const

returns visible origin of the OpenGL view in points.

var getVisibleOrigin ( )

returns visible origin of the OpenGL view in points.

local getVisibleOrigin ( )

returns visible origin of the OpenGL view in points.

Size getVisibleSize ( ) const

returns visible size of the OpenGL view in points.

the value is equal to getWinSize if don't invoke EGLView::setDesignResolutionSize()

var getVisibleSize ( )

returns visible size of the OpenGL view in points.

the value is equal to getWinSize if don't invoke EGLView::setDesignResolutionSize()

local getVisibleSize ( )

returns visible size of the OpenGL view in points.

the value is equal to getWinSize if don't invoke EGLView::setDesignResolutionSize()

const Size& getWinSize ( ) const

returns the size of the OpenGL view in points.

var getWinSize ( )

returns the size of the OpenGL view in points.

local getWinSize ( )

returns the size of the OpenGL view in points.

Size getWinSizeInPixels ( ) const

returns the size of the OpenGL view in pixels.

var getWinSizeInPixels ( )

returns the size of the OpenGL view in pixels.

local getWinSizeInPixels ( )

returns the size of the OpenGL view in pixels.

float getZEye ( ) const

XXX: missing description.

var getZEye ( )

XXX: missing description.

local getZEye ( )

XXX: missing description.

virtual bool init ( void  )
virtual
var init (   )
virtual
local init (   )
virtual
void initTextureCache ( )
protected
var initTextureCache ( )
protected
local initTextureCache ( )
protected
bool isDisplayStats ( )
inline

Whether or not to display the FPS on the bottom-left corner.

var isDisplayStats ( )
inline

Whether or not to display the FPS on the bottom-left corner.

local isDisplayStats ( )
inline

Whether or not to display the FPS on the bottom-left corner.

bool isNextDeltaTimeZero ( )
inline
var isNextDeltaTimeZero ( )
inline
local isNextDeltaTimeZero ( )
inline
bool isPaused ( )
inline

Whether or not the Director is paused.

var isPaused ( )
inline

Whether or not the Director is paused.

local isPaused ( )
inline

Whether or not the Director is paused.

bool isSendCleanupToScene ( )
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.

Since
v0.99.0
var isSendCleanupToScene ( )
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.

Since
v0.99.0
local isSendCleanupToScene ( )
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.

Since
v0.99.0
virtual void mainLoop ( )
pure virtual

Implemented in DisplayLinkDirector.

var mainLoop ( )
pure virtual

Implemented in DisplayLinkDirector.

local mainLoop ( )
pure virtual

Implemented in DisplayLinkDirector.

void pause ( )

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

var pause ( )

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

local pause ( )

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 ( )

Pops out a scene from the stack.

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.

var popScene ( )

Pops out a scene from the stack.

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.

local popScene ( )

Pops out a scene from the stack.

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.

void popToRootScene ( )

Pops out all scenes from the stack until the root scene in the queue.

This scene will replace the running one. Internally it will call popToSceneStackLevel(1)

var popToRootScene ( )

Pops out all scenes from the stack until the root scene in the queue.

This scene will replace the running one. Internally it will call popToSceneStackLevel(1)

local popToRootScene ( )

Pops out all scenes from the stack 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 stack 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.

var popToSceneStackLevel ( var  level)

Pops out all scenes from the stack 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.

local popToSceneStackLevel ( local  level)

Pops out all scenes from the stack 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 ( )

Removes all cocos2d cached data.

It will purge the TextureCache, SpriteFrameCache, LabelBMFont cache

Since
v0.99.3
var purgeCachedData ( )

Removes all cocos2d cached data.

It will purge the TextureCache, SpriteFrameCache, LabelBMFont cache

Since
v0.99.3
local purgeCachedData ( )

Removes all cocos2d cached data.

It will purge the TextureCache, SpriteFrameCache, LabelBMFont cache

Since
v0.99.3
void purgeDirector ( )
protected
var purgeDirector ( )
protected
local purgeDirector ( )
protected
void pushScene ( Scene 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.

var pushScene ( var  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.

local pushScene ( local  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.

void replaceScene ( Scene scene)

Replaces the running scene with a new one.

The running scene is terminated. ONLY call it if there is a running scene.

var replaceScene ( var  scene)

Replaces the running scene with a new one.

The running scene is terminated. ONLY call it if there is a running scene.

local replaceScene ( local  scene)

Replaces the running scene with a new one.

The running scene is terminated. ONLY call it if there is a running scene.

void resume ( )

Resumes the paused scene The scheduled timers will be activated again.

The "delta time" will be 0 (as if the game wasn't paused)

var resume ( )

Resumes the paused scene The scheduled timers will be activated again.

The "delta time" will be 0 (as if the game wasn't paused)

local resume ( )

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 ( Scene scene)

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

var runWithScene ( var  scene)

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

local runWithScene ( local  scene)

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

void setActionManager ( ActionManager actionManager)

Sets the ActionManager associated with this director.

Since
v2.0
var setActionManager ( var  actionManager)

Sets the ActionManager associated with this director.

Since
v2.0
local setActionManager ( local  actionManager)

Sets the ActionManager associated with this director.

Since
v2.0
void setAlphaBlending ( bool  on)

enables/disables OpenGL alpha blending

var setAlphaBlending ( var  on)

enables/disables OpenGL alpha blending

local setAlphaBlending ( local  on)

enables/disables OpenGL alpha blending

virtual void setAnimationInterval ( double  interval)
pure virtual

Set the FPS value.

Implemented in DisplayLinkDirector.

var setAnimationInterval ( var  interval)
pure virtual

Set the FPS value.

Implemented in DisplayLinkDirector.

local setAnimationInterval ( local  interval)
pure virtual

Set the FPS value.

Implemented in DisplayLinkDirector.

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.

Since
v0.99.4
var setContentScaleFactor ( var  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.

Since
v0.99.4
local setContentScaleFactor ( local  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.

Since
v0.99.4
void setDefaultValues ( )

sets the default values based on the Configuration info

var setDefaultValues ( )

sets the default values based on the Configuration info

local setDefaultValues ( )

sets the default values based on the Configuration info

void setDelegate ( DirectorDelegate delegate)
void setDepthTest ( bool  on)

enables/disables OpenGL depth test

var setDepthTest ( var  on)

enables/disables OpenGL depth test

local setDepthTest ( local  on)

enables/disables OpenGL depth test

void setDisplayStats ( bool  displayStats)
inline

Display the FPS on the bottom-left corner.

var setDisplayStats ( var  displayStats)
inline

Display the FPS on the bottom-left corner.

local setDisplayStats ( local  displayStats)
inline

Display the FPS on the bottom-left corner.

void setEventDispatcher ( EventDispatcher dispatcher)

Sets the EventDispatcher associated with this director.

Since
v3.0
var setEventDispatcher ( var  dispatcher)

Sets the EventDispatcher associated with this director.

Since
v3.0
local setEventDispatcher ( local  dispatcher)

Sets the EventDispatcher associated with this director.

Since
v3.0
void setGLDefaultValues ( )

sets the OpenGL default values

var setGLDefaultValues ( )

sets the OpenGL default values

local setGLDefaultValues ( )

sets the OpenGL default values

void setNextDeltaTimeZero ( bool  nextDeltaTimeZero)
var setNextDeltaTimeZero ( var  nextDeltaTimeZero)
local setNextDeltaTimeZero ( local  nextDeltaTimeZero)
void setNextScene ( )
protected
var setNextScene ( )
protected
local setNextScene ( )
protected
void setNotificationNode ( Node node)
var setNotificationNode ( var  node)
local setNotificationNode ( local  node)
void setOpenGLView ( EGLView openGLView)
var setOpenGLView ( var  openGLView)
local setOpenGLView ( local  openGLView)
void setProjection ( Projection  projection)
var setProjection ( var  projection)
local setProjection ( local  projection)
void setScheduler ( Scheduler scheduler)

Sets the Scheduler associated with this director.

Since
v2.0
var setScheduler ( var  scheduler)

Sets the Scheduler associated with this director.

Since
v2.0
local setScheduler ( local  scheduler)

Sets the Scheduler associated with this director.

Since
v2.0
void setViewport ( )

Sets the glViewport.

var setViewport ( )

Sets the glViewport.

local setViewport ( )

Sets the glViewport.

static CC_DEPRECATED_ATTRIBUTE
Director* sharedDirector
( )
inlinestatic
var sharedDirector ( )
inlinestatic
local sharedDirector ( )
inlinestatic
void showStats ( )
protected
var showStats ( )
protected
local showStats ( )
protected
virtual void startAnimation ( )
pure virtual

The main loop is triggered again.

Call this function only if [stopAnimation] was called earlier

Warning
Don't call this function to start the main loop. To run the main loop call runWithScene

Implemented in DisplayLinkDirector.

var startAnimation ( )
pure virtual

The main loop is triggered again.

Call this function only if [stopAnimation] was called earlier

Warning
Don't call this function to start the main loop. To run the main loop call runWithScene

Implemented in DisplayLinkDirector.

local startAnimation ( )
pure virtual

The main loop is triggered again.

Call this function only if [stopAnimation] was called earlier

Warning
Don't call this function to start the main loop. To run the main loop call runWithScene

Implemented in DisplayLinkDirector.

virtual void stopAnimation ( )
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 DisplayLinkDirector.

var stopAnimation ( )
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 DisplayLinkDirector.

local stopAnimation ( )
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 DisplayLinkDirector.

Friends And Related Function Documentation

friend class EGLViewProtocol
friend
var EGLViewProtocol
friend
local EGLViewProtocol
friend

Member Data Documentation

float _accumDt
protected
var _accumDt
protected
local _accumDt
protected
ActionManager* _actionManager
protected

ActionManager associated with this director.

Since
v2.0
var _actionManager
protected

ActionManager associated with this director.

Since
v2.0
local _actionManager
protected

ActionManager associated with this director.

Since
v2.0
double _animationInterval
protected
var _animationInterval
protected
local _animationInterval
protected
float _contentScaleFactor
protected
var _contentScaleFactor
protected
local _contentScaleFactor
protected
float _deltaTime
protected
var _deltaTime
protected
local _deltaTime
protected
bool _displayStats
protected
var _displayStats
protected
local _displayStats
protected
LabelAtlas* _drawsLabel
protected
var _drawsLabel
protected
local _drawsLabel
protected
EventDispatcher* _eventDispatcher
protected

EventDispatcher associated with this director.

Since
v3.0
var _eventDispatcher
protected

EventDispatcher associated with this director.

Since
v3.0
local _eventDispatcher
protected

EventDispatcher associated with this director.

Since
v3.0
char* _FPS
protected
var _FPS
protected
local _FPS
protected
LabelAtlas* _FPSLabel
protected
var _FPSLabel
protected
local _FPSLabel
protected
float _frameRate
protected
var _frameRate
protected
local _frameRate
protected
unsigned int _frames
protected
var _frames
protected
local _frames
protected
bool _landscape
protected
var _landscape
protected
local _landscape
protected
struct timeval* _lastUpdate
protected
var _lastUpdate
protected
local _lastUpdate
protected
bool _nextDeltaTimeZero
protected
var _nextDeltaTimeZero
protected
local _nextDeltaTimeZero
protected
Scene* _nextScene
protected
var _nextScene
protected
local _nextScene
protected
Node* _notificationNode
protected
var _notificationNode
protected
local _notificationNode
protected
double _oldAnimationInterval
protected
var _oldAnimationInterval
protected
local _oldAnimationInterval
protected
EGLView* _openGLView
protected
var _openGLView
protected
local _openGLView
protected
bool _paused
protected

Whether or not the Director is paused.

var _paused
protected

Whether or not the Director is paused.

local _paused
protected

Whether or not the Director is paused.

Projection _projection
protected
var _projection
protected
local _projection
protected
DirectorDelegate*
_projectionDelegate
protected
var _projectionDelegate
protected
local _projectionDelegate
protected
bool _purgeDirecotorInNextLoop
protected
var _purgeDirecotorInNextLoop
protected
local _purgeDirecotorInNextLoop
protected
Scene* _runningScene
protected
var _runningScene
protected
local _runningScene
protected
Array* _scenesStack
protected
var _scenesStack
protected
local _scenesStack
protected
Scheduler* _scheduler
protected

Scheduler associated with this director.

Since
v2.0
var _scheduler
protected

Scheduler associated with this director.

Since
v2.0
local _scheduler
protected

Scheduler associated with this director.

Since
v2.0
float _secondsPerFrame
protected
var _secondsPerFrame
protected
local _secondsPerFrame
protected
bool _sendCleanupToScene
protected
var _sendCleanupToScene
protected
local _sendCleanupToScene
protected
LabelAtlas* _SPFLabel
protected
var _SPFLabel
protected
local _SPFLabel
protected
TextureCache* _textureCache
protected
var _textureCache
protected
local _textureCache
protected
unsigned int _totalFrames
protected
var _totalFrames
protected
local _totalFrames
protected
Size _winSizeInPoints
protected
var _winSizeInPoints
protected
local _winSizeInPoints
protected

The documentation for this class was generated from the following file: