#import <CCRibbon.h>
Inherits CCNode, and CCTextureProtocol-p.

Public Member Functions | |
| (id) | - initWithWidth:image:length:color:fade: |
| (void) | - addPointAt:width: |
| (void) | - update: |
| (float) | - sideOfLine:l1:l2: |
Static Public Member Functions | |
| (id) | + ribbonWithWidth:image:length:color:fade: |
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.
Definition at line 47 of file CCRibbon.h.
| - (void) addPointAt: | (CGPoint) | location | ||
| width: | (float) | w | ||
add a point to the ribbon
| - (id) initWithWidth: | (float) | w | ||
| image: | (NSString *) | path | ||
| length: | (float) | l | ||
| color: | (ccColor4B) | color | ||
| fade: | (float) | fade | ||
init the ribbon
| + (id) ribbonWithWidth: | (float) | w | ||
| image: | (NSString *) | path | ||
| length: | (float) | l | ||
| color: | (ccColor4B) | color | ||
| fade: | (float) | fade | ||
creates the ribbon
| - (float) sideOfLine: | (CGPoint) | p | ||
| l1: | (CGPoint) | l1 | ||
| l2: | (CGPoint) | l2 | ||
determine side of line
| - (void) update: | (ccTime) | delta |
polling function
- (ccBlendFunc) blendFunc [read, write, assign] |
GL blendind function
Definition at line 85 of file CCRibbon.h.
- (ccColor4B) color [read, write, assign] |
color used by the Ribbon (RGBA)
Definition at line 88 of file CCRibbon.h.
- (CCTexture2D*) texture [read, write, retain] |
Texture used by the ribbon. Conforms to CCTextureProtocol protocol
Definition at line 79 of file CCRibbon.h.
- (float) textureLength [read, write, assign] |
Texture lenghts in pixels
Definition at line 82 of file CCRibbon.h.