BS_NMSP::Emitter Class Reference

Class for controlling object emission. More...

#include <bsEmitter.h>

List of all members.

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


Detailed Description

Class for controlling object emission.

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.


Constructor & Destructor Documentation

BS_NMSP::Emitter::Emitter ( ScriptMachine *  machine  )  [explicit]

Constructor.

Parameters:
machine pointer to an active ScriptMachine.


Member Function Documentation

int BS_NMSP::Emitter::_getAnchorIndex (  )  const

Internal method to return anchor index, for objects that are anchored to an Emitter.

Returns:
anchor index, or 0 if emitter is invalid.

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.

Returns:
difference.

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.

Returns:
difference.

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.

Returns:
difference.

void BS_NMSP::Emitter::enable ( bool  enable  ) 

Enables or disables the Emitter.

Parameters:
enable enables if true, disables if false.

bstype BS_NMSP::Emitter::getAngle (  )  const

Get the angle of this Emitter, in degrees.

Returns:
angle.

bstype BS_NMSP::Emitter::getMember ( int  member  )  const

Get the value of a member variable.

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).

Parameters:
member index of the user member variable.
Returns:
the value of the Emitter member variable.

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.

Returns:
the user object.

bstype BS_NMSP::Emitter::getX (  )  const

Get the X position of this Emitter.

Returns:
x position.

bstype BS_NMSP::Emitter::getY (  )  const

Get the Y position of this Emitter.

Returns:
y position.

bool BS_NMSP::Emitter::isEnabled (  )  const

Tests whether the Emitter is currently enabled or disabled.

Returns:
true is enabled, false otherwise.

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  ) 

Set the angle of this Emitter, in degrees.

Parameters:
angle new 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.

Parameters:
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).

Parameters:
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.

Parameters:
member index of the user member variable.
value value to set it to.

void BS_NMSP::Emitter::setPosition ( bstype  x,
bstype  y 
)

Set the position of this Emitter.

Parameters:
x new x position.
y new y position.

void BS_NMSP::Emitter::setSpecialMember ( int  member,
bstype  value 
)

Set the specified built-in member of the Emitter.

Parameters:
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.

Parameters:
state index of the state.

void BS_NMSP::Emitter::setUserObject ( void *  userObject  ) 

Set the user-supplied object for this Emitter.

Parameters:
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  ) 

Set the X position of this Emitter.

Parameters:
x new x position.

void BS_NMSP::Emitter::setY ( bstype  y  ) 

Set the Y position of this Emitter.

Parameters:
y new y position.

void BS_NMSP::Emitter::update ( float  frameTime  ) 

Update the Emitter.

This function is for internal use.

Parameters:
frameTime the time interval since last update, in seconds.


The documentation for this class was generated from the following file:

Generated on Wed Mar 31 12:49:05 2010 for bulletscript by  doxygen 1.5.9