|
cocos2d for iPhone
2.0.0
2D game engine for iOS and OS X
|
#import <CCDirector.h>

Public Member Functions | |
| (CGSize) | - winSize |
| (CGSize) | - winSizeInPixels |
| (void) | - reshapeProjection: |
| (CGPoint) | - convertToGL: |
| (CGPoint) | - convertToUI: |
| (float) | - getZEye |
| XXX: missing description. | |
| (void) | - runWithScene: |
| (void) | - pushScene: |
| (void) | - popScene |
| (void) | - replaceScene: |
| (void) | - end |
| (void) | - pause |
| (void) | - resume |
| (void) | - stopAnimation |
| (void) | - startAnimation |
| (void) | - drawScene |
| (void) | - purgeCachedData |
| (void) | - setGLDefaultValues |
| (void) | - setAlphaBlending: |
| (void) | - setDepthTest: |
| (void) | - createStatsLabel |
Static Public Member Functions | |
| (CCDirector *) | + sharedDirector |
Properties | |
| NSThread * | runningThread |
| CCScene * | runningScene |
| NSTimeInterval | animationInterval |
| BOOL | displayStats |
| BOOL | nextDeltaTimeZero |
| BOOL | isPaused |
| ccDirectorProjection | projection |
| NSUInteger | totalFrames |
| ccTime | secondsPerFrame |
| BOOL | sendCleanupToScene |
| id | notificationNode |
| id< CCDirectorDelegate > | delegate |
| CCScheduler * | scheduler |
| CCActionManager * | actionManager |
Class that creates and handle the main Window and manages how and when to execute the Scenes.
The CCDirector is also resposible for:
Since the CCDirector is a singleton, the standard way to use it is by calling:
The CCDirector also sets the default OpenGL context:
Definition at line 84 of file CCDirector.h.
| - (CGPoint) convertToGL: | (CGPoint) | p |
converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touchs coordinates to the current layout (portrait or landscape)
| - (CGPoint) convertToUI: | (CGPoint) | p |
converts an OpenGL coordinate to a UIKit coordinate Useful to convert node points to window points for calls such as glScissor
| - (void) createStatsLabel |
creates the Stats labels
| - (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.
| - (float) getZEye |
XXX: missing description.
| - (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 consuption
| - (void) popScene |
Pops out a scene from the queue. 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) purgeCachedData |
Removes all the cocos2d data that was cached automatically. It will purge the CCTextureCache, CCLabelBMFont cache. IMPORTANT: The CCSpriteFrameCache won't be purged. If you want to purge it, you have to purge it manually.
| - (void) pushScene: | (CCScene *) | 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: | (CCScene *) | scene |
Replaces the running scene with a new one. The running scene is terminated. ONLY call it if there is a running scene.
| - (void) reshapeProjection: | (CGSize) | newWindowSize |
changes the projection size
| - (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: | (CCScene *) | 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) setAlphaBlending: | (BOOL) | on |
enables/disables OpenGL alpha blending
| - (void) setDepthTest: | (BOOL) | on |
enables/disables OpenGL depth test
| - (void) setGLDefaultValues |
sets the OpenGL default values
| + (CCDirector*) sharedDirector |
returns a shared instance of the director
| - (void) startAnimation |
The main loop is triggered again. Call this function only if [stopAnimation] was called earlier
| - (void) stopAnimation |
Stops the animation. Nothing will be drawn. The main loop won't be triggered anymore. If you wan't to pause your animation call [pause] instead.
| - (CGSize) winSize |
returns the size of the OpenGL view in points
| - (CGSize) winSizeInPixels |
returns the size of the OpenGL view in pixels. On Mac winSize and winSizeInPixels return the same value.
- (CCActionManager*) actionManager [read, write, retain] |
CCActionManager associated with this director
Definition at line 204 of file CCDirector.h.
- (NSTimeInterval) animationInterval [read, write, assign] |
The FPS value
Definition at line 163 of file CCDirector.h.
- (id<CCDirectorDelegate>) delegate [read, write, retain] |
CCDirector delegate. It shall implemente the CCDirectorDelegate protocol
Definition at line 194 of file CCDirector.h.
- (BOOL) displayStats [read, write, assign] |
Whether or not to display director statistics
Definition at line 165 of file CCDirector.h.
- (BOOL) isPaused [read, assign] |
Whether or not the Director is paused
Definition at line 169 of file CCDirector.h.
- (BOOL) nextDeltaTimeZero [read, write, assign] |
whether or not the next delta time will be zero
Definition at line 167 of file CCDirector.h.
- (id) notificationNode [read, write, retain] |
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 CCNotifications (http://github.com/manucorporat/CCNotifications)
Definition at line 189 of file CCDirector.h.
- (ccDirectorProjection) projection [read, write, assign] |
Sets an OpenGL projection
Definition at line 171 of file CCDirector.h.
- (CCScene*) runningScene [read, assign] |
The current running Scene. Director can only run one Scene at the time
Definition at line 161 of file CCDirector.h.
- (NSThread*) runningThread [read, assign] |
returns the cocos2d thread. If you want to run any cocos2d task, run it in this thread. On iOS usually it is the main thread.
Definition at line 159 of file CCDirector.h.
- (CCScheduler*) scheduler [read, write, retain] |
- (ccTime) secondsPerFrame [read, assign] |
seconds per frame
Definition at line 175 of file CCDirector.h.
- (BOOL) sendCleanupToScene [read, assign] |
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.
Definition at line 182 of file CCDirector.h.
- (NSUInteger) totalFrames [read, assign] |
How many frames were called since the director started
Definition at line 173 of file CCDirector.h.