Middle Europe Productions Library  alpha 1.3.3
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MEP::Animation Class Reference

MEP::Animation base definition of an animation. More...

#include <AnimationBase.h>

Inheritance diagram for MEP::Animation:
MEPtools::AnimationDelay MEP::AnimationObject MEP::AnimationPosition MEP::Button MEP::AnimationColor

Public Types

enum  AnimationInit { AnimationInit::NotInit = 0, AnimationInit::ObjectAnimation = 1, AnimationInit::PositionAnimation = 2 }
 

Public Member Functions

 Animation ()=default
 
 Animation (const AnimationInit initType, const float frameRate)
 
 Animation (const AnimationInit initType, const sf::Time towait)
 
 Animation (const Animation &x)
 
virtual void run (const Direction direc, sf::Time currentTime=sf::Time::Zero)
 
void changeStatus ()
 
bool getStatus () const
 
void changeTag (MEP::U_int32 tag)
 
sf::Time getToWait () const
 
AnimationInit getInit () const
 
const DirectiongetDirection () const
 
void setDirection (MEP::Direction dir)
 
virtual bool reset ()
 
- Public Member Functions inherited from MEPtools::AnimationDelay
void setDelay (const sf::Time &delay, bool permaDelay=false)
 
void setEntryDelay (const sf::Time &delay)
 
void setExitDelay (const sf::Time &delay)
 
void setLowEntryDelay (const sf::Time &delay)
 
void setLowExitDelay (const sf::Time &delay)
 
void setGeneralDelay (const sf::Time &delay, bool permaDelay=false)
 
void resetDelay ()
 

Protected Member Functions

void animationDebug (std::ostream &out) const
 
- Protected Member Functions inherited from MEPtools::AnimationDelay
const sf::Time & delay () const
 
bool updateDelay (const sf::Time &currentTime)
 
void newCycle ()
 
void changeState (State newState)
 

Protected Attributes

MEP::U_int32 m_tag = AdditionalTag::AdditionalTagDisabled
 
AnimationInit isInit = AnimationInit::NotInit
 
sf::Time updateTime = sf::Time::Zero
 
sf::Time toWait = sf::Time::Zero
 
bool isRunning = false
 
Direction direction = Direction::Backwards
 
- Protected Attributes inherited from MEPtools::AnimationDelay
State state = State::Base
 

Additional Inherited Members

- Protected Types inherited from MEPtools::AnimationDelay
enum  State {
  State::Entry, State::Exit, State::Base, State::LowExit,
  State::LowEntry
}
 

Detailed Description

MEP::Animation base definition of an animation.

Member Enumeration Documentation

◆ AnimationInit

Enumerator
NotInit 

Animation is not initialized.

ObjectAnimation 

Animation will be animating Object type of variable.

PositionAnimation 

Animation will be animating Position type of variable.

Constructor & Destructor Documentation

◆ Animation() [1/4]

MEP::Animation::Animation ( )
default

Default constructor.

◆ Animation() [2/4]

MEP::Animation::Animation ( const AnimationInit  initType,
const float  frameRate 
)
inline

Constructor of an base animation.

Parameters
[in]initType: Initialization type.
[in]frameRate: Frame rate of an animation.

◆ Animation() [3/4]

MEP::Animation::Animation ( const AnimationInit  initType,
const sf::Time  towait 
)
inline

Constructor of an base animation.

Parameters
[in]initType: Initialization type.
[in]towait: Time to wait between aniamtion frames.

◆ Animation() [4/4]

MEP::Animation::Animation ( const Animation x)
inline

Copy constructor of an base animation.

Parameters
[in]x: MEP::Animation.

Member Function Documentation

◆ animationDebug()

void MEP::Animation::animationDebug ( std::ostream &  out) const
inlineprotected

◆ changeStatus()

void MEP::Animation::changeStatus ( )
inline

Changes current status to !status

◆ changeTag()

void MEP::Animation::changeTag ( MEP::U_int32  tag)
inline

Changes the additional tag of an animation.

Parameters
[in]tagMEP::Animation::AdditionalTag.

◆ getDirection()

const Direction& MEP::Animation::getDirection ( ) const
inline

Outputs animation direction.

Returns
MEP::Animation::Direction

◆ getInit()

AnimationInit MEP::Animation::getInit ( ) const
inline

Outputs animation initialization tag.

Returns
MEP::Animation::AnimationInit

◆ getStatus()

bool MEP::Animation::getStatus ( ) const
inline

Outputs a current status of an animation.

Returns
true - animation is active, false - animation is unactive.

◆ getToWait()

sf::Time MEP::Animation::getToWait ( ) const
inline

Outputs time to wait between animation frames.

Returns
sf::Time

◆ reset()

virtual bool MEP::Animation::reset ( )
inlinevirtual

Resets the parameters of the animation if the animation is not active. Reset means changing it's current frame to begin or end depending of the direction. If direction is forward changes to begin otherwise to end.

Reimplemented in MEP::AnimationPosition.

◆ run()

virtual void MEP::Animation::run ( const Direction  direc,
sf::Time  currentTime = sf::Time::Zero 
)
inlinevirtual

Sets the running tag to true and changes the direction of a movement, furthermore, it is capable of setting a current time.

Parameters
[in]direc: MEP::Animation::Direction.
[in]currentTime: sf::Time = sf::Time::Zero.

Reimplemented in MEP::AnimationPosition.

◆ setDirection()

void MEP::Animation::setDirection ( MEP::Direction  dir)
inline

Sets the direction of an animation.

Member Data Documentation

◆ direction

Direction MEP::Animation::direction = Direction::Backwards
protected

◆ isInit

AnimationInit MEP::Animation::isInit = AnimationInit::NotInit
protected

◆ isRunning

bool MEP::Animation::isRunning = false
protected

◆ m_tag

MEP::U_int32 MEP::Animation::m_tag = AdditionalTag::AdditionalTagDisabled
protected

◆ toWait

sf::Time MEP::Animation::toWait = sf::Time::Zero
protected

◆ updateTime

sf::Time MEP::Animation::updateTime = sf::Time::Zero
protected