cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
/Users/rquesada/progs/cocos2d-iphone/cocos2d/CCLayer.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 
00028 
00029 #import <Availability.h>
00030 #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
00031 #import <UIKit/UIKit.h>                                 // Needed for UIAccelerometerDelegate
00032 #import "Platforms/iOS/CCTouchDelegateProtocol.h"               // Touches only supported on iOS
00033 #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
00034 #import "Platforms/Mac/CCEventDispatcher.h"
00035 #endif
00036 
00037 #import "CCProtocols.h"
00038 #import "CCNode.h"
00039 
00040 #pragma mark -
00041 #pragma mark CCLayer
00042 
00049 #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
00050 @interface CCLayer : CCNode <UIAccelerometerDelegate, CCStandardTouchDelegate, CCTargetedTouchDelegate>
00051 {
00052         BOOL isTouchEnabled_;
00053         BOOL isAccelerometerEnabled_;
00054 }
00068 -(void) registerWithTouchDispatcher;
00069 
00078 @property(nonatomic,assign) BOOL isTouchEnabled;
00086 @property(nonatomic,assign) BOOL isAccelerometerEnabled;
00087 
00088 #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
00089 
00090 
00091 @interface CCLayer : CCNode <CCKeyboardEventDelegate, CCMouseEventDelegate, CCTouchEventDelegate>
00092 {
00093         BOOL    isMouseEnabled_;
00094         BOOL    isKeyboardEnabled_;
00095         BOOL    isTouchEnabled_;
00096 }
00097 
00102 @property (nonatomic, readwrite) BOOL isMouseEnabled;
00103 
00108 @property (nonatomic, readwrite) BOOL isKeyboardEnabled;
00109 
00114 @property (nonatomic, readwrite) BOOL isTouchEnabled;
00115 
00122 -(NSInteger) mouseDelegatePriority;
00123 
00130 -(NSInteger) keyboardDelegatePriority;
00131 
00138 -(NSInteger) touchDelegatePriority;
00139 
00140 #endif // mac
00141 
00142 
00143 @end
00144 
00145 #pragma mark -
00146 #pragma mark CCLayerColor
00147 
00154 @interface CCLayerColor : CCLayer <CCRGBAProtocol, CCBlendProtocol>
00155 {
00156         GLubyte         opacity_;
00157         ccColor3B       color_; 
00158         ccVertex2F      squareVertices_[4];
00159         ccColor4B       squareColors_[4];
00160         
00161         ccBlendFunc     blendFunc_;
00162 }
00163 
00165 + (id) layerWithColor: (ccColor4B)color width:(GLfloat)w height:(GLfloat)h;
00167 + (id) layerWithColor: (ccColor4B)color;
00168 
00170 - (id) initWithColor:(ccColor4B)color width:(GLfloat)w height:(GLfloat)h;
00172 - (id) initWithColor:(ccColor4B)color;
00173 
00175 -(void) changeWidth: (GLfloat)w;
00177 -(void) changeHeight: (GLfloat)h;
00181 -(void) changeWidth:(GLfloat)w height:(GLfloat)h;
00182 
00184 @property (nonatomic,readonly) GLubyte opacity;
00186 @property (nonatomic,readonly) ccColor3B color;
00188 @property (nonatomic,readwrite) ccBlendFunc blendFunc;
00189 @end
00190 
00196 DEPRECATED_ATTRIBUTE @interface CCColorLayer : CCLayerColor
00197 @end
00198 
00199 #pragma mark -
00200 #pragma mark CCLayerGradient
00201 
00222 @interface CCLayerGradient : CCLayerColor
00223 {
00224         ccColor3B endColor_;
00225         GLubyte startOpacity_;
00226         GLubyte endOpacity_;
00227         CGPoint vector_;
00228         BOOL    compressedInterpolation_;
00229 }
00230 
00232 + (id) layerWithColor: (ccColor4B) start fadingTo: (ccColor4B) end;
00234 + (id) layerWithColor: (ccColor4B) start fadingTo: (ccColor4B) end alongVector: (CGPoint) v;
00235 
00237 - (id) initWithColor: (ccColor4B) start fadingTo: (ccColor4B) end;
00239 - (id) initWithColor: (ccColor4B) start fadingTo: (ccColor4B) end alongVector: (CGPoint) v;
00240 
00242 @property (nonatomic, readwrite) ccColor3B startColor;
00244 @property (nonatomic, readwrite) ccColor3B endColor;
00246 @property (nonatomic, readwrite) GLubyte startOpacity;
00248 @property (nonatomic, readwrite) GLubyte endOpacity;
00250 @property (nonatomic, readwrite) CGPoint vector;
00254 @property (nonatomic, readwrite) BOOL compressedInterpolation;
00255  
00256 @end
00257 
00258 #pragma mark -
00259 #pragma mark CCLayerMultiplex
00260 
00266 @interface CCLayerMultiplex : CCLayer
00267 {
00268         unsigned int enabledLayer_;
00269         NSMutableArray *layers_;
00270 }
00271 
00273 +(id) layerWithLayers: (CCLayer*) layer, ... NS_REQUIRES_NIL_TERMINATION;
00275 -(id) initWithLayers: (CCLayer*) layer vaList:(va_list) params;
00279 -(void) switchTo: (unsigned int) n;
00283 -(void) switchToAndReleaseMe: (unsigned int) n;
00284 @end
00285 
00291 DEPRECATED_ATTRIBUTE  @interface CCMultiplexLayer : CCLayerMultiplex
00292 @end
00293 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

cocos2d for iPhone API Reference - Generated using Doxygen 1.7.4