![]() |
Gorgon Game Engine
|
This is the base class for all animations. More...
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 ControllerBase & | GetController () 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 | |
ControllerBase * | controller |
Controller of this animation. More... | |
This is the base class for all animations.
It handles some common tasks and defines the animation interface.
|
explicit |
Sets the controller for this animation to the given controller.
References Base::controller, and Base::SetController().
Copies the animation.
References Base::GetController(), Base::HasController(), and Base::SetController().
|
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().
|
protectedvirtual |
Virtual destructor.
References Base::controller, LOG, and ControllerBase::Remove().
|
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.
|
virtual |
Returns the controller of this animation.
Reimplemented in basic_InstanceInjection< Graphics::RectangularAnimation >.
References Base::controller.
|
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.
|
virtual |
Returns whether this animation has a controller.
Reimplemented in basic_InstanceInjection< Graphics::RectangularAnimation >.
References Base::controller.
|
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.
|
virtual |
Removes the controller of this animation.
Reimplemented in basic_InstanceInjection< Graphics::RectangularAnimation >.
References Base::controller, and ControllerBase::Remove().
|
virtual |
Sets the controller to the given controller.
Reimplemented in EmptyImage, BlankImage, Bitmap, basic_InstanceInjection< Graphics::RectangularAnimation >, and KeyRepeater.
References ControllerBase::Add(), Base::controller, and ControllerBase::Remove().
|
protected |
Controller of this animation.