TossableStrategy Class Reference

#include <TossableStrategy.h>

List of all members.

Public Member Functions

 TossableStrategy (void)
 ~TossableStrategy (void)
bool isTossing ()
void setTossing (bool value)
float getCurrentFriction ()
void setCurrentFriction (float coeff)
float getFrictionCoefficient ()
void setFrictionCoefficient (float coeff)
float getStaticFrictionCoefficient ()
void setStaticFrictionCoefficient (float coeff)
float getTossingCutoff ()
void setTossingCutoff (float value)

Protected Member Functions

void initProperties ()
void process ()
void onEvent (LargeDisplayEvent *evt)
void readPassiveBuffers (const std::vector< unsigned int > &types)
void readAllPassiveBuffers ()

Protected Attributes

std::queue< Point3f > recentPositions
unsigned int nPositions
bool tossing
float currentFriction
float frictionCoefficient
float staticFrictionCoefficient
float tossingCutoff
Vector2f tossingVector
unsigned int frictionBufferType


Detailed Description

This strategy allows a component to be tossed. It will consider the recent cursor movement to calculate the tossing direction and initial speed. As the component is moving, friction will slow it down until it stops. The component also stops if it reaches a region with too high friction coefficient (i. e., >= 1.0).

This strategy should be added after all the drawing strategies of a component so that the decorations are drawn using the same positional values.

Author:
Fabricio Anastacio - fabriciocfa@yahoo.com
Since:
August 9, 2007


Constructor & Destructor Documentation

TossableStrategy::TossableStrategy ( void   ) 

Constructs a tossable strategy.

TossableStrategy::~TossableStrategy ( void   ) 

Destroys this strategy.


Member Function Documentation

bool TossableStrategy::isTossing (  )  [inline]

Returns true if the component is being tossed.

Returns:
true if the component is being tossed, false otherwise.

void TossableStrategy::setTossing ( bool  value  )  [inline]

Sets if the component is being tossed.

Parameters:
value true if the component is being tossed, false otherwise.

float TossableStrategy::getCurrentFriction (  )  [inline]

Returns the current dynamic friction coefficient being used when tossing.

Returns:
the current dynamic friction coefficient.

void TossableStrategy::setCurrentFriction ( float  coeff  )  [inline]

Sets the current dynamic friction coefficient being used when tossing.

Parameters:
coeff the value to be set as the current dynamic friction coefficient.

float TossableStrategy::getFrictionCoefficient (  )  [inline]

Returns the default dynamic friction coefficient being used when tossing. This value is used when the parent component does not have a friction buffer.

Returns:
the default dynamic friction coefficient.

void TossableStrategy::setFrictionCoefficient ( float  coeff  )  [inline]

Sets the default dynamic friction coefficient being used when tossing. This value is used when the parent component does not have a friction buffer.

Parameters:
coeff the value to be set as the default dynamic friction coefficient.

float TossableStrategy::getStaticFrictionCoefficient (  )  [inline]

Returns the default static friction coefficient being used when tossing. This value is used when the parent component does not have a friction buffer.

Returns:
the default static friction coefficient.

void TossableStrategy::setStaticFrictionCoefficient ( float  coeff  )  [inline]

Sets the default static friction coefficient being used when tossing. This value is used when the parent component does not have a friction buffer.

Parameters:
coeff the value to be set as the default static friction coefficient.

float TossableStrategy::getTossingCutoff (  )  [inline]

Returns the minimum strength the tossing vector should have to move a component.

Returns:
the minimum strength the tossing vector should have to move a component.

void TossableStrategy::setTossingCutoff ( float  value  )  [inline]

Sets the value of the minimum strength the tossing vector should have to move a component.

Parameters:
value the value to be set as the minimum strength the tossing vector should have to move a component.

void TossableStrategy::initProperties (  )  [protected]

Initializes the properties (i. e., i-buffers) of the associated component.

void TossableStrategy::process (  )  [protected]

Performs a given action before rendering the component.

void TossableStrategy::onEvent ( LargeDisplayEvent *  evt  )  [protected]

Handles the given event.

Parameters:
evt the event to be handled.

void TossableStrategy::readPassiveBuffers ( const std::vector< unsigned int > &  types  )  [inline, protected]

Reads the passive buffer(s) specified by the parameter 'type' and makes the proper updates in the state of the associated component.

Parameters:
type the type of buffer that should be read from the container.

void TossableStrategy::readAllPassiveBuffers (  )  [inline, protected]

Reads all the passive buffers for a component strategy. This method is called before drawing the component in order to update its state/properties.


Member Data Documentation

std::queue<Point3f> TossableStrategy::recentPositions [protected]

Collection of recent cursor positions.

unsigned int TossableStrategy::nPositions [protected]

Number of cursor positions to keep track in the list.

bool TossableStrategy::tossing [protected]

Determines if the associated component is being tossed at the moment.

float TossableStrategy::currentFriction [protected]

The current dynamic friction coefficient.

float TossableStrategy::frictionCoefficient [protected]

Determines the standart dynamic friction coefficent to be used when tossing. It is used when the parent component does not have a friction buffer.

float TossableStrategy::staticFrictionCoefficient [protected]

Determines the standart static friction coefficent to be used when tossing. It determines the strenght (length) of the tossing vector necessary to start a tossing movement.

float TossableStrategy::tossingCutoff [protected]

The minimum strength the tossing vector should have to move a component. It is compared to the value of the length of the tossing vector.

Vector2f TossableStrategy::tossingVector [protected]

The vector representing the "tossing force".

unsigned int TossableStrategy::frictionBufferType [protected]

Friction buffer type identifier.


The documentation for this class was generated from the following files:
Generated on Fri Dec 21 17:46:10 2007 for LargeDisplayFrameworkToolkit by  doxygen 1.5.2