18#include <SFML/Graphics/Sprite.hpp>
84 SpriteComponent(
const std::string &name,
const std::string &spritesheetPath);
241 SpriteComponent(
const std::uint32_t entityId,
const std::string &name);
279 SpriteComponent(
const std::uint32_t entityId,
const std::string &name,
const std::string &spritesheetPath);
454 void setName(
const std::string &name);
692 const std::string
getName()
const;
751 const std::string
getInfo(
const unsigned int indent = 0)
const;
767 void _initialiseSprite();
771 void _processSprite();
776 void _processCollision();
781 void _processSpriteColor();
783 bool _visible =
true;
784 std::string _application =
"";
785 std::string _spriteName =
"";
786 bool _spritesheetSet =
false;
788 bool _collisionSet =
false;
790 bool _animationSet =
false;
792 bool _spriteSet =
false;
793 std::optional<sf::Sprite> _sfSprite;
This is the file that contains the class in charge of tracking sprite animations.
File in charge of containing the custom errors that are going to be used for custom description error...
This is the file that links the EntityNode children.
Macro definitions for logging messages with varying levels of detail and formatting.
This is the file in charge of containing the Log class (the one in charge of outputing info only when...
This file contains the declaration of the TextureComponent class which manages textures.
Represents a drawable and interactive sprite in the ECS system.
void setNormalColor(const GUI::ECS::Systems::Colour &color)
Set the default colour of the sprite.
const bool isSpriteSet() const
Checks if the sprite is initialized.
const GUI::ECS::Systems::Collision getCollision() const
Gets the collision component associated with the sprite.
void update(const GUI::ECS::Systems::MouseInfo &mouse)
Updates the sprite based on mouse input.
void checkTick()
Processes and updates sprite properties based on tick state of the clock internal to it's animation c...
void setSpritesheet(const std::string &spritesheetPath)
Sets the texture of the sprite using a file path.
void setAnimation(const GUI::ECS::Components::AnimationComponent &animation)
Associates an animation component with the sprite.
const std::string getApplication() const
Gets the application name associated with the sprite.
const bool isAnimationSet() const
Checks if animation data is set.
void setClickedColor(const GUI::ECS::Systems::Colour &color)
Set the Clicked Color of the sprite.
const bool hasTicked()
A function to check if the frame has changed.
const GUI::ECS::Systems::Colour getNormalColor() const
Get the colour of the default state for the class.
void toggleVisibility()
Change the visibility of the sprite, if visible becomes invisible and vise versa.
const GUI::ECS::Systems::Colour getHoverColor() const
Get the colour of the hover state for the class.
void setName(const std::string &name)
Sets the name of the sprite.
const bool isStopped() const
Get the information about the state of the animation (stopped)
SpriteComponent & operator=(const GUI::ECS::Components::SpriteComponent ©)
Overloads the assignment operator to copy from another SpriteComponent.
void pause()
Pause the playing of the animation but does not reset the index to the default frame.
~SpriteComponent()
Destructor.
void setVisible(const bool visible)
Set the visible of the sprite.
const bool getVisible() const
Check if the sprite is set to be rendred or not.
void setApplication(const std::string &application)
Sets the application name (the name is based on the configuration file) associated with the sprite.
void setHoverColor(const GUI::ECS::Systems::Colour &color)
Set the Hover Color of the sprite.
void stop()
A function to stop the animation, and reset the index to the default frame.
const bool isSpritesheetSet() const
Checks if a spritesheet texture is set.
const std::string getName() const
Gets the name of the sprite.
void setCollision(const GUI::ECS::Systems::Collision ©)
Associates a collision component with the sprite.
void setDimension(const std::pair< float, float > &dim)
Set the dimensions of the sprite.
const GUI::ECS::Systems::Colour getClickedColor() const
Get the colour of the clicked state for the class.
std::any render() const
Renders the sprite to a window.
void setPosition(const std::pair< int, int > &pos)
Set the Position of the sprite.
const bool isLooping() const
Get the information about if the component is set to loop the animation.
const bool isCollisionSet() const
Checks if collision data is set.
void start()
Start the playing of the animation from the current index in memory.
void forceTick()
Updates the animation frame regardless of the delay.
const bool isPlaying() const
Get the information about the state of the animation (playing)
SpriteComponent()
Default constructor.
const GUI::ECS::Components::AnimationComponent getAnimation() const
Gets the animation component associated with the sprite.
const GUI::ECS::Components::TextureComponent getSpritesheet() const
Gets the texture component associated with the sprite.
const std::string getInfo(const unsigned int indent=0) const
This is a function meant for debugging purposes It will dump the current state of the variables upon ...
const bool hasLooped() const
A function to check if the animation has looped around (valid for the 1rst frame of the new loop)
void resume()
Resume the playing of the animation (has no effect if already playing)
const bool isPaused() const
Get the information about the state of the animation (paused)
const bool isVisible() const
Check if the sprite is set to be rendred or not.
Represents a texture component used in an entity component system.
Represents a rectangular component that can detect collisions and mouse interactions,...
A class for representing and manipulating colors using RGBA components. Inherits from EntityNode to a...
std::ostream & operator<<(std::ostream &os, const AnimationComponent &item)
Outputs the animation's info to a stream.