CCRibbon Class Reference
| Inherits from | CCNode : NSObject |
| Conforms to | CCTextureProtocol |
| Declared in | CCRibbon.h |
Overview
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.
Tasks
-
textureTexture used by the ribbon. Conforms to CCTextureProtocol protocol
property -
textureLengthTexture lenghts in pixels
property -
blendFuncGL blendind function
property -
colorcolor used by the Ribbon (RGBA)
property -
+ ribbonWithWidth:image:length:color:fade:creates the ribbon
-
– initWithWidth:image:length:color:fade:init the ribbon
-
– addPointAt:width:add a point to the ribbon
-
– update:polling function
-
– sideOfLine:l1:l2:determine side of line
Properties
blendFunc
GL blendind function
@property (nonatomic, readwrite, assign) ccBlendFunc blendFuncDeclared In
CCRibbon.hcolor
color used by the Ribbon (RGBA)
@property (nonatomic, readwrite) ccColor4B colorDeclared In
CCRibbon.hInstance Methods
addPointAt:width:
add a point to the ribbon
- (void)addPointAt:(CGPoint)location width:(float)wDeclared In
CCRibbon.hinitWithWidth:image:length:color:fade:
init the ribbon
- (id)initWithWidth:(float)w image:(NSString *)path length:(float)l color:(ccColor4B)color fade:(float)fadeDeclared In
CCRibbon.h