summary refs log tree commit diff stats
path: root/libs/cocos2d/CCProtocols.h
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-07-30 11:19:14 -0400
committerStarla Insigna <starla4444@gmail.com>2011-07-30 11:19:14 -0400
commit9cd57b731ab1c666d4a1cb725538fdc137763d12 (patch)
tree5bac45ae5157a1cb10c6e45500cbf72789917980 /libs/cocos2d/CCProtocols.h
downloadcartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.gz
cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.bz2
cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.zip
Initial commit (version 0.2.1)
Diffstat (limited to 'libs/cocos2d/CCProtocols.h')
-rwxr-xr-xlibs/cocos2d/CCProtocols.h125
1 files changed, 125 insertions, 0 deletions
diff --git a/libs/cocos2d/CCProtocols.h b/libs/cocos2d/CCProtocols.h new file mode 100755 index 0000000..f7043fc --- /dev/null +++ b/libs/cocos2d/CCProtocols.h
@@ -0,0 +1,125 @@
1/*
2 * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 *
4 * Copyright (c) 2008-2010 Ricardo Quesada
5 * Copyright (c) 2011 Zynga Inc.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */
25
26
27#import "ccTypes.h"
28#import "CCTexture2D.h"
29
30#pragma mark -
31#pragma mark CCRGBAProtocol
32
33/// CC RGBA protocol
34@protocol CCRGBAProtocol <NSObject>
35/** sets Color
36 @since v0.8
37 */
38-(void) setColor:(ccColor3B)color;
39/** returns the color
40 @since v0.8
41 */
42-(ccColor3B) color;
43
44/// returns the opacity
45-(GLubyte) opacity;
46/** sets the opacity.
47 @warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed.
48 Values goes from 0 to 255, where 255 means fully opaque.
49 */
50-(void) setOpacity: (GLubyte) opacity;
51@optional
52/** sets the premultipliedAlphaOpacity property.
53 If set to NO then opacity will be applied as: glColor(R,G,B,opacity);
54 If set to YES then oapcity will be applied as: glColor(opacity, opacity, opacity, opacity );
55 Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO
56 @since v0.8
57 */
58-(void) setOpacityModifyRGB:(BOOL)boolean;
59/** returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity);
60 @since v0.8
61 */
62 -(BOOL) doesOpacityModifyRGB;
63@end
64
65#pragma mark -
66#pragma mark CCBlendProtocol
67/**
68 You can specify the blending fuction.
69 @since v0.99.0
70 */
71@protocol CCBlendProtocol <NSObject>
72/** set the source blending function for the texture */
73-(void) setBlendFunc:(ccBlendFunc)blendFunc;
74/** returns the blending function used for the texture */
75-(ccBlendFunc) blendFunc;
76@end
77
78
79#pragma mark -
80#pragma mark CCTextureProtocol
81
82/** CCNode objects that uses a Texture2D to render the images.
83 The texture can have a blending function.
84 If the texture has alpha premultiplied the default blending function is:
85 src=GL_ONE dst= GL_ONE_MINUS_SRC_ALPHA
86 else
87 src=GL_SRC_ALPHA dst= GL_ONE_MINUS_SRC_ALPHA
88 But you can change the blending funtion at any time.
89 @since v0.8.0
90 */
91@protocol CCTextureProtocol <CCBlendProtocol>
92/** returns the used texture */
93-(CCTexture2D*) texture;
94/** sets a new texture. it will be retained */
95-(void) setTexture:(CCTexture2D*)texture;
96@end
97
98#pragma mark -
99#pragma mark CCLabelProtocol
100/** Common interface for Labels */
101@protocol CCLabelProtocol <NSObject>
102/** sets a new label using an NSString.
103 The string will be copied.
104 */
105-(void) setString:(NSString*)label;
106/** returns the string that is rendered */
107-(NSString*) string;
108@optional
109/** sets a new label using a CString.
110 It is faster than setString since it doesn't require to alloc/retain/release an NString object.
111 @since v0.99.0
112 */
113-(void) setCString:(char*)label;
114@end
115
116
117#pragma mark -
118#pragma mark CCProjectionProtocol
119/** OpenGL projection protocol */
120@protocol CCProjectionProtocol <NSObject>
121/** Called by CCDirector when the porjection is updated, and "custom" projection is used
122 @since v0.99.5
123 */
124-(void) updateProjection;
125@end