cocos2d-x
3.3
|
#include <CCDirector.h>
Public Types | |
enum | Projection { _2D, _3D, CUSTOM, DEFAULT = _3D } |
Public Member Functions | |
Director (void) | |
ctor More... | |
virtual | ~Director () |
NA NA More... | |
virtual bool | init () |
Scene * | getRunningScene () |
Get current running Scene. More... | |
double | 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... | |
float | getSecondsPerFrame () |
seconds per frame More... | |
GLView * | getOpenGLView () |
Get the GLView, where everything is rendered NA NA. More... | |
void | setOpenGLView (GLView *openGLView) |
TextureCache * | getTextureCache () 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... | |
Node * | getNotificationNode () const |
This object will be visited after the main scene is visited. More... | |
void | setNotificationNode (Node *node) |
const Size & | getWinSize () 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... | |
virtual void | stopAnimation ()=0 |
Stops the animation. More... | |
virtual void | startAnimation ()=0 |
The main loop is triggered 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... | |
virtual void | mainLoop ()=0 |
void | setContentScaleFactor (float scaleFactor) |
The size in pixels of the surface. More... | |
float | getContentScaleFactor () const |
Scheduler * | getScheduler () const |
Gets the Scheduler associated with this director. More... | |
void | setScheduler (Scheduler *scheduler) |
Sets the Scheduler associated with this director. More... | |
ActionManager * | getActionManager () const |
Gets the ActionManager associated with this director. More... | |
void | setActionManager (ActionManager *actionManager) |
Sets the ActionManager associated with this director. More... | |
EventDispatcher * | getEventDispatcher () const |
Gets the EventDispatcher associated with this director. More... | |
void | setEventDispatcher (EventDispatcher *dispatcher) |
Sets the EventDispatcher associated with this director. More... | |
Renderer * | getRenderer () const |
Returns the Renderer. More... | |
Console * | getConsole () 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 Mat4 & | getMatrix (MATRIX_STACK_TYPE type) |
void | resetMatrixStack () |
![]() | |
void | retain () |
Retains the ownership. More... | |
void | release () |
Releases the ownership immediately. More... | |
Ref * | autorelease () |
Releases the ownership sometime soon automatically. More... | |
unsigned int | getReferenceCount () const |
Returns the Ref's current reference count. More... | |
virtual | ~Ref () |
NA NA More... | |
Static Public Member Functions | |
static Director * | getInstance () |
returns a shared instance of the director More... | |
static Director * | sharedDirector () |
Static Public Attributes | |
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 | |
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 () |
![]() | |
Ref () | |
Constructor. More... | |
Friends | |
class | GLView |
|
strong |
Director | ( | void | ) |
ctor
|
virtual |
NA NA
|
protected |
calculates delta time since last time it was called
|
protected |
converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touch coordinates to the current layout (portrait or landscape)
converts an OpenGL coordinate to a UIKit coordinate Useful to convert node points to window points for calls such as glScissor
|
protected |
|
protected |
void 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. endToLua
|
inline |
Gets the ActionManager associated with this director.
|
inline |
Get the FPS value.
|
inline |
float getDeltaTime | ( | ) | const |
|
inline |
Gets the EventDispatcher associated with this director.
|
protected |
|
inline |
get Frame Rate
|
static |
returns a shared instance of the director
const Mat4& getMatrix | ( | MATRIX_STACK_TYPE | type | ) |
|
inline |
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)
|
inline |
Sets an OpenGL projection.
|
inline |
|
inline |
Gets the Scheduler associated with this director.
|
inline |
seconds per frame
TextureCache* getTextureCache | ( | ) | const |
|
inline |
How many frames were called since the director started.
Vec2 getVisibleOrigin | ( | ) | const |
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 GLView::setDesignResolutionSize()
const Size& getWinSize | ( | ) | const |
returns the size of the OpenGL view in points.
Size getWinSizeInPixels | ( | ) | const |
returns the size of the OpenGL view in pixels.
float getZEye | ( | ) | const |
FIXME: missing description.
|
virtual |
|
protected |
|
protected |
|
inline |
Whether or not to display the FPS on the bottom-left corner.
|
inline |
|
inline |
Whether or not the Director is paused.
|
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.
void loadIdentityMatrix | ( | MATRIX_STACK_TYPE | type | ) |
void loadMatrix | ( | MATRIX_STACK_TYPE | type, |
const Mat4 & | mat | ||
) |
|
pure virtual |
Implemented in DisplayLinkDirector.
void multiplyMatrix | ( | MATRIX_STACK_TYPE | type, |
const Mat4 & | mat | ||
) |
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
void popMatrix | ( | MATRIX_STACK_TYPE | type | ) |
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.
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)
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.
void purgeCachedData | ( | ) |
Removes all cocos2d cached data.
It will purge the TextureCache, SpriteFrameCache, LabelBMFont cache
|
protected |
void pushMatrix | ( | MATRIX_STACK_TYPE | type | ) |
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.
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.
void resetMatrixStack | ( | ) |
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)
void runWithScene | ( | Scene * | scene | ) |
void setActionManager | ( | ActionManager * | actionManager | ) |
Sets the ActionManager associated with this director.
void setAlphaBlending | ( | bool | on | ) |
enables/disables OpenGL alpha blending
|
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.
void setDefaultValues | ( | ) |
sets the default values based on the Configuration info
void setDepthTest | ( | bool | on | ) |
enables/disables OpenGL depth test
|
inline |
Display the FPS on the bottom-left corner.
void setEventDispatcher | ( | EventDispatcher * | dispatcher | ) |
Sets the EventDispatcher associated with this director.
void setGLDefaultValues | ( | ) |
sets the OpenGL default values
void setNextDeltaTimeZero | ( | bool | nextDeltaTimeZero | ) |
|
protected |
void setNotificationNode | ( | Node * | node | ) |
void setOpenGLView | ( | GLView * | openGLView | ) |
void setProjection | ( | Projection | projection | ) |
void setScheduler | ( | Scheduler * | scheduler | ) |
Sets the Scheduler associated with this director.
void setViewport | ( | ) |
Sets the glViewport.
|
inlinestatic |
|
protected |
|
pure virtual |
The main loop is triggered again.
Call this function only if [stopAnimation] was called earlier
Implemented in DisplayLinkDirector.
|
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.
|
friend |
|
protected |
|
protected |
ActionManager associated with this director.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
EventDispatcher associated with this director.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Whether or not the Director is paused.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
|
static |
|
static |
|
static |