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

ParticleSource Class Reference

A particle source is used to send particle and create beautiful effects. More...

#include <header.hpp>

Inheritance diagram for ParticleSource:
Drawable Object

List of all members.

Public Member Functions

nil SetFlow (number flow)
 Set particle flow (number of particle emitted per second).
number GetFlow ()
 Get particle flow.
nil SetTank (number tank)
 Set particle tank (the number of particle that the source can emit).
number GetTank ()
 Get particle tank.
nil SetGravity (Vector2D force)
 Set particle gravity.
Vector2D GetGravity ()
 Get gravity.
nil SetFriction (number friction)
 Set friction.
number GetFriction ()
 Get friction.
nil SetForce (number min, number max)
 Set emission force.
number GetMinForce ()
 Get min emission force.
nil SetMinForce (number minForce)
 Set min emission force.
number GetMaxForce ()
 Get max emission force.
nil SetMaxForce (number maxForce)
 Set max emission force.
nil SetEmitterAngle (number angle)
 Set throw angle of the emitter (0 : only in one direction, 2*pi : ain every direction)
number GetEmitterAngle ()
 Get the throw angle of the emitter (0 : only in one direction, 2*pi : ain every direction)
nil SetEmitterDirection (Vector2D direction)
 Set direction of the emitter (doesn't need to be normalised)
Vector2D GetEmitterDirection ()
 Set direction of the emitter (doesn't need to be normalised)
nil SetEmitter (ParticleEmitter emitter)
 Set the particle emitter.
nil MakeRenderLines (number length, number width)
 Make particle rendered as lines.
nil MakeRenderPoints (number ponumberSize)
 Make particle rendered as points.
nil MakeRenderImages (Texture img, Vector2D size, bool blendAdd)
 Make particle rendered as images.
nil SetAutoDestroy (bool autoDestroy)
 Set auto destroy mode : when tank is 0, the ParticleSource should be automatically destroyed.
bool IsAutoDestroy ()
 Check if auto destroy mode is activated.
nil ComputeParticles (number time)
 Conpute particle position as if time seconds were elapsed.
nil SetOnTankEmptyEventFunction (luaObject luaFunction)
 Set the event function (fnName should be an existing lua function, or nil for nothing) that is called when the tank is empty.
luaObject GetOnTankEmptyEventFunction ()
 Get the event function that is called when the tank is empty.

Public Attributes

int flow
 Access flow (see SetFlow)
int tank
 Access tank (see SetTank)
Vector2D gravity
 Access particle gravity.
float friction
 Access particle friction.
float minForce
 Access minimum force.
float maxForce
 Access maximum force.
bool autoDestroy
 Access auto destroy mode (see SetAutoDestroy)
luabind::object onTankEmptyEventFunction
 Acces the event function (fnName should be an lua function or nil for nothing) that is called when the tank is empty.

Detailed Description

A particle source is used to send particle and create beautiful effects.

It can emit only one type of particle. See Group::CreateParticleSource to create a particle source object.


Member Function Documentation

nil ParticleSource::ComputeParticles ( number  time)

Conpute particle position as if time seconds were elapsed.

This is usefull if you to make the user think that the particle system was already running for a long time.

Parameters:
timeTime which is supposed to be elapsed. Usualy, it should be maxLifeTime.
number ParticleSource::GetEmitterAngle ( )

Get the throw angle of the emitter (0 : only in one direction, 2*pi : ain every direction)

Vector2D ParticleSource::GetEmitterDirection ( )

Set direction of the emitter (doesn't need to be normalised)

number ParticleSource::GetFlow ( )

Get particle flow.

number ParticleSource::GetFriction ( )

Get friction.

Vector2D ParticleSource::GetGravity ( )

Get gravity.

number ParticleSource::GetMaxForce ( )

Get max emission force.

number ParticleSource::GetMinForce ( )

Get min emission force.

luaObject ParticleSource::GetOnTankEmptyEventFunction ( )

Get the event function that is called when the tank is empty.

Arguments : this object if auto desroy is disabed, nothing otherwise.

number ParticleSource::GetTank ( )

Get particle tank.

bool ParticleSource::IsAutoDestroy ( )

Check if auto destroy mode is activated.

nil ParticleSource::MakeRenderImages ( Texture  img,
Vector2D  size,
bool  blendAdd 
)

Make particle rendered as images.

nil ParticleSource::MakeRenderLines ( number  length,
number  width 
)

Make particle rendered as lines.

nil ParticleSource::MakeRenderPoints ( number  ponumberSize)

Make particle rendered as points.

nil ParticleSource::SetAutoDestroy ( bool  autoDestroy)

Set auto destroy mode : when tank is 0, the ParticleSource should be automatically destroyed.

Default is deactivated.

nil ParticleSource::SetEmitter ( ParticleEmitter  emitter)

Set the particle emitter.

Warning: It will remove most of the paramaters registered in the ParticleSource.

nil ParticleSource::SetEmitterAngle ( number  angle)

Set throw angle of the emitter (0 : only in one direction, 2*pi : ain every direction)

nil ParticleSource::SetEmitterDirection ( Vector2D  direction)

Set direction of the emitter (doesn't need to be normalised)

nil ParticleSource::SetFlow ( number  flow)

Set particle flow (number of particle emitted per second).


Value -1 means unlimited.
Note: You can't set Flow and tank to -1 (infinite).

nil ParticleSource::SetForce ( number  min,
number  max 
)

Set emission force.

nil ParticleSource::SetFriction ( number  friction)

Set friction.

nil ParticleSource::SetGravity ( Vector2D  force)

Set particle gravity.

nil ParticleSource::SetMaxForce ( number  maxForce)

Set max emission force.

nil ParticleSource::SetMinForce ( number  minForce)

Set min emission force.

nil ParticleSource::SetOnTankEmptyEventFunction ( luaObject  luaFunction)

Set the event function (fnName should be an existing lua function, or nil for nothing) that is called when the tank is empty.


Function prototype should be : function fnName(thisParticleSource : ParticleSource)

nil ParticleSource::SetTank ( number  tank)

Set particle tank (the number of particle that the source can emit).


Value -1 means unlimited. When tank is empty, you can add new particle by calling SetTank()
Note: You can't set Flow and tank to -1 (infinite).


Member Data Documentation

Access auto destroy mode (see SetAutoDestroy)

Access flow (see SetFlow)

Access particle friction.

Access particle gravity.

Access maximum force.

Access minimum force.

Acces the event function (fnName should be an lua function or nil for nothing) that is called when the tank is empty.

Access tank (see SetTank)


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