cocos2d-x  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DisplayLinkDirector Class Reference

DisplayLinkDirector is a Director that synchronizes timers with the refresh rate of the display. More...

#include <CCDirector.h>

Inheritance diagram for DisplayLinkDirector:
Director Ref

Public Member Functions

 DisplayLinkDirector ()
 DisplayLinkDirector ()
 DisplayLinkDirector ()
virtual ~DisplayLinkDirector ()
var ~DisplayLinkDirector ()
local ~DisplayLinkDirector ()
virtual void mainLoop () override
var mainLoop ()
local mainLoop ()
virtual void setAnimationInterval (double value) override
 Sets the FPS value. More...
 
local setAnimationInterval ( local value)
 Sets the FPS value. More...
 
virtual void startAnimation () override
 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...
 
virtual void stopAnimation () override
 Stops the animation. More...
 
local stopAnimation ()
 Stops the animation. More...
 
- Public Member Functions inherited from Director
 Director ()
 ctor ()
 Director ()
virtual ~Director ()
virtual bool init ()
var init ()
local init ()
ScenegetRunningScene ()
 Gets current running Scene. More...
 
var getRunningScene ()
 Gets current running Scene. More...
 
local getRunningScene ()
 Gets current running Scene. More...
 
double getAnimationInterval ()
 Gets the FPS value. More...
 
var getAnimationInterval ()
 Gets the FPS value. More...
 
local getAnimationInterval ()
 Gets the FPS value. More...
 
bool isDisplayStats ()
 Whether or not to display the FPS on the bottom-left corner. More...
 
var isDisplayStats ()
 Whether or not to display the FPS on the bottom-left corner. More...
 
local 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 ()
 Get seconds per frame. More...
 
var getSecondsPerFrame ()
 Get seconds per frame. More...
 
local getSecondsPerFrame ()
 Get seconds per frame. More...
 
GLViewgetOpenGLView ()
 Get the GLView. More...
 
var getOpenGLView ()
 Get the GLView. More...
 
void setOpenGLView (GLView *openGLView)
 Sets the GLView. More...
 
var setOpenGLView ( var openGLView)
 Sets the GLView. More...
 
TextureCachegetTextureCache () const
bool isNextDeltaTimeZero ()
 Whether or not _nextDeltaTimeZero is set to 0. More...
 
var isNextDeltaTimeZero ()
 Whether or not _nextDeltaTimeZero is set to 0. More...
 
local isNextDeltaTimeZero ()
 Whether or not _nextDeltaTimeZero is set to 0. More...
 
void setNextDeltaTimeZero (bool nextDeltaTimeZero)
 Sets the detal time between current frame and next frame is 0. More...
 
bool 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 ()
 Gets an OpenGL projection. More...
 
var getProjection ()
 Gets an OpenGL projection. More...
 
void setProjection (Projection projection)
 Sets OpenGL projection. More...
 
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 () const
 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)
 Sets the notification node. More...
 
const SizegetWinSize () const
 Returns the size of the OpenGL view in points. More...
 
var getWinSize ()
 Returns the size of the OpenGL view in points. More...
 
local getWinSize ()
 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...
 
var getVisibleSize ()
 Returns visible size of the OpenGL view in points. More...
 
local getVisibleSize ()
 Returns visible size of the OpenGL view in points. More...
 
Vec2 getVisibleOrigin () const
 Returns visible origin coordinate of the OpenGL view in points. More...
 
Vec2 convertToGL (const Vec2 &point)
 Converts a screen coordinate to an OpenGL coordinate. More...
 
Vec2 convertToUI (const Vec2 &point)
 Converts an OpenGL coordinate to a screen coordinate. More...
 
float getZEye () const
 Gets the distance between camera and near clipping frane. More...
 
void runWithScene (Scene *scene)
 Enters the Director's main loop with the given Scene. More...
 
