Public Member Functions | Static Public Member Functions | Properties

CCRibbon Class Reference

#import <CCRibbon.h>

Inherits CCNode, and CCTextureProtocol-p.

Collaboration diagram for CCRibbon:
Collaboration graph
[legend]

List of all members.

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

CCTexture2Dtexture
float textureLength
ccBlendFunc blendFunc
ccColor4B color

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

Definition at line 47 of file CCRibbon.h.


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

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.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

cocos2d for iPhone 0.99.4 API Reference - Generated using Doxygen 1.7.1