![]() |
Gorgon Game Engine
|
This class is a timer that has its progression strictly controlled. More...
Public Member Functions | |
virtual unsigned int | GetProgress () const override |
Returns the current progress of the timer. More... | |
unsigned int | GetProgress (int ind) const |
Returns the progress of the given animation. More... | |
float | GetProgressRate () const |
Returns the progress of this controlled timer. More... | |
virtual bool | IsControlled () const override |
This method allows clients to determine if the progress is controlled. More... | |
virtual void | Progress (unsigned int) override |
virtual void | Reset () override |
Resets the animation to the start. More... | |
void | SetProgress (float value) |
Sets the progress of this controlled timer. More... | |
![]() | |
ControllerBase () | |
Default constructor. More... | |
ControllerBase (Governor &governor) | |
virtual | ~ControllerBase () |
Destructor. More... | |
virtual void | Add (Base &animation) |
This function attaches the given animation to this controller. More... | |
void | AutoDestruct () |
Set a flag that will automatically destroy this controller whenever it has no animations left to control. More... | |
virtual void | Delete (Base &animation) |
Deletes the given animation. More... | |
void | Keep () |
Resets the flag that will automatically destroy this controller whenever it has no animations left to control. More... | |
virtual void | Progress (unsigned timepassed)=0 |
Progresses this timer by moving the timer timepassed milliseconds forwards. More... | |
virtual void | Remove (Base &animation) |
Removes the given animation. More... | |
virtual void | SetGovernor (Governor &governor) |
Changes the governor of this controller. More... | |
Protected Attributes | |
int | curind |
float | progress |
![]() | |
Containers::Collection< Base > | animations |
List of animations this controller holds. More... | |
bool | collectable |
Whether this controller should be collected by the garbage collector when its task is finished. More... | |
Governor * | governor |
This class is a timer that has its progression strictly controlled.
Progress is specified in percentage and will not be progressed automatically as the time passes. Each controlled animation will be controlled separately. Thus when the progress is set to 1, all animations will progress to end.
This is a meta controller if there are multiple animations using it. Unless designed to work together, meta controllers and meta animations should not be used together.
|
overridevirtual |
Returns the current progress of the timer.
Implements ControllerBase.
References ControllerBase::animations, ControlledTimer::curind, and ControlledTimer::progress.
unsigned int GetProgress | ( | int | ind | ) | const |
Returns the progress of the given animation.
If the given index does not exists, this function will return (unsigned)-1.
References ControllerBase::animations, and ControlledTimer::progress.
float GetProgressRate | ( | ) | const |
Returns the progress of this controlled timer.
References ControlledTimer::progress.
|
overridevirtual |
This method allows clients to determine if the progress is controlled.
If the progress is not controlled, there is no way to force the animation to stop. Therefore, animations with looping capabilities should wrap around to start over. However, if the timer is a controller then the best strategy will be to stop at the end, and return the leftover time. This way, controller can decide what to do next.
Implements ControllerBase.
|
overridevirtual |
References ControllerBase::animations, and ControlledTimer::curind.
|
overridevirtual |
Resets the animation to the start.
Animation controllers that do not support this request should silently ignore it.
Implements ControllerBase.
References ControlledTimer::progress.
void SetProgress | ( | float | value | ) |
Sets the progress of this controlled timer.
0 is the start of the animation 1 is the end of it. The value is threated as cyclic and normalized before used while keeping the original value. Negative values are act as if starting from the end. Thus a value of -0.1 is same as 0.9. Use GetProgressRate to obtain the value set in this function. GetProgress can be used to obtain progress of the first or specific animation.
References ControlledTimer::progress.
|
protected |
|
protected |