Bottle 2D - Lua API 1.0.0
All you need to create games using bottle2D.
Public Member Functions | Public Attributes

Shape Class Reference

A Shape is a basic shape with a color and an outline color. More...

#include <header.hpp>

Inheritance diagram for Shape:
Drawable Object

List of all members.

Public Member Functions

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.

Detailed Description

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:


Member Function Documentation

nil Shape::AddPoint ( Vector2D  Position,
Color  Col,
Color  OutlineCol 
)

Add a point to the shape.

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::MakeCircle ( Vector2D  Center,
number  Radius,
Color  Col,
number  Outline,
Color  OutlineCol 
)

Initialise the shape as a circle / disk.


Parameters:
CenterPosition of the center
RadiusRadius
ColColor used to fill the circle
OutlineOutline width
OutlineColColor used to draw the outline
nil Shape::MakeLine ( Vector2D  P1,
Vector2D  P2,
number  Thickness,
Color  Col,
number  Outline,
Color  OutlineCol 
)

Initialise the shape as a line.


Parameters:
P1Position of the first point
P2Position second point
ThicknessLine thickness
ColColor used to draw the line
OutlineOutline width (0 by default)
OutlineColColor used to draw the outline
nil Shape::MakeRectangle ( Vector2D  P1,
Vector2D  P2,
Color  Col,
number  Outline,
Color  OutlineCol 
)

Initialise the shape as a rectangle.


Parameters:
P1Position of the first point
P2Position second point
ColColor used to fill the rectangle
OutlineOutline width
OutlineColColor used to draw the outline
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.


Member Data Documentation

Acces object's color.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables