19#include <SFML/Graphics/Sprite.hpp>
103 ImageComponent(
const std::uint32_t entityId,
const GUI::ECS::Components::TextureComponent &imageTexture, std::pair<unsigned int, unsigned int> dimensions,
const std::pair<float, float> &position,
const GUI::ECS::Systems::Colour &normalColor =
GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour &hoverColor =
GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour &clickedColor =
GUI::ECS::Systems::Colour::White,
const std::string &name =
"",
const std::string &application =
"");
113 ImageComponent(
const std::uint32_t entityId,
const std::string &imagePath,
const std::string &name =
"",
const std::string &application =
"");
123 ImageComponent(
const std::uint32_t entityId,
const std::string &imagePath, std::pair<unsigned int, unsigned int> dimensions,
const std::string &name =
"",
const std::string &application =
"");
150 ImageComponent(
const std::uint32_t entityId,
const std::string &imagePath, std::pair<unsigned int, unsigned int> dimensions,
const std::pair<float, float> &position,
const GUI::ECS::Systems::Colour &normalColor =
GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour &hoverColor =
GUI::ECS::Systems::Colour::White,
const GUI::ECS::Systems::Colour &clickedColor =
GUI::ECS::Systems::Colour::White,
const std::string &name =
"",
const std::string &application =
"");
162 void setName(
const std::string &name);
203 void setImage(
const std::string &path,
const std::string &name =
"");
210 void setDimension(
const std::pair<float, float> &dimension);
217 void setPosition(
const std::pair<int, int> &position);
261 const std::string
getName()
const;
336 const std::string
getInfo(
const unsigned int indent = 0)
const;
385 void _initialiseImage();
391 void _processColour();
397 void _processImageComponent();
400 bool _visible =
true;
401 bool _levelBackground =
false;
402 bool _sizeAltered =
false;
403 bool _inConstructor =
true;
404 bool _textureAltered =
false;
405 bool _positionAltered =
false;
406 std::string _name =
"";
407 std::string _application =
"";
408 std::optional<sf::Sprite> _sfImage;
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...
Defines a rectangle class (Rect) mimicking sf::Rect without relying on SFML.
This file contains the declaration of the TextureComponent class which manages textures.
Represents an image component in the GUI ECS system.
void setHoverColor(const GUI::ECS::Systems::Colour &color)
Sets the hover color of the image.
~ImageComponent()
Destructor for ImageComponent.
void setClickedColor(const GUI::ECS::Systems::Colour &color)
Sets the clicked color of the image.
std::any render() const
Renders the image to the given window.
void setName(const std::string &name)
Set the Name of the image.
const std::string getName() const
Get the Name of the image.
const GUI::ECS::Systems::Colour getHoverColor() const
Retrieves the hover color of the image.
void setPosition(const std::pair< int, int > &position)
Sets the position of the image.
void setApplication(const std::string &application)
Set the Application (the context) of the image.
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 GUI::ECS::Systems::Collision getCollision() const
Get the Collision object.
GUI::ECS::Components::ImageComponent & operator=(const GUI::ECS::Components::ImageComponent ©)
Assigns values from another ImageComponent.
const std::pair< int, int > getPosition() const
Get the Position of the image.
const GUI::ECS::Systems::Colour getNormalColor() const
Retrieves the normal color of the image.
const bool isVisible() const
Get the visibility state of the Image.
void update(const GUI::ECS::Systems::MouseInfo &mouse)
Updates the image based on mouse interactions.
void setLevelBackgroundCompatible(const bool levelBackground)
Set the Level Background Compatible variable.
const bool isLevelBackgroundCompatible() const
Know if the background can be used as a level bacground.
void setImage(const GUI::ECS::Components::TextureComponent &image, const std::string &name="")
Assigns a texture to the image component.
const GUI::ECS::Systems::Colour getClickedColor() const
Retrieves the clicked color of the image.
const bool getLevelBackgroundCompatibility() const
Get the Level Background Compatibility object.
const bool getVisible() const
Get the Visibility of the text.
void setDimension(const std::pair< float, float > &dimension)
Sets the dimensions of the image.
const std::pair< float, float > getDimension() const
Get the Size of the text.
void toggleVisibility()
Toggles the visibility of the image.
const GUI::ECS::Components::TextureComponent getImage() const
Retrieves the texture associated with the image.
void setNormalColor(const GUI::ECS::Systems::Colour &color)
Sets the normal color of the image.
void setVisible(const bool visible)
Set the visibility of the object using a boolean.
const std::string getApplication() const
Get the Application of the image.
ImageComponent()
Default constructor. Initializes the ImageComponent with default values.
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...
static const Colour White
std::ostream & operator<<(std::ostream &os, const AnimationComponent &item)
Outputs the animation's info to a stream.