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
-
texture
Texture used by the ribbon. Conforms to CCTextureProtocol protocol
property -
textureLength
Texture lenghts in pixels
property -
blendFunc
GL blendind function
property -
color
color 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 blendFunc
Declared In
CCRibbon.h
color
color used by the Ribbon (RGBA)
@property (nonatomic, readwrite) ccColor4B color
Declared In
CCRibbon.h
Instance Methods
addPointAt:width:
add a point to the ribbon
- (void)addPointAt:(CGPoint)location width:(float)w
Declared In
CCRibbon.h
initWithWidth:image:length:color:fade:
init the ribbon
- (id)initWithWidth:(float)w image:(NSString *)path length:(float)l color:(ccColor4B)color fade:(float)fade
Declared In
CCRibbon.h