Bottle 2D - Lua API 1.0.0
All you need to create games using bottle2D.
|
A Group is a container wich can contain drawable and physic object. More...
#include <header.hpp>
Public Member Functions | |
Group | Clone () |
Create a clone of the object and return an handler to the clone. | |
Group | CloneToGroup (Group newParent) |
Create a clone of the object, change the parent and return an handler to the clone. | |
nil | SetScale (Vector2D scale) |
Set the group scale. | |
Vector2D | GetScale () |
Get the group scale. | |
number | GetChildCount () |
Return the number of physic and drawable children that this group contains. | |
PhysicObject | GetPhysicChild (number id) |
Return the physic child number id. | |
number | GetPhysicChildCount () |
Return the number of physic children that this group contains. | |
Drawable | GetDrawableChild (number id) |
Return the drawable child number id. | |
number | GetDrawableChildCount () |
Return the number of drawable children that this group contains. | |
nil | DestroyChildren () |
Destroy every children of the group. | |
nil | EnableCut (bool isCut) |
Enable / disable the cutting of a certain part of the group. | |
bool | IsCut () |
Return true if the cutting is enabled, false otherwise. | |
nil | SetCutRect (Vector2D position, Vector2D size) |
Set the cut rectangle. | |
Vector2D | GetCutRectPosition () |
Get the cut rectangle's position. | |
Vector2D | GetCutRectSize () |
Get the cut rectangle's size. | |
luaObject | GetChildTable () |
Get a lua table containing all its childs. | |
luaObject | FindByIndex (number id) |
Get a child from its index in the group (a number for 1 to Group::GetChildCount(). | |
luaObject | FindByName (string name) |
Find an object in the group with its name and cast it with the good type. | |
PhLine | FindByNamePhLine (string name) |
Find an object in the group with its name. | |
PhRect | FindByNamePhRect (string name) |
Find an object in the group with its name. | |
PhTriangle | FindByNamePhTriangle (string name) |
Find an object in the group with its name. | |
PhCircle | FindByNamePhCircle (string name) |
Find an object in the group with its name. | |
PhShape | FindByNamePhShape (string name) |
Find an object in the group with its name. | |
Group | FindByNameGroup (string name) |
Find an object in the group with its name. | |
ParticleSource | FindByNameParticleSource (string name) |
Find an object in the group with its name. | |
Shape | FindByNameShape (string name) |
Find an object in the group with its name. | |
Sprite | FindByNameSprite (string name) |
Find an object in the group with its name. | |
Text | FindByNameText (string name) |
Find an object in the group with its name. | |
PostFX | FindByNamePostFX (string name) |
Find an object in the group with its name. | |
Screen | FindByNameScreen (string name) |
Find an object in the group with its name. | |
ScreenRenderer | FindByNameScreenRenderer (string name) |
Find an object in the group with its name. | |
PhLine | CreatePhLine (number phGroupId, string name, Vector2D pt1, Vector2D pt2) |
Create a new physic line and attach it to this group. | |
PhRect | CreatePhRect (number phGroupId, string name, Vector2D size) |
Create a new physic rectangle and attach it to this group. | |
PhTriangle | CreatePhTriangle (number phGroupId, string name, Vector2D pt1, Vector2D pt2, Vector2D pt3) |
Create a new physic triangle and attach it to this group. | |
PhShape | CreatePhShape (number phGroupId, string name) |
Create a physic shape and attach it to this group. | |
PhCircle | CreatePhCircle (number phGroupId, string name, Vector2D center, number radius) |
Create a new physic disk and attach it to this group. | |
Group | CreateGroup (string name) |
Create a Group object and add it to the current group. | |
ParticleSource | CreateParticleSource (string name, ParticleModel model, number maxParticleNumber) |
Create a ParticleSource object and add it to the current group. | |
Shape | CreateShape (string name) |
Create a Shape object and add it to the current group. | |
Shape | CreateShapeLine (string name, Vector2D P1, Vector2D P2, number Thickness, Color Col, number Outline, Color OutlineCol) |
Create a shape, initialise it as a line and add it to the current group. | |
Shape | CreateShapeRectangle (string name, Vector2D P1, Vector2D P2, Color Col, number Outline, Color OutlineCol) |
Create a shape, initialise it as a rectangle and add it to the current group. | |
Shape | CreateShapeCircle (string name, Vector2D Center, number Radius, Color Col, number Outline, Color OutlineCol) |
Create a circle / disk, initialise it as a rectangle and add it to the current group. | |
Sprite | CreateSprite (string name) |
Create a Sprite object and add it to the current group. | |
Text | CreateText (string name, string text) |
Create a Text object and add it to the current group. | |
PostFX | CreatePostFX (string name) |
Create a PostFX object and add it to the current group. | |
ScreenRenderer | CreateScreenRenderer (string name) |
Create a ScreenRenderer object and add it to the current group. | |
nil | RegisterEventAutoRemoveOnDestroy (EventHandlerBase event) |
Public Attributes | |
Vector2D | scale |
Edit scale. |
A Group is a container wich can contain drawable and physic object.
When a group is moved or rotated, its child will be moved or rotated too. It's like a folder: if you Destroy it, its children will be destroyed too. It could be created using Group::CreateGroup.
Group Group::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.
Group Group::CreateGroup | ( | string | name | ) |
Create a Group object and add it to the current group.
name | The name of the object. |
ParticleSource Group::CreateParticleSource | ( | string | name, |
ParticleModel | model, | ||
number | maxParticleNumber | ||
) |
Create a ParticleSource object and add it to the current group.
name | The name of the object. |
model | The particle model for this ParticleSource. |
maxParticleNumber | Used to reserve memory. It should not be oversized (unusefull memory would be allocated) or undersized (some particle won't be created)
|
Create a new physic disk and attach it to this group.
phGroupId | The physic group of the object, in order to generate colision events (see Screen::AddPhysicGroup()). |
name | The name of the object. |
center | The center of the circle. Can be changed with Object::SetPosition(). |
radius | The radius of the disk. |
Create a new physic line and attach it to this group.
phGroupId | The physic group of the object, in order to generate colision events (see Screen::AddPhysicGroup()). |
name | The name of the object. |
pt1 | First point of the line. |
pt2 | Second point of the line. |
Create a new physic rectangle and attach it to this group.
phGroupId | The physic group of the object, in order to generate colision events (see Screen::AddPhysicGroup()). |
name | The name of the object. |
size | The size of the rectangle. Use Object::SetPosition() to change the object's position. |
PhShape Group::CreatePhShape | ( | number | phGroupId, |
string | name | ||
) |
Create a physic shape and attach it to this group.
When a shape is created, you can add points to it by calling PhShape::AddPoint(). The shape must be convex !
phGroupId | The physic group of the object, in order to generate colision events (see Screen::AddPhysicGroup()). |
name | The name of the object. |
PhTriangle Group::CreatePhTriangle | ( | number | phGroupId, |
string | name, | ||
Vector2D | pt1, | ||
Vector2D | pt2, | ||
Vector2D | pt3 | ||
) |
Create a new physic triangle and attach it to this group.
phGroupId | The physic group of the object, in order to generate colision events (see Screen::AddPhysicGroup()). |
name | The name of the object. |
pt1 | First point of the triangle. |
pt2 | Second point of the triangle. |
pt3 | Third point of the triangle. |
PostFX Group::CreatePostFX | ( | string | name | ) |
Create a PostFX object and add it to the current group.
name | The name of the object. |
ScreenRenderer Group::CreateScreenRenderer | ( | string | name | ) |
Create a ScreenRenderer object and add it to the current group.
name | The name of the object. |
Shape Group::CreateShape | ( | string | name | ) |
Create a Shape object and add it to the current group.
name | The name of the object. |
Shape Group::CreateShapeLine | ( | string | name, |
Vector2D | P1, | ||
Vector2D | P2, | ||
number | Thickness, | ||
Color | Col, | ||
number | Outline, | ||
Color | OutlineCol | ||
) |
Create a shape, initialise it as a line and add it to the current group.
name | The name of the object. |
P1 | Position of the first point |
P2 | Position second point |
Thickness | Line thickness |
Col | Color used to draw the line |
Outline | Outline width (0 by default) |
OutlineCol | Color used to draw the outline |
Sprite Group::CreateSprite | ( | string | name | ) |
Create a Sprite object and add it to the current group.
name | The name of the object. |
Text Group::CreateText | ( | string | name, |
string | text | ||
) |
nil Group::DestroyChildren | ( | ) |
Destroy every children of the group.
nil Group::EnableCut | ( | bool | isCut | ) |
Enable / disable the cutting of a certain part of the group.
Use Group::SetCutRect to define that part.
luaObject Group::FindByIndex | ( | number | id | ) |
Get a child from its index in the group (a number for 1 to Group::GetChildCount().
Warning: no particular order are warranted. Use Group::GetChildTable() to traverse a whole group : it will be faster.
luaObject Group::FindByName | ( | string | name | ) |
Find an object in the group with its name and cast it with the good type.
Return nil if the object doesn't exist.
Group Group::FindByNameGroup | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
ParticleSource Group::FindByNameParticleSource | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
PhCircle Group::FindByNamePhCircle | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
PhLine Group::FindByNamePhLine | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
PhRect Group::FindByNamePhRect | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
PhShape Group::FindByNamePhShape | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
PhTriangle Group::FindByNamePhTriangle | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
PostFX Group::FindByNamePostFX | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
Screen Group::FindByNameScreen | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
ScreenRenderer Group::FindByNameScreenRenderer | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
Shape Group::FindByNameShape | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
Sprite Group::FindByNameSprite | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
Text Group::FindByNameText | ( | string | name | ) |
Find an object in the group with its name.
This function will also check the type of the object.
number Group::GetChildCount | ( | ) |
Return the number of physic and drawable children that this group contains.
luaObject Group::GetChildTable | ( | ) |
Get a lua table containing all its childs.
Warning: no particular order are warranted.
Vector2D Group::GetCutRectPosition | ( | ) |
Get the cut rectangle's position.
Vector2D Group::GetCutRectSize | ( | ) |
Get the cut rectangle's size.
Drawable Group::GetDrawableChild | ( | number | id | ) |
Return the drawable child number id.
number Group::GetDrawableChildCount | ( | ) |
Return the number of drawable children that this group contains.
PhysicObject Group::GetPhysicChild | ( | number | id | ) |
Return the physic child number id.
number Group::GetPhysicChildCount | ( | ) |
Return the number of physic children that this group contains.
Vector2D Group::GetScale | ( | ) |
Get the group scale.
bool Group::IsCut | ( | ) |
Return true if the cutting is enabled, false otherwise.
nil Group::RegisterEventAutoRemoveOnDestroy | ( | EventHandlerBase | event | ) |
Set the cut rectangle.
You should enable cutting.
nil Group::SetScale | ( | Vector2D | scale | ) |
Set the group scale.
It allows you to modify the size of a single group and its childs.
Edit scale.