Director Class Reference

#import <Director.h>

Inherits EAGLTouchDelegate-p.

Inherited by FastDirector.

Collaboration diagram for Director:

Collaboration graph
[legend]

List of all members.

Public Member Functions

(void) - setPixelFormat:
(void) - setDepthBufferFormat:
(BOOL) - detach
(BOOL) - attachInWindow:
(BOOL) - attachInView:
(BOOL) - attachInView:withFrame:
(CGSize) - winSize
(CGSize) - displaySize
(BOOL) - landscape
(void) - setLandscape:
(CGPoint) - convertCoordinate:
(void) - runWithScene:
(void) - pushScene:
(void) - popScene
(void) - replaceScene:
(void) - end
(void) - pause
(void) - resume
(void) - stopAnimation
(void) - startAnimation
(void) - addEventHandler:
(void) - removeEventHandler:
(void) - setAlphaBlending:
(void) - setDepthTest:
(void) - setTexture2D:
(void) - setDefaultProjection
(void) - set2Dprojection
(void) - set3Dprojection

Static Public Member Functions

(Director *) + sharedDirector
(void) + useFastDirector

Properties

ScenerunningScene
NSTimeInterval animationInterval
BOOL displayFPS
BOOL eventsEnabled
EAGLViewopenGLView
tPixelFormat pixelFormat
BOOL nextDeltaTimeZero


Detailed Description

Class that creates and handle the main Window and manages how and when to execute the Scenes

Member Function Documentation

- (void) addEventHandler: (id< TouchEventsDelegate >)  delegate  

adds a delegate to the list of multi-touch handlers

- (BOOL) attachInView: (UIView *)  view  

attach in UIView using the full frame

- (BOOL) attachInView: (UIView *)  view
withFrame: (CGRect)  frame 

attach in UIView using the given frame

- (BOOL) attachInWindow: (UIWindow *)  window  

attach in UIWindow using the full frame

- (CGPoint) convertCoordinate: (CGPoint)  p  

converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touchs coordinates to the current layout (portrait or landscape)

- (BOOL) detach  

detach the cocos2d view from the view/window

- (CGSize) displaySize  

returns the display size of the OpenGL view

- (void) end  

Ends the execution, releases the running scene

- (BOOL) landscape  

returns whether or not the screen is in landscape mode

- (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) 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) removeEventHandler: (id< TouchEventsDelegate >)  delegate  

removes a delegate from the list of multi-touch handlers

- (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) 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  

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.

- (void) set2Dprojection  

sets a 2D projection

- (void) set3Dprojection  

sets a 3D projection

- (void) setAlphaBlending: (BOOL)  on  

enables/disables OpenGL alpha blending

- (void) setDefaultProjection  

sets Cocos OpenGL default projection

- (void) setDepthBufferFormat: (tDepthBufferFormat)  db  

change depth buffer format. Call this class method before attaching it to a UIWindow/UIView Default depth buffer: 0 (none). Supported: kDepthBufferNone, kDepthBuffer16, and kDepthBuffer24

- (void) setDepthTest: (BOOL)  on  

enables/disables OpenGL depth test

- (void) setLandscape: (BOOL)  on  

sets lanscape mode

- (void) setPixelFormat: (tPixelFormat)  p  

change default pixel format. Call this class method before attaching it to a UIWindow/UIView Default pixel format: kRGB565. Supported pixel formats: kRGBA8 and kRGB565

- (void) setTexture2D: (BOOL)  on  

enables/disables OpenGL texture 2D

+ (Director *) 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

Warning:
Dont' call this function to start the main loop. To run the main loop call runWithScene

- (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.

+ (void) useFastDirector  

Uses a Director that triggers the main loop as fast as it can. Although it is faster, it will consume more battery To use it, it must be called before calling any director function

- (CGSize) winSize  

returns the size of the OpenGL view according to the landspace


Property Documentation

- (NSTimeInterval) animationInterval [read, write, assign]

The FPS value

- (BOOL) displayFPS [read, write, assign]

Whether or not to display the FPS on the bottom-left corner

- (BOOL) eventsEnabled [read, write, assign]

Whether or not to propagate the touch events to the running Scene. Default YES

- (BOOL) nextDeltaTimeZero [read, write, assign]

whether or not the next delta time will be zero

- (EAGLView*) openGLView [read, assign]

The OpenGL view

- (tPixelFormat) pixelFormat [read, assign]

Pixel format used to create the context

- (Scene*) runningScene [read, assign]

The current running Scene. Director can only run one Scene at the time


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

Generated on Tue Jun 9 10:39:33 2009 for cocos2d for iPhone 0.7.3 by  doxygen 1.5.8