cocos2d-x  3.0alpha1
 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 Object

Public Member Functions

 DisplayLinkDirector ()
virtual void mainLoop () override
virtual void setAnimationInterval (double value) override
 Set the FPS value. More...
 
virtual void startAnimation () override
 The main loop is triggered again. More...
 
virtual void stopAnimation () override
 Stops the animation. More...
 
- Public Member Functions inherited from Director
 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...
 
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...
 
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...
 
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)

Protected Attributes

bool _invalid
- Protected Attributes inherited from Director
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...
 

Additional Inherited Members

- Public Types inherited from Director
enum  Projection { _2D, _3D, CUSTOM, DEFAULT = _3D }
 
- Static Public Member Functions inherited from Director
static DirectorgetInstance ()
 returns a shared instance of the director More...
 
static CC_DEPRECATED_ATTRIBUTE
Director
sharedDirector ()
- Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. More...
 
- Protected Member Functions inherited from Director
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 ()

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

Member Function Documentation

virtual void mainLoop ( )
overridevirtual

Implements Director.

virtual void setAnimationInterval ( double  interval)
overridevirtual

Set the FPS value.

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.

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.

Member Data Documentation

bool _invalid
protected

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