|
cocos2d-iphone
1.0.1
Improved Cocos2D API Reference (iOS version) for Kobold2D developers
|
#include <CCRibbon.h>
Inheritance diagram for CCRibbon:
Collaboration diagram for CCRibbon:Public Member Functions | |
| id | initWithWidth:image:length:color:fade: (float w,[image] NSString *path,[length] float l,[color] ccColor4B color,[fade] float fade) |
| void | addPointAt:width: (CGPoint location,[width] float w) |
| void | update: (ccTime delta) |
| float | sideOfLine:l1:l2: (CGPoint p,[l1] CGPoint l1,[l2] CGPoint l2) |
Static Public Member Functions | |
| id | ribbonWithWidth:image:length:color:fade: (float w,[image] NSString *path,[length] float l,[color] ccColor4B color,[fade] float fade) |
Protected Attributes | |
| NSMutableArray * | segments_ |
| NSMutableArray * | deletedSegments_ |
| CGPoint | lastPoint1_ |
| CGPoint | lastPoint2_ |
| CGPoint | lastLocation_ |
| int | vertCount_ |
| float | texVPos_ |
| float | curTime_ |
| float | fadeTime_ |
| float | delta_ |
| float | lastWidth_ |
| float | lastSign_ |
| BOOL | pastFirstPoint_ |
| CCTexture2D * | texture_ |
| float | textureLength_ |
| ccColor4B | color_ |
| ccBlendFunc | blendFunc_ |
Properties | |
| CCTexture2D * | texture |
| float | textureLength |
| ccBlendFunc | blendFunc |
| ccColor4B | color |
A CCRibbon is a dynamically generated list of polygons drawn as a single or series of triangle strips. The primary use of CCRibbon is as the drawing class of Motion Streak, but it is quite useful on it's own. When manually drawing a ribbon, you can call addPointAt and pass in the parameters for the next location in the ribbon. The system will automatically generate new polygons, texture them accourding to your texture width, etc, etc.
CCRibbon data is stored in a CCRibbonSegment class. This class statically allocates enough verticies and texture coordinates for 50 locations (100 verts or 48 triangles). The ribbon class will allocate new segments when they are needed, and reuse old ones if available. The idea is to avoid constantly allocating new memory and prefer a more static method. However, since there is no way to determine the maximum size of some ribbons (motion streaks), a truely static allocation is not possible.
| void CCRibbon::addPointAt:width: | ( | CGPoint | location, |
| [width] float | w | ||
| ) | [virtual] |
add a point to the ribbon
| id CCRibbon::initWithWidth:image:length:color:fade: | ( | float | w, |
| [image] NSString * | path, | ||
| [length] float | l, | ||
| [color] ccColor4B | color, | ||
| [fade] float | fade | ||
| ) | [virtual] |
init the ribbon
| id CCRibbon::ribbonWithWidth:image:length:color:fade: | ( | float | w, |
| [image] NSString * | path, | ||
| [length] float | l, | ||
| [color] ccColor4B | color, | ||
| [fade] float | fade | ||
| ) | [static, virtual] |
creates the ribbon
| float CCRibbon::sideOfLine:l1:l2: | ( | CGPoint | p, |
| [l1] CGPoint | l1, | ||
| [l2] CGPoint | l2 | ||
| ) | [virtual] |
determine side of line
| void CCRibbon::update: | ( | ccTime | delta | ) | [virtual] |
polling function
ccBlendFunc CCRibbon::blendFunc [read, write, assign] |
GL blendind function
ccColor4B CCRibbon::color [read, write, assign] |
color used by the Ribbon (RGBA)
CCTexture2D* CCRibbon::texture [read, write, retain] |
Texture used by the ribbon. Conforms to CCTextureProtocol protocol
float CCRibbon::textureLength [read, write, assign] |
Texture lengths in pixels