cocos2d-x  3.3
 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 ()
virtual ~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)
virtual ~Director ()
virtual bool init ()
ScenegetRunningScene ()
 Get current running Scene. More...
 
double 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...
 
float getSecondsPerFrame ()
 seconds per frame More...
 
GLViewgetOpenGLView ()
 Get the GLView, where everything is rendered. More...
 
void setOpenGLView (GLView *openGLView)
TextureCachegetTextureCache () const
bool isNextDeltaTimeZero ()
void setNextDeltaTimeZero (bool nextDeltaTimeZero)
bool isPaused ()
 Whether or not the Director is paused. More...
 
unsigned int 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...
 
bool 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...
 
void setNotificationNode (Node *node)
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...
 
Size getVisibleSize () const
 returns visible size of the OpenGL view in points. More...
 
Vec2 getVisibleOrigin () const
 returns visible origin of the OpenGL view in points. More...
 
Vec2 convertToGL (const Vec2 &point)
 converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touch coordinates to the current layout (portrait or landscape) More...
 
Vec2 convertToUI (const Vec2 &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
 FIXME: 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...
 
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...
 
void resume ()
 Resumes the paused scene The scheduled timers will be activated again. More...
 
void 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...
 
void setGLDefaultValues ()
 sets the OpenGL default values More...
 
void setAlphaBlending (bool on)
 enables/disables OpenGL alpha blending More...
 
void setDepthTest (bool on)
 enables/disables OpenGL depth test More...
 
void setContentScaleFactor (float scaleFactor)
 The size in pixels of the surface. More...
 
float getContentScaleFactor () const
SchedulergetScheduler () const
 Gets the Scheduler associated with this director. More...
 
void setScheduler (Scheduler *scheduler)
 Sets the Scheduler associated with this director. More...
 
ActionManagergetActionManager () const
 Gets the ActionManager associated with this director. More...
 
void setActionManager (ActionManager *actionManager)
 Sets the ActionManager associated with this director. More...
 
EventDispatchergetEventDispatcher () const
 Gets the EventDispatcher associated with this director. More...
 
void setEventDispatcher (EventDispatcher *dispatcher)
 Sets the EventDispatcher associated with this director. More...
 
RenderergetRenderer () const
 Returns the Renderer. More...
 
ConsolegetConsole () const
 Returns the Console. More...
 
float getDeltaTime () const
float getFrameRate () const
 get Frame Rate More...
 
void pushMatrix (MATRIX_STACK_TYPE type)
void popMatrix (MATRIX_STACK_TYPE type)
void loadIdentityMatrix (MATRIX_STACK_TYPE type)
void loadMatrix (MATRIX_STACK_TYPE type, const Mat4 &mat)
void multiplyMatrix (MATRIX_STACK_TYPE type, const Mat4 &mat)
const Mat4getMatrix (MATRIX_STACK_TYPE type)
void resetMatrixStack ()
- 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 ()

Protected Attributes

bool _invalid
- Protected Attributes inherited from Director
bool _purgeDirectorInNextLoop
std::stack< Mat4_modelViewMatrixStack
std::stack< Mat4_projectionMatrixStack
std::stack< Mat4_textureMatrixStack
Scheduler_scheduler
 Scheduler associated with this director. More...
 
ActionManager_actionManager
 ActionManager associated with this director. More...
 
EventDispatcher_eventDispatcher
 EventDispatcher associated with this director. More...
 
EventCustom_eventProjectionChanged
EventCustom_eventAfterDraw
EventCustom_eventAfterVisit
EventCustom_eventAfterUpdate
float _deltaTime
GLView_openGLView
TextureCache_textureCache
double _animationInterval
double _oldAnimationInterval
bool _landscape
bool _displayStats
float _accumDt
float _frameRate
LabelAtlas_FPSLabel
LabelAtlas_drawnBatchesLabel
LabelAtlas_drawnVerticesLabel
bool _paused
 Whether or not the Director is paused. More...
 
unsigned int _totalFrames
float _secondsPerFrame
Scene_runningScene
Scene_nextScene
bool _sendCleanupToScene
Vector< Scene * > _scenesStack
struct timeval * _lastUpdate
bool _nextDeltaTimeZero
Projection _projection
Size _winSizeInPoints
float _contentScaleFactor
Node_notificationNode
Renderer_renderer
Console_console
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references 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 DirectorsharedDirector ()
- Static Public Attributes inherited from Director
static const char * EVENT_PROJECTION_CHANGED
static const char * EVENT_AFTER_UPDATE
static const char * EVENT_AFTER_VISIT
static const char * EVENT_AFTER_DRAW
- Protected Member Functions inherited from Director
void purgeDirector ()
void setNextScene ()
void showStats ()
void createStatsLabel ()
void calculateMPF ()
void getFPSImageData (unsigned char **datapointer, ssize_t *length)
void calculateDeltaTime ()
 calculates delta time since last time it was called More...
 
void initTextureCache ()
void destroyTextureCache ()
void initMatrixStack ()
- Protected Member Functions inherited from Ref
 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
virtual ~DisplayLinkDirector ( )
inlinevirtual

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: