#include <bsEmitter.h>
Classes | |
struct | MemberController |
Public Member Functions | |
Emitter (ScriptMachine *machine) | |
Constructor. | |
void | onRelease () |
Callback for when the Emitter is no longer needed. | |
int | _getAnchorIndex () const |
Internal method to return anchor index, for objects that are anchored to an Emitter. | |
void | setDefinition (EmitterDefinition *def, bstype x, bstype y, bstype angle) |
Set an Emitter instance to use the specified EmitterDefinition. | |
void | enable (bool enable) |
Enables or disables the Emitter. | |
bool | isEnabled () const |
Tests whether the Emitter is currently enabled or disabled. | |
void | setX (bstype x) |
Set the X position of this Emitter. | |
void | setY (bstype y) |
Set the Y position of this Emitter. | |
void | setPosition (bstype x, bstype y) |
Set the position of this Emitter. | |
void | setAngle (bstype angle) |
Set the angle of this Emitter, in degrees. | |
void | setSpecialMember (int member, bstype value) |
Set the specified built-in member of the Emitter. | |
void | setMember (int member, bstype value) |
Set the specified member of the Emitter. | |
void | setMember (int member, bstype value, float time) |
Interpolate the specified member of the Emitter. | |
bstype | getMember (int member) const |
Get the value of a member variable. | |
bstype | getX () const |
Get the X position of this Emitter. | |
bstype | getY () const |
Get the Y position of this Emitter. | |
bstype | getAngle () const |
Get the angle of this Emitter, in degrees. | |
bstype | _getDeltaX () const |
Get the x-distance that the Emitter has moved since last update. | |
bstype | _getDeltaY () const |
Get the y-distance that the Emitter has moved since last update. | |
bstype | _getDeltaAngle () const |
Get the angle that the Emitter has rotated by since last update. | |
void | _updateLastMembers () |
Update the Emitter's internal state for anchor-querying. Internal method. | |
void | setUserObject (void *userObject) |
Set the user-supplied object for this Emitter. | |
void * | getUserObject () const |
Get the user-supplied object for this Emitter. | |
void | setState (int state) |
Set the Emitter's state. | |
void | update (float frameTime) |
Update the Emitter. | |
Friends | |
class | EmitType |
Emitters are script objects which control the way in which user objects are emitted. They are simple state machines which move between states dependent on various inputs. When emitting an object, they can specify how that object is controlled by bulletscript, either by script functions or Affectors. They can also be controlled by a Controller.
BS_NMSP::Emitter::Emitter | ( | ScriptMachine * | machine | ) | [explicit] |
Constructor.
machine | pointer to an active ScriptMachine. |
int BS_NMSP::Emitter::_getAnchorIndex | ( | ) | const |
Internal method to return anchor index, for objects that are anchored to an Emitter.
bstype BS_NMSP::Emitter::_getDeltaAngle | ( | ) | const |
Get the angle that the Emitter has rotated by since last update.
This is used to update anchored objects.
bstype BS_NMSP::Emitter::_getDeltaX | ( | ) | const |
Get the x-distance that the Emitter has moved since last update.
This is used to update anchored objects.
bstype BS_NMSP::Emitter::_getDeltaY | ( | ) | const |
Get the y-distance that the Emitter has moved since last update.
This is used to update anchored objects.
void BS_NMSP::Emitter::enable | ( | bool | enable | ) |
bstype BS_NMSP::Emitter::getAngle | ( | ) | const |
bstype BS_NMSP::Emitter::getMember | ( | int | member | ) | const |
void* BS_NMSP::Emitter::getUserObject | ( | ) | const |
Get the user-supplied object for this Emitter.
The user object can be used to pass information to the emit function. This is useful because Emitters are updated by the bulletscript machine in one go, and the user is otherwise unable to intercept the update to set Emitter-specific parameters in their application.
bstype BS_NMSP::Emitter::getX | ( | ) | const |
bstype BS_NMSP::Emitter::getY | ( | ) | const |
bool BS_NMSP::Emitter::isEnabled | ( | ) | const |
Tests whether the Emitter is currently enabled or disabled.
void BS_NMSP::Emitter::onRelease | ( | ) |
Callback for when the Emitter is no longer needed.
Emitter are managed by a pool, and so need to be reused without being destroyed and recreated. This function overrides DeepMemoryPoolObject::onRelease to tidy up the parts of Controller that need it.
void BS_NMSP::Emitter::setAngle | ( | bstype | angle | ) |
void BS_NMSP::Emitter::setDefinition | ( | EmitterDefinition * | def, | |
bstype | x, | |||
bstype | y, | |||
bstype | angle | |||
) |
Set an Emitter instance to use the specified EmitterDefinition.
Sets the Emitter to use the given EmitterDefinition. You do not want to call this function directly: doing so will leave the Emitter in an undefined state. Use Machine::createEmitter instead.
def | pointer to the EmitterDefinition to use to set the Emitter up. | |
x | initial x position | |
y | initial y position | |
angle | initial angle |
void BS_NMSP::Emitter::setMember | ( | int | member, | |
bstype | value, | |||
float | time | |||
) |
Interpolate the specified member of the Emitter.
This function changes the specified variable smoothly over time. This is used for built-in member variables as well as user-defined ones. Hence, the first user variable is at index NUM_SPECIAL_MEMBERS (defined in bsCore.h).
member | index of the member variable. | |
value | value to set it to. | |
time | length of time (in seconds) to set the variable over. |
void BS_NMSP::Emitter::setMember | ( | int | member, | |
bstype | value | |||
) |
Set the specified member of the Emitter.
This is for user-defined member variables. Built-in members such as position and angle should be set with setSpecialMember, thus index 0 is refers to the first user-defined member.
member | index of the user member variable. | |
value | value to set it to. |
void BS_NMSP::Emitter::setPosition | ( | bstype | x, | |
bstype | y | |||
) |
void BS_NMSP::Emitter::setSpecialMember | ( | int | member, | |
bstype | value | |||
) |
Set the specified built-in member of the Emitter.
member | index of the built-in member variable. | |
value | value to set it to. |
void BS_NMSP::Emitter::setState | ( | int | state | ) |
Set the Emitter's state.
Sets the state to the specified index. This is an internal method which uses index for speed reasons.
state | index of the state. |
void BS_NMSP::Emitter::setUserObject | ( | void * | userObject | ) |
Set the user-supplied object for this Emitter.
userObject | pointer to a user-supplied object, which is passed back into any emit function that this emitter calls. |
void BS_NMSP::Emitter::setX | ( | bstype | x | ) |
void BS_NMSP::Emitter::setY | ( | bstype | y | ) |
void BS_NMSP::Emitter::update | ( | float | frameTime | ) |
Update the Emitter.
This function is for internal use.
frameTime | the time interval since last update, in seconds. |