Bottle 2D - Lua API 1.0.0
All you need to create games using bottle2D.
|
A Shape is a basic shape with a color and an outline color. More...
#include <header.hpp>
Public Member Functions | |
Shape | Clone () |
Create a clone of the object and return an handler to the clone. | |
Shape | CloneToGroup (Group newParent) |
Create a clone of the object, change the parent and return an handler to the clone. | |
nil | SetColor (Color Col) |
Set object's color. | |
Color | GetColor () |
Get object's color. | |
nil | SetScale (Vector2D Scale) |
Set object's scale. | |
Vector2D | GetScale () |
Get object's scale. | |
nil | SetScaleX (number FactorX) |
Set object's scale (x) | |
nil | SetScaleY (number FactorY) |
Set object's scale (y) | |
nil | SetCenter (Vector2D Center) |
Set object's center. | |
Vector2D | GetCenter () |
Get object's center. | |
nil | AddPoint (Vector2D Position, Color Col, Color OutlineCol) |
number | GetNbPoints () |
Get the total number of point in the shape. | |
nil | EnableFill (bool Enable) |
Enable / disable filling the shape with a color. | |
nil | EnableOutline (bool Enable) |
Enable / disable outline. | |
nil | SetPointPosition (number index, Vector2D Position) |
Change the position of a point. | |
nil | SetPointColor (number index, Color Col) |
Change the color of a point. | |
nil | SetPointOutlineColor (number index, Color OutlineCol) |
Change the outline color of a point. | |
nil | SetOutlineWidth (number Width) |
Change the outline width. | |
Vector2D | GetPointPosition (number index) |
Get a point position. | |
Color | GetPointColor (number index) |
Get a point color. | |
Color | GetPointOutlineColor (number index) |
Get a point outline color. | |
number | GetOutlineWidth () |
Get the width of the outline. | |
nil | MakeLine (Vector2D P1, Vector2D P2, number Thickness, Color Col, number Outline, Color OutlineCol) |
Initialise the shape as a line. | |
nil | MakeRectangle (Vector2D P1, Vector2D P2, Color Col, number Outline, Color OutlineCol) |
Initialise the shape as a rectangle. | |
nil | MakeCircle (Vector2D Center, number Radius, Color Col, number Outline, Color OutlineCol) |
Initialise the shape as a circle / disk. | |
nil | SetSize (Vector2D size) |
Change the size of a rectangle shape (for compatibility with Sprite). | |
Public Attributes | |
Color | color |
Acces object's color. |
A Shape is a basic shape with a color and an outline color.
You can add and remove as much point as you want to make every shape you want.
Use the function Group::CreateShape to create an empty shape.
The following functions can be used to create basic shapes:
Shape Shape::Clone | ( | ) |
Create a clone of the object and return an handler to the clone.
Reimplemented from Object.
Create a clone of the object, change the parent and return an handler to the clone.
Reimplemented from Object.
nil Shape::EnableFill | ( | bool | Enable | ) |
Enable / disable filling the shape with a color.
nil Shape::EnableOutline | ( | bool | Enable | ) |
Enable / disable outline.
Vector2D Shape::GetCenter | ( | ) |
Get object's center.
Color Shape::GetColor | ( | ) |
Get object's color.
number Shape::GetNbPoints | ( | ) |
Get the total number of point in the shape.
number Shape::GetOutlineWidth | ( | ) |
Get the width of the outline.
Color Shape::GetPointColor | ( | number | index | ) |
Get a point color.
Index starts at 1.
Color Shape::GetPointOutlineColor | ( | number | index | ) |
Get a point outline color.
Index starts at 1.
Vector2D Shape::GetPointPosition | ( | number | index | ) |
Get a point position.
Index starts at 1.
Vector2D Shape::GetScale | ( | ) |
Get object's scale.
nil Shape::SetCenter | ( | Vector2D | Center | ) |
Set object's center.
nil Shape::SetColor | ( | Color | Col | ) |
Set object's color.
nil Shape::SetOutlineWidth | ( | number | Width | ) |
Change the outline width.
nil Shape::SetPointColor | ( | number | index, |
Color | Col | ||
) |
Change the color of a point.
Index starts at 1.
nil Shape::SetPointOutlineColor | ( | number | index, |
Color | OutlineCol | ||
) |
Change the outline color of a point.
Index starts at 1.
nil Shape::SetPointPosition | ( | number | index, |
Vector2D | Position | ||
) |
Change the position of a point.
Index starts at 1.
nil Shape::SetScale | ( | Vector2D | Scale | ) |
Set object's scale.
nil Shape::SetScaleX | ( | number | FactorX | ) |
Set object's scale (x)
nil Shape::SetScaleY | ( | number | FactorY | ) |
Set object's scale (y)
nil Shape::SetSize | ( | Vector2D | size | ) |
Change the size of a rectangle shape (for compatibility with Sprite).
P1 position is kept.
Acces object's color.