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:
shapeType Type 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:
option1 Width option.
option2 Height option.
option3 Number of vertices for the the circle (defaults to 360). Unused for rectangle.
option4 Reserved.

Member Function Documentation

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

Adds a point to the mesh.

Parameters:
x Horizontal position of the point.
y Vertical 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:
width New stroke width.
r1 Red value of the first gradient color 0-1.
g1 Green value of the first gradient color 0-1
b1 Blue value of the first gradient color 0-1
a1 Alpha value of the first gradient color 0-1
r2 Red value of the second gradient color 0-1.
g2 Green value of the second gradient color 0-1
b2 Blue value of the second gradient color 0-1
a2 Alpha 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:
r Red value 0-1.
g Green value 0-1
b Blue value 0-1
a Alpha value 0-1
See also:
strokeEnabled
void ScreenShape::setStrokeWidth ( Number  width  ) 

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

Parameters:
width New stroke width.
See also:
strokeEnabled
Generated on Sat Aug 11 18:04:11 2012 for Polycode by  doxygen 1.6.3