Polycode
Polycode::ScreenShape Class Reference

2D primitive. More...

Inherits Polycode::ScreenMesh.

Inherited by Polycode::ScreenCurve, Polycode::ScreenImage, Polycode::ScreenLabel, and Polycode::ScreenSprite.

List of all members.

Public Member Functions

 ScreenShape (int shapeType, Number option1=0, Number option2=0, Number option3=0, Number option4=0)
 Create a new shape of specified type and size/options.
void Render ()
 Main render method.
void setStrokeColor (Number r, Number g, Number b, Number a)
 Sets the color of the shape stroke if it's enabled.
void setStrokeWidth (Number width)
 Sets the width of the shape stroke if it's enabled.
void setGradient (Number r1, Number g1, Number b1, Number a1, Number r2, Number g2, Number b2, Number a2)
 Colors the shape with a gradient.
void clearGradient ()
 Removes the gradient from the shape.
void addShapePoint (Number x, Number y)
 Adds a point to the mesh.

Public Attributes

bool strokeEnabled
 If set to true, the shape will be drawn over with a stroke.
Color strokeColor
 Color of the shape stroke.

Detailed Description

2D primitive.

Screen shape can create 2d shapes (Currently only rectangles and circles).


Constructor & Destructor Documentation

ScreenShape::ScreenShape ( int  shapeType,
Number  option1 = 0,
Number  option2 = 0,
Number  option3 = 0,
Number  option4 = 0 
)

Create a new shape of specified type and size/options.

Parameters:
shapeTypeType of shape to create. Currently the only options are ScreenShape::SHAPE_RECT and ScreenShape::SHAPE_CIRCLE. Pass ScreenShape::SHAPE_CUSTOM if you want to create a custom shape (
See also:
addShapePoint())
Parameters:
option1Width option.
option2Height option.
option3Number of vertices for the the circle (defaults to 360). Unused for rectangle.
option4Reserved.

Member Function Documentation

void ScreenShape::addShapePoint ( Number  x,
Number  y 
)

Adds a point to the mesh.

Parameters:
xHorizontal position of the point.
yVertical position of the point.
void ScreenShape::Render ( ) [virtual]

Main render method.

Override this to do your own drawing.

Reimplemented from Polycode::ScreenMesh.

void ScreenShape::setGradient ( Number  r1,
Number  g1,
Number  b1,
Number  a1,
Number  r2,
Number  g2,
Number  b2,
Number  a2 
)

Colors the shape with a gradient.

Radial for circles, linear for rectangles.

Parameters:
widthNew stroke width.
r1Red value of the first gradient color 0-1.
g1Green value of the first gradient color 0-1
b1Blue value of the first gradient color 0-1
a1Alpha value of the first gradient color 0-1
r2Red value of the second gradient color 0-1.
g2Green value of the second gradient color 0-1
b2Blue value of the second gradient color 0-1
a2Alpha value of the second gradient color 0-1
See also:
strokeEnabled
void ScreenShape::setStrokeColor ( Number  r,
Number  g,
Number  b,
Number  a 
)

Sets the color of the shape stroke if it's enabled.

Parameters:
rRed value 0-1.
gGreen value 0-1
bBlue value 0-1
aAlpha value 0-1
See also:
strokeEnabled
void ScreenShape::setStrokeWidth ( Number  width)

Sets the width of the shape stroke if it's enabled.

Parameters:
widthNew stroke width.
See also:
strokeEnabled