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

MEP::AnimationObject is a sprite with the ability to dislay an animation. More...

#include <AnimationObject.h>

Inheritance diagram for MEP::AnimationObject:
MEP::Animation MEP::Object MEP::Sprite MEPtools::AnimationDelay MEP::Drawable MEP::Following MEP::Button

Public Member Functions

 AnimationObject (const float frameRate, const Object &x, sf::Vector2f pos={ 0.f, 0.f }, sf::Vector2f scale={ 1.f, 1.f })
 
void onResize () override
 
virtual const sf::Vector2u & getSize () const
 
void setScale (const sf::Vector2f scale) override
 
void setScale (const Following &x) override
 
void runForward (sf::Time &currentTime)
 
void runBackward (sf::Time &currentTime)
 
bool draw (sf::RenderWindow &window) override
 
void update (sf::Time &currentTime) override
 
void entryUpdate (sf::Time &currentTime, bool low=false) override
 
void exitUpdate (sf::Time &currentTime, bool low=false) override
 
bool isActive () const override
 
bool isTansparent (unsigned int x, unsigned int y) override
 
const AnimationObjectgetAnimationObject ()
 
virtual void debugOutput (std::ostream &out) const
 
virtual ~AnimationObject ()=default
 
- Public Member Functions inherited from MEP::Animation
 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 ()
 
- Public Member Functions inherited from MEP::Object
 Object ()=delete
 
 Object (const Object &x)
 
 Object (const U_int32 ID, const std::string &path, const std::string &filename, bool transparencyM=false)
 
 Object (const U_int32 ID, const std::string &path, const std::string &filename, unsigned int frames, bool transparencyM=false)
 
 Object (const U_int32 ID, std::list< sf::Image > &images, const std::string &filename, bool transparencyM=false)
 
unsigned long getNufTextures () const
 
bool draw (sf::RenderWindow &window) override
 
void update (sf::Time &) override
 
void entryUpdate (sf::Time &currentTime, bool low=false) override
 
void exitUpdate (sf::Time &currentTime, bool low=false) override
 
ObjectgetObjectPoint ()
 
ObjectgetObjectRef ()
 
const U_int32getID () const
 
const std::string & getName () const
 
bool isActive () const
 
const ObjectTypegetType () const
 
unsigned int nufC () const
 
bool operator== (const std::string &x) const
 
bool operator== (const Object &x) const
 
 ~Object () override
 
- Public Member Functions inherited from MEP::Drawable
void _link (std::shared_ptr< bool > _li)
 
std::shared_ptr< bool > _linkAddr ()
 
const std::shared_ptr< bool > _linkAddr () const
 
bool _isLinked () const
 
U_int32 getDrawTag () const
 
void setDrawTag (const U_int32 tag)
 
bool addDrawTag (const U_int32 tag)
 
bool removeDrawTag (const U_int32 tag)
 
 Drawable ()=default
 
virtual ~Drawable ()
 
- Public Member Functions inherited from MEP::Sprite
 Sprite (const FollowType &followType, sf::Vector2f pos={ 0.f, 0.f }, sf::Vector2f scale={ 1.f, 1.f })
 
 Sprite (sf::Vector2f pos={ 0.f, 0.f }, sf::Vector2f scale={ 1.f, 1.f })
 
Spriteoperator<< (const Sprite &x)
 
sf::Sprite & getSprite ()
 
void updateSprite (sf::Texture &texture)
 
virtual void updateSprite ()
 
void setPosition (const sf::Vector2f pos) override
 
void setPosition (const Following &x) override
 
void setColor (const sf::Color &color) override
 
void setRect (const sf::IntRect &rect)
 
void addMethodRect (std::function< sf::IntRect()> method)
 
void updateRect ()
 
const sf::IntRect & getRect () const
 
const sf::Color & getColor () const override
 
- Public Member Functions inherited from MEP::Following
 Following (const FollowType &followType, sf::Vector2f pos={ 0.f, 0.f }, sf::Vector2f posFixed={ 0.f, 0.f }, sf::Vector2f scale={ 1.f, 1.f }, sf::Vector2f scaleFixed={ 1.f, 1.f })
 
 Following (sf::Vector2f pos={ 0.f, 0.f }, sf::Vector2f posFixed={ 0.f, 0.f }, sf::Vector2f scale={ 1.f, 1.f }, sf::Vector2f scaleFixed={ 1.f, 1.f })
 
 Following (const Following &x)
 
