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

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

texture

Texture used by the ribbon. Conforms to CCTextureProtocol protocol

@property (nonatomic, readwrite, retain) CCTexture2D *texture

Declared In

CCRibbon.h

textureLength

Texture lenghts in pixels

@property (nonatomic, readwrite) float textureLength

Declared In

CCRibbon.h

Class Methods

ribbonWithWidth:image:length:color:fade:

creates the ribbon

+ (id)ribbonWithWidth:(float)w image:(NSString *)path length:(float)l color:(ccColor4B)color fade:(float)fade

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

sideOfLine:l1:l2:

determine side of line

- (float)sideOfLine:(CGPoint)p l1:(CGPoint)l1 l2:(CGPoint)l2

Declared In

CCRibbon.h

update:

polling function

- (void)update:(ccTime)delta

Declared In

CCRibbon.h