Drag[en]gine Game Engine
1.21
|
Floating point value with smooth adjusting over time. More...
#include <decSmoothFloat.h>
Public Member Functions | |
Constructors and Destructors | |
decSmoothFloat () | |
Create a new smooth float. More... | |
decSmoothFloat (const decSmoothFloat ©) | |
Create copy of a smooth float. More... | |
~decSmoothFloat () | |
Clean up smooth float. More... | |
Management | |
float | GetValue () const |
Current value. More... | |
void | SetValue (float value) |
Set current value. More... | |
float | GetGoal () const |
Goal value. More... | |
void | SetGoal (float goal) |
Set goal value. More... | |
float | GetAdjustTime () const |
Adjustment time in seconds. More... | |
void | SetAdjustTime (float adjustTime) |
Adjustment time in seconds. Clamped to 0 or larger. More... | |
float | GetAdjustRange () const |
Adjustment range in units. More... | |
void | SetAdjustRange (float limit) |
Set adjustment range in units. Clamped to 0 or larger. More... | |
float | GetChangeSpeed () const |
Change speed of the value in units per second. More... | |
void | SetChangeSpeed (float changeSpeed) |
Set change speed of the value in units per second. More... | |
void | Reset () |
Reset value, goal and change speed to 0. More... | |
void | Update (float elapsed) |
Update value with goal using current smoothing parameters. More... | |
Operators | |
bool | operator== (const decSmoothFloat &other) const |
Determine if another smooth float equals this smooth float. More... | |
bool | operator!= (const decSmoothFloat &other) const |
Determine if two smooth float are not equal. More... | |
decSmoothFloat & | operator= (const decSmoothFloat &other) |
Copy another smooth float to this smooth float. More... | |
Floating point value with smooth adjusting over time.
decSmoothFloat::decSmoothFloat | ( | ) |
Create a new smooth float.
Value, goal and change speed are set to 0. Adjust time is set to 1s. Change speed limit is set to 1 unit per second.
decSmoothFloat::decSmoothFloat | ( | const decSmoothFloat & | copy | ) |
Create copy of a smooth float.
decSmoothFloat::~decSmoothFloat | ( | ) |
Clean up smooth float.
|
inline |
Adjustment range in units.
|
inline |
Adjustment time in seconds.
|
inline |
Change speed of the value in units per second.
|
inline |
Goal value.
|
inline |
Current value.
bool decSmoothFloat::operator!= | ( | const decSmoothFloat & | other | ) | const |
Determine if two smooth float are not equal.
Two smooth floats are not equal if their value difference is larger than or equal to FLOAT_SAFE_EPSILON.
decSmoothFloat& decSmoothFloat::operator= | ( | const decSmoothFloat & | other | ) |
Copy another smooth float to this smooth float.
bool decSmoothFloat::operator== | ( | const decSmoothFloat & | other | ) | const |
Determine if another smooth float equals this smooth float.
Two smooth floats are equal if their value difference is less than FLOAT_SAFE_EPSILON.
void decSmoothFloat::Reset | ( | ) |
Reset value, goal and change speed to 0.
void decSmoothFloat::SetAdjustRange | ( | float | limit | ) |
Set adjustment range in units. Clamped to 0 or larger.
void decSmoothFloat::SetAdjustTime | ( | float | adjustTime | ) |
Adjustment time in seconds. Clamped to 0 or larger.
void decSmoothFloat::SetChangeSpeed | ( | float | changeSpeed | ) |
Set change speed of the value in units per second.
void decSmoothFloat::SetGoal | ( | float | goal | ) |
Set goal value.
void decSmoothFloat::SetValue | ( | float | value | ) |
Set current value.
void decSmoothFloat::Update | ( | float | elapsed | ) |
Update value with goal using current smoothing parameters.
Goal is not modified.
[in] | elapsed | Elapsed time in seconds. If less than 0.001s update is skipped. |