void updatePosition ()
 
void addMethodPos (std::function< sf::Vector2f()> method)
 
void updateScale ()
 
void addMethodScale (std::function< sf::Vector2f()> method)
 
Followingoperator<< (const Following &x)
 
void setFollow (const AnimationPosition &base, const FollowType type, MEP::U_int32 group=-1)
 
void setFollow (const AnimationColor &base, MEP::U_int32 toFollow=MEP::ColorChannel::ALL, MEP::U_int32 group=-1)
 
void muteFollowGroup (MEP::U_int32 group)
 
void unMuteFollowGroup (MEP::U_int32 group)
 
void fullMuteFollow ()
 
void fullUnMuteFollow ()
 
virtual void movePosition (const sf::Vector2f pos)
 
sf::Vector2f getPosition () const
 
sf::Vector2f getScale () const
 
sf::Vector2f getOriginPosition () const
 
sf::Vector2f getOriginScale () const
 
bool isFollowerActive () const
 
void followingDebug (std::ostream &out, const char *skipLines="") const
 
void clearFollow ()
 

Protected Member Functions

void init ()
 
bool correctObject (const Object &x)
 
void updateSize ()
 
- Protected Member Functions inherited from MEP::Animation
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 Member Functions inherited from MEP::Object
void deleteObject ()
 
- Protected Member Functions inherited from MEP::Drawable
void notify ()
 
void drawTagDebug (std::ostream &out) const
 

Protected Attributes

std::list< sf::Texture * >::iterator currentFrame
 
unsigned int index_currentFrame = 0
 
const AnimationObjecttoFollowOBJ = nullptr
 
sf::Vector2u fixSize
 
- Protected Attributes inherited from MEP::Animation
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
 
- Protected Attributes inherited from MEP::Object
bool transparency = false
 
bool ** table = nullptr
 
sf::Vector2u m_size = {0, 0}
 
std::list< sf::Texture * > * texture
 
ObjectType m_type = Object::ObjectType::NotInit
 
- Protected Attributes inherited from MEP::Sprite
sf::Sprite currentSprite
 
- Protected Attributes inherited from MEP::Following
std::function< sf::Vector2f()> calc_position = [this]()->sf::Vector2f { return m_pos; }
 
std::function< sf::Vector2f()> calc_scale = [this]()->sf::Vector2f { return m_scale; }
 
MEPtools::GroupManager< Follow, std::unique_ptr< Follow >, std::list< std::unique_ptr< Follow > > > followingListv2
 
sf::Vector2f m_pos = {0.f, 0.f}
 
sf::Vector2f m_posMove = { 0.f, 0.f }
 
sf::Vector2f m_posFixed = { 0.f, 0.f }
 
sf::Vector2f m_scale = { 1.f, 1.f }
 
sf::Vector2f m_scaleFixed = { 1.f, 1.f }
 
sf::Color m_color
 
sf::Color m_colorFixed
 

Friends

std::ostream & operator<< (std::ostream &out, const AnimationObject &x)
 

Additional Inherited Members

- Public Types inherited from MEP::Animation
enum  AnimationInit { AnimationInit::NotInit = 0, AnimationInit::ObjectAnimation = 1, AnimationInit::PositionAnimation = 2 }
 
- Public Types inherited from MEP::Object
enum  ObjectType { ObjectType::NotInit, ObjectType::Single, ObjectType::Multi }
 
- Public Types inherited from MEP::Following
enum  FollowType {
  FollowType::NotInit = 0, FollowType::Objects = 1, FollowType::X_Scale = 2, FollowType::Y_Scale = 3,
  FollowType::X_Pos = 4, FollowType::Y_Pos = 5, FollowType::Color = 6
}
 
- Protected Types inherited from MEPtools::AnimationDelay
enum  State {
  State::Entry, State::Exit, State::Base, State::LowExit,
  State::LowEntry
}
 

Detailed Description

MEP::AnimationObject is a sprite with the ability to dislay an animation.

Constructor & Destructor Documentation

◆ AnimationObject()

MEP::AnimationObject::AnimationObject ( const float  frameRate,
const Object x,
sf::Vector2f  pos = { 0.f, 0.f },
sf::Vector2f  scale = { 1.f, 1.f } 
)
inline

