Public Member Functions | Static Public Member Functions | Properties

CCRibbon Class Reference

#import "CCRibbon.h"

Inherits CCNode, and CCTextureProtocol-p.

Collaboration diagram for CCRibbon:
[legend]

List of all members.

Public Member Functions

(void) - addPointAt:width:
(id) - initWithWidth:image:length:color:fade:
(float) - sideOfLine:l1:l2:
(void) - update:

Static Public Member Functions

(id) + ribbonWithWidth:image:length:color:fade:

Properties

ccBlendFunc blendFunc
ccColor4B color
CCTexture2Dtexture
float textureLength

Detailed Description

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.

Since:
v0.8.1

Member Function Documentation

- (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


Property Documentation

- (ccBlendFunc) blendFunc [read, write, assign]

GL blendind function

- (ccColor4B) color [read, write, assign]

color used by the Ribbon (RGBA)

- (CCTexture2D*) texture [read, write, retain]

Texture used by the ribbon. Conforms to CCTextureProtocol protocol

- (float) textureLength [read, write, assign]

Texture lengths in pixels


The documentation for this class was generated from the following file: