2D primitive. More...
Inherits Polycode::ScreenMesh.
Inherited by Polycode::ScreenCurve, Polycode::ScreenImage, Polycode::ScreenLabel, and Polycode::ScreenSprite.
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. | |
| virtual Entity * | Clone (bool deepClone, bool ignoreEditorOnly) |
| Clones the entity, return an exact copy. | |
| virtual void | applyClone (Entity *clone, bool deepClone, bool ignoreEditorOnly) |
| This method must be implemented by all subvlasses implementing Clone. | |
| 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. | |
| void | operator= (const ScreenShape ©) |
| Assignment operator. | |
Public Attributes | |
| bool | strokeEnabled |
| If set to true, the shape will be drawn over with a stroke. | |
| Color | strokeColor |
| Color of the shape stroke. | |
| Number | strokeWidth |
| Width of the shape stroke. | |
2D primitive.
Screen shape can create 2d shapes (Currently only rectangles and circles).
| 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.
| 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 ( |
| option1 | Width option. |
| option2 | Height option. |
| option3 | Number of vertices for the the circle (defaults to 360). Unused for rectangle. |
| option4 | Reserved. |
| void ScreenShape::addShapePoint | ( | Number | x, |
| Number | y | ||
| ) |
Adds a point to the mesh.
| x | Horizontal position of the point. |
| y | Vertical position of the point. |
| Entity * ScreenShape::Clone | ( | bool | deepClone, |
| bool | ignoreEditorOnly | ||
| ) | [virtual] |
Clones the entity, return an exact copy.
This method must be implemented in an Entity subclass for you to be able to clone it.
| deepClone | If true, perform a deep clone, cloning all the children. |
| ignoreEditorOnly | If true, ignore all child entities where editorOnly is set to true (will still clone the entity you call Clone() on even if its editorOnly flag is set to true. |
Reimplemented from Polycode::ScreenEntity.
Reimplemented in Polycode::ScreenImage, Polycode::ScreenLabel, and Polycode::ScreenSprite.
| void ScreenShape::Render | ( | ) | [virtual] |
Main render method.
Override this to do your own drawing.
Reimplemented from Polycode::ScreenMesh.
Reimplemented in Polycode::ScreenLabel.
| 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.
| 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 |
| void ScreenShape::setStrokeColor | ( | Number | r, |
| Number | g, | ||
| Number | b, | ||
| Number | a | ||
| ) |
Sets the color of the shape stroke if it's enabled.
| r | Red value 0-1. |
| g | Green value 0-1 |
| b | Blue value 0-1 |
| a | Alpha value 0-1 |
| void ScreenShape::setStrokeWidth | ( | Number | width | ) |
Sets the width of the shape stroke if it's enabled.
| width | New stroke width. |