Constructor of an animation.

Parameters
[in]frameRate: Frame rate of an animation.
[in]x: Object with the animation frames.
[in]pos: Position of an animation.
[in]scale: Scale of an animation.

◆ ~AnimationObject()

virtual MEP::AnimationObject::~AnimationObject ( )
virtualdefault

Member Function Documentation

◆ correctObject()

bool MEP::AnimationObject::correctObject ( const Object x)
inlineprotected

◆ debugOutput()

virtual void MEP::AnimationObject::debugOutput ( std::ostream &  out) const
inlinevirtual

Debug output of the class.

Reimplemented from MEP::Object.

◆ draw()

bool MEP::AnimationObject::draw ( sf::RenderWindow &  window)
inlineoverridevirtual

Override of a MEP::Drawable draw.

Reimplemented from MEP::Drawable.

◆ entryUpdate()

void MEP::AnimationObject::entryUpdate ( sf::Time &  currentTime,
bool  low = false 
)
inlineoverridevirtual

Override of a MEP::Drawable entryUpdate.

Reimplemented from MEP::Drawable.

◆ exitUpdate()

void MEP::AnimationObject::exitUpdate ( sf::Time &  currentTime,
bool  low = false 
)
inlineoverridevirtual

Override of a MEP::Drawable exitUpdate.

Reimplemented from MEP::Drawable.

◆ getAnimationObject()

const AnimationObject& MEP::AnimationObject::getAnimationObject ( )
inline

Outputs the animation object.

Returns
: MEP::AnimationObject.

◆ getSize()

virtual const sf::Vector2u& MEP::AnimationObject::getSize ( ) const
inlinevirtual

Outputs the size of a master MEP::Object

Returns
sf:Vector2u size.

Reimplemented from MEP::Object.

◆ init()

void MEP::AnimationObject::init ( )
inlineprotected

◆ isActive()

bool MEP::AnimationObject::isActive ( ) const
inlineoverridevirtual

Outputs the activation status of an animation.

Returns
True - active, False - unactive

Reimplemented from MEP::Drawable.

◆ isTansparent()

bool MEP::AnimationObject::isTansparent ( unsigned int  x,
unsigned int  y 
)
inlineoverridevirtual

Checks if a given position is Transparent. MEP::Objects of a button needs to have transparency initialized.

Returns
true - position is transparent, false - there is a pixel witout alpha channel > 200

Reimplemented from MEP::Object.

Reimplemented in MEP::Button.

◆ onResize()

void MEP::AnimationObject::onResize ( )
inlineoverridevirtual

On resize we want to update the position.

Reimplemented from MEP::Drawable.

◆ runBackward()

void MEP::AnimationObject::runBackward ( sf::Time &  currentTime)
inline

Runs the animation in the backward direction.

Parameters
[in]currentTime: Current global time.

◆ runForward()

void MEP::AnimationObject::runForward ( sf::Time &  currentTime)
inline

Runs the animation in the forward direction.

Parameters
[in]currentTime: Current global time.

◆ setScale() [1/2]

void MEP::AnimationObject::setScale ( const Following x)
inlineoverridevirtual

Sets the scale.

Parameters
[in]pos: MEP::Following object.

Reimplemented from MEP::Sprite.

◆ setScale() [2/2]

void MEP::AnimationObject::setScale ( const sf::Vector2f  scale)
inlineoverridevirtual

Sets the scale.

Parameters
[in]scale: Scale.

Reimplemented from MEP::Sprite.

◆ update()

void MEP::AnimationObject::update ( sf::Time &  currentTime)
inlineoverridevirtual

Override of a MEP::Drawable update.

Reimplemented from MEP::Drawable.

Reimplemented in MEP::Button.

◆ updateSize()

void MEP::AnimationObject::updateSize ( )
inlineprotected

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const AnimationObject x 
)
friend

Overrdie of the << operator for diagnostic purposes.

Member Data Documentation

◆ currentFrame

std::list<sf::Texture*>::iterator MEP::AnimationObject::currentFrame
protected

◆ fixSize

sf::Vector2u MEP::AnimationObject::fixSize
protected

◆ index_currentFrame

unsigned int MEP::AnimationObject::index_currentFrame = 0
protected

◆ toFollowOBJ

const AnimationObject* MEP::AnimationObject::toFollowOBJ = nullptr
protected