2013年1月22日火曜日

ccTypesの設定をメモ。

ccTypes.hというところに、
ccc3やccc4などの設定が書いてあり、勉強になったので、メモ。
http://www.cocos2d-iphone.org/api-ref/0.99.2/cc_types_8h_source.html

こうやって、便利な拡張をしていくんですね。為になる。

00020 #import <objc/objc.h>                           // BOOL
00021 #import <CoreGraphics/CGGeometry.h>     // CGPoint
00022 #import <OpenGLES/ES1/gl.h>                     // GLenum, GLubyte
00023 
00027 typedef struct _ccColor3B
00028 {
00029         GLubyte r;
00030         GLubyte g;
00031         GLubyte b;
00032 } ccColor3B;
00033 
00035 static inline ccColor3B
00036 ccc3(const GLubyte r, const GLubyte g, const GLubyte b)
00037 {
00038         ccColor3B c = {r, g, b};
00039         return c;
00040 }
00041 //ccColor3B predefined colors
00043 static const ccColor3B ccWHITE={255,255,255};
00045 static const ccColor3B ccYELLOW={255,255,0};
00047 static const ccColor3B ccBLUE={0,0,255};
00049 static const ccColor3B ccGREEN={0,255,0};
00051 static const ccColor3B ccRED={255,0,0};
00053 static const ccColor3B ccMAGENTA={255,0,255};
00055 static const ccColor3B ccBLACK={0,0,0};
00057 static const ccColor3B ccORANGE={255,127,0};
00059 static const ccColor3B ccGRAY={166,166,166};
00060 
00064 typedef struct _ccColor4B
00065 {
00066         unsigned char r;
00067         unsigned char g;
00068         unsigned char b;
00069         unsigned char a;
00070 } ccColor4B;
00072 static inline ccColor4B
00073 ccc4(const GLubyte r, const GLubyte g, const GLubyte b, const GLubyte o)
00074 {
00075         ccColor4B c = {r, g, b, o};
00076         return c;
00077 }

0 件のコメント:

コメントを投稿