cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
/Users/rquesada/progs/cocos2d-iphone/cocos2d/Platforms/iOS/CCDirectorIOS.h
00001 /*
00002  * cocos2d for iPhone: http://www.cocos2d-iphone.org
00003  *
00004  * Copyright (c) 2008-2010 Ricardo Quesada
00005  * Copyright (c) 2011 Zynga Inc.
00006  * 
00007  * Permission is hereby granted, free of charge, to any person obtaining a copy
00008  * of this software and associated documentation files (the "Software"), to deal
00009  * in the Software without restriction, including without limitation the rights
00010  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011  * copies of the Software, and to permit persons to whom the Software is
00012  * furnished to do so, subject to the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice shall be included in
00015  * all copies or substantial portions of the Software.
00016  * 
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00020  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00021  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00022  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00023  * THE SOFTWARE.
00024  */
00025 
00026 
00027 // Only compile this code on iOS. These files should NOT be included on your Mac project.
00028 // But in case they are included, it won't be compiled.
00029 #import <Availability.h>
00030 #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
00031 
00032 #import "../../CCDirector.h"
00033 
00037 typedef enum {
00039         kCCDeviceOrientationPortrait = UIDeviceOrientationPortrait,     
00041     kCCDeviceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
00043     kCCDeviceOrientationLandscapeLeft = UIDeviceOrientationLandscapeLeft,
00045     kCCDeviceOrientationLandscapeRight = UIDeviceOrientationLandscapeRight,
00046         
00047         // Backward compatibility stuff
00048         CCDeviceOrientationPortrait = kCCDeviceOrientationPortrait,
00049         CCDeviceOrientationPortraitUpsideDown = kCCDeviceOrientationPortraitUpsideDown,
00050         CCDeviceOrientationLandscapeLeft = kCCDeviceOrientationLandscapeLeft,
00051         CCDeviceOrientationLandscapeRight = kCCDeviceOrientationLandscapeRight,
00052 } ccDeviceOrientation;
00053 
00058 typedef enum {
00066         kCCDirectorTypeNSTimer,
00067         
00075         kCCDirectorTypeMainLoop,
00076         
00084         kCCDirectorTypeThreadMainLoop,
00085         
00095         kCCDirectorTypeDisplayLink,
00096         
00098         kCCDirectorTypeDefault = kCCDirectorTypeNSTimer,
00099         
00100         // backward compatibility stuff
00101         CCDirectorTypeNSTimer = kCCDirectorTypeNSTimer,
00102         CCDirectorTypeMainLoop = kCCDirectorTypeMainLoop,
00103         CCDirectorTypeThreadMainLoop = kCCDirectorTypeThreadMainLoop,
00104         CCDirectorTypeDisplayLink = kCCDirectorTypeDisplayLink,
00105         CCDirectorTypeDefault = kCCDirectorTypeDefault,
00106         
00107         
00108 } ccDirectorType;
00109 
00112 @interface CCDirector (iOSExtension)
00113 
00114 // rotates the screen if an orientation differnent than Portrait is used
00115 -(void) applyOrientation;
00116 
00120 -(void) setDeviceOrientation:(ccDeviceOrientation)orientation;
00121 
00123 -(ccDeviceOrientation) deviceOrientation;
00124 
00133 -(void) setContentScaleFactor:(CGFloat)scaleFactor;
00134 
00142 -(BOOL) enableRetinaDisplay:(BOOL)yes;
00143 
00144 
00146 -(CGFloat) contentScaleFactor;
00147 @end
00148 
00149 @interface CCDirector (iOSExtensionClassMethods)
00150 
00166 +(BOOL) setDirectorType:(ccDirectorType) directorType;
00167 @end
00168 
00169 #pragma mark -
00170 #pragma mark CCDirectorIOS
00171 
00175 @interface CCDirectorIOS : CCDirector
00176 {
00177         /* orientation */
00178         ccDeviceOrientation     deviceOrientation_;
00179         
00180         /* contentScaleFactor could be simulated */
00181         BOOL    isContentScaleSupported_;
00182         
00183 }
00184 @end
00185 
00193 @interface CCDirectorFast : CCDirectorIOS
00194 {
00195         BOOL isRunning;
00196         
00197         NSAutoreleasePool       *autoreleasePool;
00198 }
00199 -(void) mainLoop;
00200 @end
00201 
00211 @interface CCDirectorFastThreaded : CCDirectorIOS
00212 {
00213         BOOL isRunning; 
00214 }
00215 -(void) mainLoop;
00216 @end
00217 
00229 @interface CCDirectorDisplayLink : CCDirectorIOS
00230 {
00231         id displayLink;
00232 }
00233 -(void) mainLoop:(id)sender;
00234 @end
00235 
00245 @interface CCDirectorTimer : CCDirectorIOS
00246 {
00247         NSTimer *animationTimer;
00248 }
00249 -(void) mainLoop;
00250 @end
00251 
00252 // optimization. Should only be used to read it. Never to write it.
00253 extern CGFloat  __ccContentScaleFactor;
00254 
00255 #endif // __IPHONE_OS_VERSION_MAX_ALLOWED
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

cocos2d for iPhone API Reference - Generated using Doxygen 1.7.4