Gorgon Game Engine
Timer Class Reference

This class is the most basic controller and does not support any operations. More...

Inheritance diagram for Timer:
[legend]

Public Member Functions

virtual ~Timer ()
 
virtual unsigned GetProgress () const override final
 Returns the current progress of the timer. More...
 
virtual bool IsControlled () const override final
 This method allows clients to determine if the progress is controlled. More...
 
virtual void Progress (unsigned timepassed) override final
 Progresses this timer by moving the timer timepassed milliseconds forwards. More...
 
virtual void Reset () override
 Resets the timer, basically starting the animation from the start. More...
 
virtual void SetProgress (unsigned progress)
 Sets the progress of the timer to the given value. More...
 
- Public Member Functions inherited from ControllerBase
 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 Remove (Base &animation)
 Removes the given animation. More...
 
virtual void SetGovernor (Governor &governor)
 Changes the governor of this controller. More...
 

Protected Attributes

unsigned progress
 Amount of time passed since the start of the animation. More...
 
- Protected Attributes inherited from ControllerBase
Containers::Collection< Baseanimations
 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...
 
Governorgovernor
 

Detailed Description

This class is the most basic controller and does not support any operations.

It linearly progresses animation and never stops. Most animations are expected loop under these circumstances. See Controller for additional functionality.

Constructor & Destructor Documentation

◆ ~Timer()

virtual ~Timer ( )
virtual

Member Function Documentation

◆ GetProgress()

virtual unsigned GetProgress ( ) const
finaloverridevirtual

Returns the current progress of the timer.

Implements ControllerBase.

References Timer::progress.

◆ IsControlled()

virtual bool IsControlled ( ) const
finaloverridevirtual

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.

◆ Progress()

void Progress ( unsigned  timepassed)
finaloverridevirtual

Progresses this timer by moving the timer timepassed milliseconds forwards.

Implements ControllerBase.

References ControllerBase::animations, and Timer::progress.

◆ Reset()

virtual void Reset ( )
overridevirtual

Resets the timer, basically starting the animation from the start.

Implements ControllerBase.

References Timer::progress.

◆ SetProgress()

virtual void SetProgress ( unsigned  progress)
virtual

Sets the progress of the timer to the given value.

References Timer::progress.

Member Data Documentation

◆ progress

unsigned progress
protected

Amount of time passed since the start of the animation.


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