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

Basically the SFML sprite with the support for the MEP functionalities. More...

#include <Sprite.h>

Inheritance diagram for MEP::Sprite:
MEP::Following MEP::AnimationObject MEP::TextureObject MEP::Button

Public Member Functions

 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
 
virtual void setScale (const sf::Vector2f scale)
 
virtual void setScale (const Following &x)
 
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 Attributes

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
 

Additional Inherited Members

- 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
}
 

Detailed Description

Basically the SFML sprite with the support for the MEP functionalities.

Constructor & Destructor Documentation

◆ Sprite() [1/2]

MEP::Sprite::Sprite ( const FollowType followType,
sf::Vector2f  pos = { 0.f, 0.f },
sf::Vector2f  scale = { 1.f, 1.f } 
)
inline

◆ Sprite() [2/2]

MEP::Sprite::Sprite ( sf::Vector2f  pos = { 0.f, 0.f },
sf::Vector2f  scale = { 1.f, 1.f } 
)
inline

Member Function Documentation

◆ addMethodRect()

void MEP::Sprite::addMethodRect ( std::function< sf::IntRect()>  method)
inline

Adds a method of calculation the scale.

Parameters
[in]method: A method of calculating the position.

◆ getColor()

const sf::Color& MEP::Sprite::getColor ( ) const
inlineoverridevirtual

Outputs the color of a master sprite.

Returns
: Color.

Reimplemented from MEP::Following.

Reimplemented in MEP::TextureObject.

◆ getRect()

const sf::IntRect& MEP::Sprite::getRect ( ) const
inline

Outputs the rect.

◆ getSprite()

sf::Sprite& MEP::Sprite::getSprite ( )
inline

Outputs the sf::Sprite objects in case you want to commit any advanced changes which are not supported by the MEP.

Returns
: sf::Sprite

◆ operator<<()

Sprite& MEP::Sprite::operator<< ( const Sprite x)
inline

◆ setColor()

void MEP::Sprite::setColor ( const sf::Color &  color)
inlineoverridevirtual

Changes the color of a master sprite.

Parameters
[in]color: Color.

Reimplemented from MEP::Following.

Reimplemented in MEP::TextureObject.

◆ setPosition() [1/2]

void MEP::Sprite::setPosition ( const Following x)
inlineoverridevirtual

Sets the position

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

Reimplemented from MEP::Following.

◆ setPosition() [2/2]

void MEP::Sprite::setPosition ( const sf::Vector2f  pos)
inlineoverridevirtual

Sets the position

Parameters
[in]pos: Position.

Reimplemented from MEP::Following.

◆ setRect()

void MEP::Sprite::setRect ( const sf::IntRect &  rect)
inline

Sets the main sprite Rect

◆ setScale() [1/2]

virtual void MEP::Sprite::setScale ( const Following x)
inlinevirtual

Sets the scale.

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

Reimplemented from MEP::Following.

Reimplemented in MEP::AnimationObject.

◆ setScale() [2/2]

virtual void MEP::Sprite::setScale ( const sf::Vector2f  scale)
inlinevirtual

Sets the scale.

Parameters
[in]scale: Scale.

Reimplemented from MEP::Following.

Reimplemented in MEP::AnimationObject.

◆ updateRect()

void MEP::Sprite::updateRect ( )
inline

Updates the rect of the Sprite

◆ updateSprite() [1/2]

virtual void MEP::Sprite::updateSprite ( )
inlinevirtual

Updates the set of sprite variables according to the following elements.

◆ updateSprite() [2/2]

void MEP::Sprite::updateSprite ( sf::Texture &  texture)
inline

Updates the set of sprite variables and it's texture according to the following elements and given texture.

Member Data Documentation

◆ currentSprite

sf::Sprite MEP::Sprite::currentSprite
protected

Current sprite ready to bo rendered;