• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

/depot/cocosdocs/cocos2d-iphone-0.99.5/cocos2d/Platforms/iOS/CCDirectorIOS.h

00001 /*
00002  * cocos2d for iPhone: http://www.cocos2d-iphone.org
00003  *
00004  * Copyright (c) 2008-2010 Ricardo Quesada
00005  * 
00006  * Permission is hereby granted, free of charge, to any person obtaining a copy
00007  * of this software and associated documentation files (the "Software"), to deal
00008  * in the Software without restriction, including without limitation the rights
00009  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00010  * copies of the Software, and to permit persons to whom the Software is
00011  * furnished to do so, subject to the following conditions:
00012  * 
00013  * The above copyright notice and this permission notice shall be included in
00014  * all copies or substantial portions of the Software.
00015  * 
00016  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00019  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00020  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00021  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00022  * THE SOFTWARE.
00023  */
00024 
00025 
00026 // Only compile this code on iOS. These files should NOT be included on your Mac project.
00027 // But in case they are included, it won't be compiled.
00028 #import <Availability.h>
00029 #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
00030 
00031 #import "../../CCDirector.h"
00032 
00036 typedef enum {
00038          kCCDeviceOrientationPortrait = UIDeviceOrientationPortrait,    
00040     kCCDeviceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
00042     kCCDeviceOrientationLandscapeLeft = UIDeviceOrientationLandscapeLeft,
00044     kCCDeviceOrientationLandscapeRight = UIDeviceOrientationLandscapeRight,
00045          
00046          // Backward compatibility stuff
00047          CCDeviceOrientationPortrait = kCCDeviceOrientationPortrait,
00048          CCDeviceOrientationPortraitUpsideDown = kCCDeviceOrientationPortraitUpsideDown,
00049          CCDeviceOrientationLandscapeLeft = kCCDeviceOrientationLandscapeLeft,
00050          CCDeviceOrientationLandscapeRight = kCCDeviceOrientationLandscapeRight,
00051 } ccDeviceOrientation;
00052 
00058 typedef enum {
00060          kCCPixelFormatRGB565,
00062          kCCPixelFormatRGBA8888,
00064          kCCPixelFormatDefault = kCCPixelFormatRGB565,
00065          
00066          // backward compatibility stuff
00067          kPixelFormatRGB565 = kCCPixelFormatRGB565,
00068          kRGB565 = kCCPixelFormatRGB565,
00069          kPixelFormatRGBA8888 = kCCPixelFormatRGBA8888,
00070          kRGBA8 = kCCPixelFormatRGBA8888,
00071 } tPixelFormat;
00072 
00079 typedef enum {
00081          kCCDepthBufferNone,
00083          kCCDepthBuffer16,
00085          kCCDepthBuffer24,
00086          
00087          // backward compatibility stuff
00088          kDepthBuffer16 = kCCDepthBuffer16,
00089          kDepthBuffer24 = kCCDepthBuffer24,
00090 } tDepthBufferFormat;
00091 
00096 typedef enum {
00104          kCCDirectorTypeNSTimer,
00105          
00113          kCCDirectorTypeMainLoop,
00114          
00122          kCCDirectorTypeThreadMainLoop,
00123          
00133          kCCDirectorTypeDisplayLink,
00134          
00136          kCCDirectorTypeDefault = kCCDirectorTypeNSTimer,
00137          
00138          // backward compatibility stuff
00139          CCDirectorTypeNSTimer = kCCDirectorTypeNSTimer,
00140          CCDirectorTypeMainLoop = kCCDirectorTypeMainLoop,
00141          CCDirectorTypeThreadMainLoop = kCCDirectorTypeThreadMainLoop,
00142          CCDirectorTypeDisplayLink = kCCDirectorTypeDisplayLink,
00143          CCDirectorTypeDefault = kCCDirectorTypeDefault,
00144          
00145          
00146 } ccDirectorType;
00147 
00150 @interface CCDirector (iOSExtension)
00151 
00152 // rotates the screen if an orientation differnent than Portrait is used
00153 -(void) applyOrientation;
00154 
00158 -(void) setDeviceOrientation:(ccDeviceOrientation)orientation;
00159 
00161 -(ccDeviceOrientation) deviceOrientation;
00162 
00171 -(void) setContentScaleFactor:(CGFloat)scaleFactor;
00172 
00180 -(BOOL) enableRetinaDisplay:(BOOL)yes;
00181 
00182 
00184 -(CGFloat) contentScaleFactor;
00185 @end
00186 
00187 @interface CCDirector (iOSExtensionClassMethods)
00188 
00204 +(BOOL) setDirectorType:(ccDirectorType) directorType;
00205 @end
00206 
00207 #pragma mark -
00208 #pragma mark CCDirectorIOS
00209 
00213 @interface CCDirectorIOS : CCDirector
00214 {
00215          /* orientation */
00216          ccDeviceOrientation        deviceOrientation_;
00217          
00218          /* contentScaleFactor could be simulated */
00219          BOOL     isContentScaleSupported_;
00220          
00221          tPixelFormat pixelFormat_;                                     // Deprecated. Will be removed in 1.0
00222          tDepthBufferFormat depthBufferFormat_;                // Deprecated. Will be removed in 1.0
00223 }
00224 
00225 // iPhone Specific
00226 
00228 @property (nonatomic,readonly) tPixelFormat pixelFormat DEPRECATED_ATTRIBUTE;
00229 
00236 -(void) setPixelFormat: (tPixelFormat)p DEPRECATED_ATTRIBUTE;
00237 
00244 -(void) setDepthBufferFormat: (tDepthBufferFormat)db DEPRECATED_ATTRIBUTE;
00245 
00246 // Integration with UIKit
00248 -(BOOL)detach DEPRECATED_ATTRIBUTE;
00249 
00255 -(BOOL)attachInWindow:(UIWindow *)window DEPRECATED_ATTRIBUTE;
00256 
00262 -(BOOL)attachInView:(UIView *)view DEPRECATED_ATTRIBUTE;
00263 
00269 -(BOOL)attachInView:(UIView *)view withFrame:(CGRect)frame DEPRECATED_ATTRIBUTE;
00270 
00271 @end
00272 
00280 @interface CCDirectorFast : CCDirectorIOS
00281 {
00282          BOOL isRunning;
00283          
00284          NSAutoreleasePool *autoreleasePool;
00285 }
00286 -(void) mainLoop;
00287 @end
00288 
00298 @interface CCDirectorFastThreaded : CCDirectorIOS
00299 {
00300          BOOL isRunning;   
00301 }
00302 -(void) mainLoop;
00303 @end
00304 
00316 @interface CCDirectorDisplayLink : CCDirectorIOS
00317 {
00318          id displayLink;
00319 }
00320 -(void) mainLoop:(id)sender;
00321 @end
00322 
00332 @interface CCDirectorTimer : CCDirectorIOS
00333 {
00334          NSTimer *animationTimer;
00335 }
00336 -(void) mainLoop;
00337 @end
00338 
00339 // optimization. Should only be used to read it. Never to write it.
00340 extern CGFloat    __ccContentScaleFactor;
00341 
00342 #endif // __IPHONE_OS_VERSION_MAX_ALLOWED

Generated on Mon Jan 31 2011 15:39:14 for Unofficial Cocos2D for iOS 0.99.5 API Reference by  doxygen 1.7.1