local runWithScene ( local 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...
 
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. More...
 
void restart ()
void drawScene ()
 Draw the scene. More...
 
var drawScene ()
 Draw the scene. More...
 
local drawScene ()
 Draw the scene. More...
 
void 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...
 
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 setClearColor (const Color4F &clearColor)
 Sets clear values for the color buffers, value range of each element is [0.0, 1.0]. More...
 
local setClearColor ( local clearColor)
 Sets clear values for the color buffers, value range of each element is [0.0, 1.0]. More...
 
void setDepthTest (bool on)
 Enables/disables OpenGL depth test. More...
 
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
 Gets content scale factor. More...
 
var getContentScaleFactor ()
 Gets content scale factor. More...
 
local getContentScaleFactor ()
 Gets content scale factor. More...
 
SchedulergetScheduler () const
 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...
 
var getActionManager ()
 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...
 
local setEventDispatcher ( local dispatcher)
 Sets the EventDispatcher associated with this director. More...
 
RenderergetRenderer () const
 Returns the Renderer associated with this director. More...
 
var getRenderer ()
 Returns the Renderer associated with this director. More...
 
local getRenderer ()
 Returns the Renderer associated with this director. More...
 
Console * getConsole () const
 Returns the Console associated with this director. More...
 
local getConsole ()
 Returns the Console associated with this director. More...
 
float getDeltaTime () const
var getDeltaTime ()
local getDeltaTime ()
float getFrameRate () const
 Gets Frame Rate. More...
 
local getFrameRate ()
 Gets Frame Rate. More...
 
void pushMatrix (MATRIX_STACK_TYPE type)
 Clones a specified type matrix and put it to the top of specified type of matrix stack. More...
 
local pushMatrix ( local type)
 Clones a specified type matrix and put it to the top of specified type of matrix stack. More...
 
void popMatrix (MATRIX_STACK_TYPE type)
 Pops the top matrix of the specified type of matrix stack. More...
 
void loadIdentityMatrix (MATRIX_STACK_TYPE type)
 Adds an identity matrix to the top of specified type of matrxi stack. More...
 
void loadMatrix (MATRIX_STACK_TYPE type, const Mat4 &mat)
 Adds a matrix to the top of specified type of matrix stack. More...
 
local loadMatrix ( local type, local mat)
 Adds a matrix to the top of specified type of matrix stack. More...
 
void multiplyMatrix (MATRIX_STACK_TYPE type, const Mat4 &mat)
 Multipies a matrix to the top of specified type of matrix stack. More...
 
const Mat4getMatrix (MATRIX_STACK_TYPE type)
 Gets the top matrix of specified type of matrix stack. More...
 
void resetMatrixStack ()
 Cleras all types of matrix stack, and add indentity matrix to these matrix stacks. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Protected Attributes

bool _invalid
var _invalid
local _invalid
- Protected Attributes inherited from Director
bool _purgeDirectorInNextLoop
var _purgeDirectorInNextLoop
local _purgeDirectorInNextLoop
bool _restartDirectorInNextLoop
var _restartDirectorInNextLoop
local _restartDirectorInNextLoop
std::stack< Mat4_modelViewMatrixStack
var _modelViewMatrixStack
local _modelViewMatrixStack
std::stack< Mat4_projectionMatrixStack
var _projectionMatrixStack
local _projectionMatrixStack
std::stack< Mat4_textureMatrixStack
var _textureMatrixStack
local _textureMatrixStack
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...
 
EventCustom_eventProjectionChanged
var _eventProjectionChanged
local _eventProjectionChanged
EventCustom_eventAfterDraw
var _eventAfterDraw
local _eventAfterDraw
EventCustom_eventAfterVisit
var _eventAfterVisit
local _eventAfterVisit
EventCustom_eventAfterUpdate
var _eventAfterUpdate
local _eventAfterUpdate
float _deltaTime
var _deltaTime
local _deltaTime
GLView_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_drawnBatchesLabel
var _drawnBatchesLabel
local _drawnBatchesLabel
LabelAtlas_drawnVerticesLabel
var _drawnVerticesLabel
local _drawnVerticesLabel
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
float _secondsPerFrame
var _secondsPerFrame
local _secondsPerFrame
Scene_runningScene
var _runningScene
local _runningScene
Scene_nextScene
var _nextScene
local _nextScene
bool _sendCleanupToScene
var _sendCleanupToScene
local _sendCleanupToScene
Vector< Scene * > _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
Node_notificationNode
var _notificationNode
local _notificationNode
Renderer_renderer
var _renderer
local _renderer
Console * _console
var _console
local _console
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 
local _referenceCount
 count of references More...
 

Additional Inherited Members

- Public Types inherited from Director
enum  Projection { _2D, _3D, CUSTOM, DEFAULT = _3D }
 Possible OpenGL projections used by director. More...
 
- Static Public Member Functions inherited from Director
static DirectorgetInstance ()
 Returns a shared instance of the director. More...
 
var _getInstance ()
 Returns a shared instance of the director. More...
 
local getInstance ()
 Returns a shared instance of the director. More...
 
static DirectorsharedDirector ()
local sharedDirector ()
- Static Public Attributes inherited from Director
static const char * EVENT_PROJECTION_CHANGED
 Director will trigger an event when projection type is changed. More...
 
static const char * EVENT_AFTER_UPDATE
 Director will trigger an event after Schedule::update() is invoked. More...
 
var EVENT_AFTER_UPDATE
 Director will trigger an event after Schedule::update() is invoked. More...
 
local EVENT_AFTER_UPDATE
 Director will trigger an event after Schedule::update() is invoked. More...
 
static const char * EVENT_AFTER_VISIT
 Director will trigger an event after Scene::render() is invoked. More...
 
var EVENT_AFTER_VISIT
 Director will trigger an event after Scene::render() is invoked. More...
 
local EVENT_AFTER_VISIT
 Director will trigger an event after Scene::render() is invoked. More...
 
static const char * EVENT_AFTER_DRAW
 Director will trigger an event after a scene is drawn, the data is sent to GPU. More...
 
var EVENT_AFTER_DRAW
 Director will trigger an event after a scene is drawn, the data is sent to GPU. More...
 
local EVENT_AFTER_DRAW
 Director will trigger an event after a scene is drawn, the data is sent to GPU. More...
 
- Protected Member Functions inherited from Director
void reset ()
var reset ()
local reset ()
void purgeDirector ()
var purgeDirector ()
local purgeDirector ()
void restartDirector ()
var restartDirector ()
local restartDirector ()
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, ssize_t *length)
var getFPSImageData ( var datapointer, var length)
local getFPSImageData ( local datapointer, local 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 ()
void initMatrixStack ()
var initMatrixStack ()
local initMatrixStack ()
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
 Ref ()
 Constructor. More...
 

Detailed Description

DisplayLinkDirector is a Director that 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
Since
v0.8.2

Constructor & Destructor Documentation

DisplayLinkDirector ( )
inline
var DisplayLinkDirector ( )
inline
local DisplayLinkDirector ( )
inline
virtual ~DisplayLinkDirector ( )
inlinevirtual
var ~DisplayLinkDirector ( )
inlinevirtual
local ~DisplayLinkDirector ( )
inlinevirtual

Member Function Documentation

virtual void mainLoop ( )
overridevirtual

Implements Director.

var mainLoop ( )
overridevirtual

Implements Director.

local mainLoop ( )
overridevirtual

Implements Director.

virtual void setAnimationInterval ( double  interval)
overridevirtual

Sets the FPS value.

FPS = 1/internal.

Implements Director.

var setAnimationInterval ( var  interval)
overridevirtual

Sets the FPS value.

FPS = 1/internal.

Implements Director.

local setAnimationInterval ( local  interval)
overridevirtual

Sets the FPS value.

FPS = 1/internal.

Implements Director.

virtual void startAnimation ( )
overridevirtual

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.

Implements Director.

var startAnimation ( )
overridevirtual

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.

Implements Director.

local startAnimation ( )
overridevirtual

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.

Implements Director.

virtual void stopAnimation ( )
overridevirtual

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.

Implements Director.

var stopAnimation ( )
overridevirtual

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.

Implements Director.

local stopAnimation ( )
overridevirtual

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.

Implements Director.

Member Data Documentation

bool _invalid
protected
var _invalid
protected
local _invalid
protected

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