Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00031 #import <objc/objc.h>
00032 #import <CoreGraphics/CGGeometry.h>
00033 #import <OpenGLES/ES1/gl.h>
00034
00038 typedef struct _ccColor3B
00039 {
00040 GLubyte r;
00041 GLubyte g;
00042 GLubyte b;
00043 } ccColor3B;
00044
00046 static inline ccColor3B
00047 ccc3(const GLubyte r, const GLubyte g, const GLubyte b)
00048 {
00049 ccColor3B c = {r, g, b};
00050 return c;
00051 }
00052
00054 static const ccColor3B ccWHITE={255,255,255};
00056 static const ccColor3B ccYELLOW={255,255,0};
00058 static const ccColor3B ccBLUE={0,0,255};
00060 static const ccColor3B ccGREEN={0,255,0};
00062 static const ccColor3B ccRED={255,0,0};
00064 static const ccColor3B ccMAGENTA={255,0,255};
00066 static const ccColor3B ccBLACK={0,0,0};
00068 static const ccColor3B ccORANGE={255,127,0};
00070 static const ccColor3B ccGRAY={166,166,166};
00071
00075 typedef struct _ccColor4B
00076 {
00077 unsigned char r;
00078 unsigned char g;
00079 unsigned char b;
00080 unsigned char a;
00081 } ccColor4B;
00083 static inline ccColor4B
00084 ccc4(const GLubyte r, const GLubyte g, const GLubyte b, const GLubyte o)
00085 {
00086 ccColor4B c = {r, g, b, o};
00087 return c;
00088 }
00089
00090
00094 typedef struct _ccColor4F {
00095 float r;
00096 float g;
00097 float b;
00098 float a;
00099 } ccColor4F;
00100
00104 static inline ccColor4F ccc4FFromccc3B(ccColor3B c)
00105 {
00106 return (ccColor4F){c.r/255.f, c.g/255.f, c.b/255.f, 1.f};
00107 }
00108
00112 static inline ccColor4F ccc4FFromccc4B(ccColor4B c)
00113 {
00114 return (ccColor4F){c.r/255.f, c.g/255.f, c.b/255.f, c.a/255.f};
00115 }
00116
00120 static inline BOOL ccc4FEqual(ccColor4F a, ccColor4F b)
00121 {
00122 return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
00123 }
00124
00128 #define ccVertex2F CGPoint
00129
00133 typedef struct _ccVertex3F
00134 {
00135 float x;
00136 float y;
00137 float z;
00138 } ccVertex3F;
00139
00143 typedef struct _ccTex2F {
00144 float u;
00145 float v;
00146 } ccTex2F;
00147
00148
00150 typedef struct _ccPointSprite
00151 {
00152 ccVertex2F pos;
00153 ccColor4F colors;
00154 float size;
00155 } ccPointSprite;
00156
00158 typedef struct _ccQuad2 {
00159 ccVertex2F tl;
00160 ccVertex2F tr;
00161 ccVertex2F bl;
00162 ccVertex2F br;
00163 } ccQuad2;
00164
00165
00167 typedef struct _ccQuad3 {
00168 ccVertex3F bl;
00169 ccVertex3F br;
00170 ccVertex3F tl;
00171 ccVertex3F tr;
00172 } ccQuad3;
00173
00175 typedef struct _ccGridSize
00176 {
00177 int x;
00178 int y;
00179 } ccGridSize;
00180
00182 static inline ccGridSize
00183 ccg(const int x, const int y)
00184 {
00185 ccGridSize v = {x, y};
00186 return v;
00187 }
00188
00190 typedef struct _ccV2F_C4F_T2F
00191 {
00193 ccVertex2F vertices;
00195 ccColor4F colors;
00197 ccTex2F texCoords;
00198 } ccV2F_C4F_T2F;
00199
00201 typedef struct _ccV3F_C4B_T2F
00202 {
00204 ccVertex3F vertices;
00205
00206
00208 ccColor4B colors;
00209
00210
00211
00212 ccTex2F texCoords;
00213 } ccV3F_C4B_T2F;
00214
00216 typedef struct _ccV3F_C4B_T2F_Quad
00217 {
00219 ccV3F_C4B_T2F tl;
00221 ccV3F_C4B_T2F bl;
00223 ccV3F_C4B_T2F tr;
00225 ccV3F_C4B_T2F br;
00226 } ccV3F_C4B_T2F_Quad;
00227
00229 typedef struct _ccV2F_C4F_T2F_Quad
00230 {
00232 ccV2F_C4F_T2F bl;
00234 ccV2F_C4F_T2F br;
00236 ccV2F_C4F_T2F tl;
00238 ccV2F_C4F_T2F tr;
00239 } ccV2F_C4F_T2F_Quad;
00240
00242 typedef struct _ccBlendFunc
00243 {
00245 GLenum src;
00247 GLenum dst;
00248 } ccBlendFunc;
00249
00252 typedef float ccTime;
00253