Gorgon Game Engine
Base Class Referenceabstract

This is the base class for all animations. More...

Inheritance diagram for Base:
[legend]

Public Member Functions

 Base (bool create=false)
 This constructor creates a new controller depending on the create parameter. More...
 
 Base (const Base &base)
 Copies the animation. More...
 
 Base (ControllerBase &controller)
 Sets the controller for this animation to the given controller. More...
 
virtual void DeleteAnimation () const
 Deletes this animation. More...
 
virtual ControllerBaseGetController () const
 Returns the controller of this animation. More...
 
virtual int GetDuration () const =0
 Returns the duration of the animation if it is a known apriori. More...
 
virtual bool HasController () const
 Returns whether this animation has a controller. More...
 
virtual bool Progress (unsigned &leftover)=0
 This function should progress the animation. More...
 
virtual void RemoveController ()
 Removes the controller of this animation. More...
 
virtual void SetController (ControllerBase &controller)
 Sets the controller to the given controller. More...
 

Protected Member Functions

virtual ~Base ()
 Virtual destructor. More...
 

Protected Attributes

ControllerBasecontroller
 Controller of this animation. More...
 

Detailed Description

This is the base class for all animations.

It handles some common tasks and defines the animation interface.

Constructor & Destructor Documentation

◆ Base() [1/3]

Base ( ControllerBase controller)
explicit

Sets the controller for this animation to the given controller.

References Base::controller, and Base::SetController().

◆ Base() [2/3]

Base ( const Base base)

Copies the animation.

References Base::GetController(), Base::HasController(), and Base::SetController().

◆ Base() [3/3]

Base ( bool  create = false)
explicit

This constructor creates a new controller depending on the create parameter.

Animation has the right to decline to create a new timer. Animations that does not use timers should ignore create request without any errors or side effects. If create parameter is true, the controller created for this object will have dynamic life time. This means, if all animations it has is removed from it, it will be destroyed.

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

◆ ~Base()

~Base ( )
protectedvirtual

Virtual destructor.

References Base::controller, LOG, and ControllerBase::Remove().

Member Function Documentation

◆ DeleteAnimation()

virtual void DeleteAnimation ( ) const
virtual

Deletes this animation.

Please note that some animations are also the animation provider. In these cases trying to delete the animation will delete the provider as well. This function should be called instead of delete operator to ensure no such problem occurs.

Reimplemented in basic_TextureAnimation< T_, P_, F_ >, EmptyImage, BlankImage, Bitmap, and ImageProvider.

◆ GetController()

virtual ControllerBase& GetController ( ) const
virtual

Returns the controller of this animation.

Reimplemented in basic_InstanceInjection< Graphics::RectangularAnimation >.

References Base::controller.

◆ GetDuration()

virtual int GetDuration ( ) const
pure virtual

Returns the duration of the animation if it is a known apriori.

If the animation can be progressed infinitely, if it is possible to derive optimal duration, it should be returned. In case when it is impossible to determine the duration, return 0.

Implemented in KeyRepeater, basic_TintedObject< A_ >, basic_TextureAnimation< T_, P_, F_ >, basic_StackedObject< A_ >, basic_ScalableObject< A_ >, Rectangle, basic_MaskedObject< A_ >, Line, EmptyImage, BlankImage, Bitmap, basic_InstanceInjection< Graphics::RectangularAnimation >, and ImageProvider.

◆ HasController()

virtual bool HasController ( ) const
virtual

Returns whether this animation has a controller.

Reimplemented in basic_InstanceInjection< Graphics::RectangularAnimation >.

References Base::controller.

◆ Progress()

virtual bool Progress ( unsigned &  leftover)
pure virtual

This function should progress the animation.

Notice that this function is called internally. Unless a change to the controller has been made and instant update of the animation is required there is no need to call this function. Returning true from this function denotes that the further progress is possible. If progress should end, leftover parameter should be set to the amount of time that cannot be progressed. Progress function should also mind uncontrollable controllers.

Implemented in basic_TextureAnimation< T_, P_, F_ >, EmptyImage, basic_InstanceInjection< Graphics::RectangularAnimation >, KeyRepeater, basic_TintedObject< A_ >, basic_StackedObject< A_ >, basic_ScalableObject< A_ >, Rectangle, basic_MaskedObject< A_ >, Line, BlankImage, Bitmap, and ImageProvider.

◆ RemoveController()

virtual void RemoveController ( )
virtual

Removes the controller of this animation.

Reimplemented in basic_InstanceInjection< Graphics::RectangularAnimation >.

References Base::controller, and ControllerBase::Remove().

◆ SetController()

virtual void SetController ( ControllerBase controller)
virtual

Member Data Documentation

◆ controller

ControllerBase* controller
protected

Controller of this animation.


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