Gorgon Game Engine
ControllerBase Class Referenceabstract

Controllers are required to progress animations. More...

Inheritance diagram for ControllerBase:
[legend]

Public Member Functions

 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...
 
virtual unsigned GetProgress () const =0
 Returns the current progress of the timer. More...
 
virtual bool IsControlled () const =0
 This method allows clients to determine if the progress is controlled. 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 Reset ()=0
 Resets the animation to the start. More...
 
virtual void SetGovernor (Governor &governor)
 Changes the governor of this controller. More...
 

Protected Attributes

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

Controllers are required to progress animations.

Constructor & Destructor Documentation

◆ ControllerBase() [1/2]

Default constructor.

References Governor::Active(), and ControllerBase::governor.

◆ ControllerBase() [2/2]

ControllerBase ( Governor governor)
explicit

◆ ~ControllerBase()

~ControllerBase ( )
virtual

Destructor.

References Governor::Active(), ControllerBase::governor, and LOG.

Member Function Documentation

◆ Add()

void Add ( Base animation)
virtual

This function attaches the given animation to this controller.

References ControllerBase::animations, and Base::SetController().

◆ AutoDestruct()

void AutoDestruct ( )

Set a flag that will automatically destroy this controller whenever it has no animations left to control.

References ControllerBase::collectable.

◆ Delete()

void Delete ( Base animation)
virtual

Deletes the given animation.

References ControllerBase::animations.

◆ GetProgress()

virtual unsigned GetProgress ( ) const
pure virtual

Returns the current progress of the timer.

Implemented in Timer, and ControlledTimer.

◆ IsControlled()

virtual bool IsControlled ( ) const
pure virtual

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.

Implemented in Controller, Timer, and ControlledTimer.

◆ Keep()

void Keep ( )

Resets the flag that will automatically destroy this controller whenever it has no animations left to control.

References ControllerBase::collectable.

◆ Progress()

virtual void Progress ( unsigned  timepassed)
pure virtual

Progresses this timer by moving the timer timepassed milliseconds forwards.

Implemented in Controller, and Timer.

◆ Remove()

void Remove ( Base animation)
virtual

Removes the given animation.

References ControllerBase::animations, and ControllerBase::collectable.

◆ Reset()

virtual void Reset ( )
pure virtual

Resets the animation to the start.

Animation controllers that do not support this request should silently ignore it.

Implemented in ControlledTimer, Controller, and Timer.

◆ SetGovernor()

void SetGovernor ( Governor governor)
virtual

Changes the governor of this controller.

References Governor::Active(), and ControllerBase::governor.

Member Data Documentation

◆ animations

Containers::Collection<Base> animations
protected

List of animations this controller holds.

◆ collectable

bool collectable
protected

Whether this controller should be collected by the garbage collector when its task is finished.

◆ governor

Governor* governor
protected

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