cocos3d  2.0.0
Instance Methods | Properties | List of all members
CC3ViewController Class Reference

#import <CC3ViewController.h>

Inheritance diagram for CC3ViewController:
Inheritance graph
[legend]

Instance Methods

(void) - pauseAnimation
 
(void) - resumeAnimation
 
(void) - startAnimation
 
(void) - stopAnimation
 
(void) - terminateOpenGL
 

Properties

CCNode * controlledNode
 
BOOL isOverlayingDeviceCamera
 
CC3GLView * view
 

Detailed Description

An instance of CC3ViewController manages the CC3GLView to support the 3D environment.

Method Documentation

- (void) pauseAnimation

Reduces cocos2d/3d animation to a minimum.

Invoke this method when you want to reliquish CPU to perform some other task, such as displaying other views or windows. To ensure a responsive UI, you should invoke this method just before displaying other view components, such as modal or popover controllers.

Use the resumeAnimation method to restore the original animation level.

- (void) resumeAnimation

Restores cocos2d/3d animation to its original operating level, after having been temporarily reduced by a prior invocation of the pauseAnimation method.

- (void) startAnimation

Starts the cocos2d/3d animation.

You should invoke this method when the application enters the foreground.

Use the stopAnimation method to stop the animation.

- (void) stopAnimation

Stops the cocos2d/3d animation.

You should invoke this method when the application will enter the background.

Use the startAnimation method to start the animation again.

- (void) terminateOpenGL

Terminates the current use of OpenGL by this application.

Releases the object in the controlledNode property, releases the view of this controller, ends the CCDirector session, terminates OpenGL and deletes all GL contexts, serving all threads, and clears all caches that contain content that uses OpenGL, including:

CC3Texture

You can invoke this method when your app no longer needs support for OpenGL, or will not use OpenGL for a significant amount of time, in order to free up app and OpenGL memory used by your application.

To ensure that that the current GL activity has finished before pulling the rug out from under it, this request is queued for each existing GL context, on the thread for which the context was created, and will only be executed once any currently running tasks on the queue have been completed.

In addition, once dequeued, a short delay is imposed, before the GL context instance is actually released and deallocated, to provide time for object deallocation and cleanup after the caches have been cleared, and autorelease pools have been drained. The length of this delay may be different for each context instance, and is specified by the CC3OpenGL deletionDelay property of each instance.

Since much of the processing of this method is handled through queued operations, as described above, this method will return as soon as the requests are queued, and well before the operations have completed, and OpenGL has been terminated.

You can choose to be notified once all operations triggered by this method have completed, and OpenGL has been terminated, by registering a delegate object using the CC3OpenGL setDelegate: class method. The delegate object will be sent the didTerminateOpenGL method once all operations triggered by this method have completed, and OpenGL has been terminated. You should use this delegate notification if you intend to make use of OpenGL again, as you must wait for one OpenGL session to terminate before starting another.

Note that, in order to ensure that OpenGL is free to shutdown, this method forces the CC3Texture shouldCacheAssociatedCCTexture2Ds class-side property to NO, so that any background loading that is currently occurring will not cache cocos2d textures. If you had set this property to YES, and intend to restart OpenGL at some point, then you might want to set it back to YES before reloading 3D resources again.

Use this method with caution, as creating the GL contexts again will require significant overhead.

Property Documentation

- (CCNode*) controlledNode
readwritenonatomicstrong

The CCNode that is being controlled by this controller.

This is typically an instance of CCLayer.

The application should keep this property synchronized with changes in the running scene of the shared CCDirector.

- (BOOL) isOverlayingDeviceCamera
readwritenonatomicassign

Indicates whether this controller is overlaying the view of the device camera.

This base implementation always returns NO, indicating that the device camera is not being displayed, and setting this property has no effect. Subclasses that support device camera overlay can override.

- (CC3GLView*) view
readwritenonatomicstrong

The view of a CC3ViewController must be of type CC3GLView.


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