Drag[en]gine Game Engine  1.21
decSmoothFloat Class Reference

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 &copy)
 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...
 
decSmoothFloatoperator= (const decSmoothFloat &other)
 Copy another smooth float to this smooth float. More...
 

Detailed Description

Floating point value with smooth adjusting over time.

Constructor & Destructor Documentation

◆ decSmoothFloat() [1/2]

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() [2/2]

decSmoothFloat::decSmoothFloat ( const decSmoothFloat copy)

Create copy of a smooth float.

◆ ~decSmoothFloat()

decSmoothFloat::~decSmoothFloat ( )

Clean up smooth float.

Member Function Documentation

◆ GetAdjustRange()

float decSmoothFloat::GetAdjustRange ( ) const
inline

Adjustment range in units.

◆ GetAdjustTime()

float decSmoothFloat::GetAdjustTime ( ) const
inline

Adjustment time in seconds.

◆ GetChangeSpeed()

float decSmoothFloat::GetChangeSpeed ( ) const
inline

Change speed of the value in units per second.

◆ GetGoal()

float decSmoothFloat::GetGoal ( ) const
inline

Goal value.

◆ GetValue()

float decSmoothFloat::GetValue ( ) const
inline

Current value.

◆ operator!=()

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.

◆ operator=()

decSmoothFloat& decSmoothFloat::operator= ( const decSmoothFloat other)

Copy another smooth float to this smooth float.

◆ operator==()

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.

◆ Reset()

void decSmoothFloat::Reset ( )

Reset value, goal and change speed to 0.

◆ SetAdjustRange()

void decSmoothFloat::SetAdjustRange ( float  limit)

Set adjustment range in units. Clamped to 0 or larger.

◆ SetAdjustTime()

void decSmoothFloat::SetAdjustTime ( float  adjustTime)

Adjustment time in seconds. Clamped to 0 or larger.

◆ SetChangeSpeed()

void decSmoothFloat::SetChangeSpeed ( float  changeSpeed)

Set change speed of the value in units per second.

◆ SetGoal()

void decSmoothFloat::SetGoal ( float  goal)

Set goal value.

◆ SetValue()

void decSmoothFloat::SetValue ( float  value)

Set current value.

◆ Update()

void decSmoothFloat::Update ( float  elapsed)

Update value with goal using current smoothing parameters.

Goal is not modified.

Parameters
[in]elapsedElapsed time in seconds. If less than 0.001s update is skipped.

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