Ninja Library - 2D Graphics Function

njDrawPolygon2D

Draws a polygon on a 2D screen

FORMAT

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

PARAMETER

 *p  List of coordinates of vertices of polygons to be drawn 
 n  Number of vertices of polygons 
 pri  Priority (-1.0f <= pri <= -65535.0f) 
 attr  Attributes (specifies the drawing method) 

RETURN

None

DESCRIPTION

Draws a polygon of n sides.

The maximum number of vertices is 32. Value range for parameter "pri" (priority) is -1.0f <= pri <= -65535.0f. The following attributes are used. To specify the conditions for drawing n squares:

 NJD_DRAW_NORMAL  Draws n squares. 

To specify the drawing method for n squares (when not specified, wire frame is displayed):

 NJD_FILL  Interior of n squares filled. 
 NJD_TRANSPARENT  Transparent drawing. 
 NJD_USE_TEXTURE  Drawing with texture. 

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


EXAMPLE

The following draws a hexagon.
Sint32 i;
NJS_POINT2COL  p2c;
NJS_POINT2   p[6];
NJS_COLOR    col[6];
p2c.p = p;
p2c.col = col;
p2c.tex = NULL;
p2c.num = 6;
p2c.p[0].x = 427;
p2c.p[0].y = 116;
p2c.col[0].color = 0xFF000055;
p2c.p[1].x = 555;
p2c.p[1].y = 200;
p2c.col[1].color = 0xFFFFFF55;
p2c.p[2].x = 555;
p2c.p[2].y = 285;
p2c.col[2].color = 0x00FF0055;
p2c.p[3].x = 427;
p2c.p[3].y = 371;
p2c.col[3].color = 0xFFFFFF55;
p2c.p[4].x = 300;
p2c.p[4].y = 285;
p2c.col[4].color = 0x0000FF55;
p2c.p[5].x = 300;
p2c.p[5].y = 200;
p2c.col[5].color = 0xFFFFFF55;
njDrawPolygon2D(&p2c,6,-2.f,NJD_DRAW_NORMAL|NJD_FILL);

NOTE

The NJD_DRAW_NORMAL attribute may be omitted when it is used in combination with other attributes.

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