Ninja Library - 2D Graphics Function

njDrawTriangle2D

Draws a triangle on a 2D screen

FORMAT

void njDrawTriangle2D( *p, n, pri, attr )
NJS_POINT2COL *p
Int n
Float pri
Uint32 attr

PARAMETER

 *p  List of vertices for drawing triangles 
 n  Number of triangles to be drawn 
 pri  Priority (use for Z value) 
 attr  Attribute (select drawing method) 

RETURN

None

DESCRIPTION

Draws n number of triangles. The following attributes can be used. To specify conditions for drawing triangles:

 -NJD_DRAW_NORMAL  Independent triangle drawn. 
 -NJD_DRAW_FAN  Radial triangle drawn. 
 -NJD_DRAW_CONNECTED  Connected triangles drawn. 

To set triangle drawing method:

 -not set  wire frame 
 -NJD_FILL  Interior of triangle filled. 
 -NJD_TRANSPARENT  Transparent drawing. 
 -NJD_USE_TEXTURE  Drawing with texture. 

These six attributes can be used in mutually consistent combinations by using the "|" character as a delimiter.


EXAMPLE

The following draws 4 connected triangles.
Sint32 i;
NJS_POINT2COL  p2c[6];
NJS_POINT2   p[6];
NJS_COLOR    col[6];
p2c.p = p;
p2c.col = col;
p2c.tex = NULL;
p2c.num = 6;
p2c.p[0].x = 100;
p2c.p[0].y = 300;
p2c.col[0].color = 0xFFFF00AA;
p2c.p[1].x = 150;
p2c.p[1].y = 100;
p2c.col[1].color = 0x0FFFF000;
p2c.p[2].x = 200;
p2c.p[2].y = 300;
p2c.col[2].color = 0x00FFFF00;
p2c.p[3].x = 250;
p2c.p[3].y = 100;
p2c.col[3].color = 0xF00FFF55;
p2c.p[4].x = 300;
p2c.p[4].y = 300;
p2c.col[4].color = 0xFF00FF00;
p2c.p[5].x = 350;
p2c.p[5].y = 100;
p2c.col[5].color = 0xFFF00F00;
njDrawTriangle2D(p2c,4,-3.f,NJD_DRAW_NORMAL|NJD_DRAW_CONNECTED|NJD_FILL);

njDrawTriangle2D
COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999