http://www.cocos2d-iphone.org/api-ref/2.0.0/_c_c_drawing_primitives_8h.html
に、ラインカラー設定関数ccDrawColor4B解説が書かれていた。
0~255までの符号無しバイトで設定せよ、と。
に、ラインカラー設定関数ccDrawColor4B解説が書かれていた。
0~255までの符号無しバイトで設定せよ、と。
| void ccDrawColor4B | ( | GLubyte | r, |
| GLubyte | g, | ||
| GLubyte | b, | ||
| GLubyte | a | ||
| ) |
set the drawing color with 4 unsigned bytes
で、円なんか描きたい場合は、
| void ccDrawCircle | ( | CGPoint | center, |
| float | radius, | ||
| float | angle, | ||
| NSUInteger | segments, | ||
| BOOL | drawLineToCenter | ||
| ) |
draws a circle given the center, radius and number of segments measured in points
という感じ。
線の描画は,以下。
| void ccDrawLine | ( | CGPoint | origin, |
| CGPoint | destination | ||
| ) |
draws a line given the origin and destination point measured in points.
なるほど。
まあ、drawPrimitivesTest.mに、実際のコードが書いてありますね。
あと、簡単にCGPointをつくってくれるマクロがあり、ccp(x,y)と書ける様子。多用されていますね。便利。
以下に解説ドキュメントがあります。
http://www.cocos2d-iphone.org/api-ref/2.0.0/_c_g_point_extension_8h.html#a6250be5f1c27162404561148ebd6ffcc
| #define ccp | ( | __X__, | |
| __Y__ | |||
| ) | CGPointMake(__X__,__Y__) |
Helper macro that creates a CGPoint
- Returns:
- CGPoint
- Since:
- v0.7.2
Definition at line 66 of file CGPointExtension.h.
0 件のコメント:
コメントを投稿