18#include <SFML/Graphics/Text.hpp>
19#include <SFML/Graphics/Font.hpp>
20#include <SFML/Graphics/Color.hpp>
44 class TextComponent :
public EntityNode {
63 TextComponent(
const std::uint32_t entityId,
const std::string &fontPath);
71 TextComponent(
const std::uint32_t entityId,
const std::string &fontPath,
const std::string &text);
80 TextComponent(
const std::uint32_t entityId,
const std::string &fontPath,
const std::string &text,
const unsigned int &size);
192 void setText(
const std::string &text);
199 void setSize(
const std::uint32_t &size);
209 void setFontPath(
const std::string &fontPath,
const std::string &name =
"");
216 void setPosition(
const std::pair<float, float> &position);
232 void setName(
const std::string &name);
294 const std::string
getText()
const;
301 const std::uint32_t
getSize()
const;
326 const std::string
getInfo(
const unsigned int indent = 0)
const;
340 const std::string
getName()
const;
383 void _initialiseText();
388 void _processTextComponent();
396 bool _visible =
true;
397 bool _fontAltered =
false;
398 bool _fontChanged =
false;
399 bool _textAltered =
false;
400 bool _sizeAltered =
false;
401 bool _inConstructor =
true;
402 bool _positionAltered =
false;
403 std::string _text =
"SampleText";
404 std::string _textName =
"text";
405 std::string _textApplication =
"text";
406 unsigned int _size = 30;
407 std::optional<sf::Text> _sfTextComponent;
422 std::ostream &
operator<<(std::ostream &os,
const TextComponent &item);
This is the file that links the EntityNode children.
Header file for the Font class, responsible for managing fonts within the program.
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...
A class that represents a text component in the GUI system. It manages font, size,...
const GUI::ECS::Systems::Colour getHoverColor() const
Get the Hover Color of the text.
void setName(const std::string &name)
Set the Name of the component.
const std::string getFontPath() const
Get the Font Path object.
void setFontPath(const std::string &fontPath, const std::string &name="")
Set the font from a path (this will attempt to load the font internally)
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 ...
void setPosition(const std::pair< float, float > &position)
Set the Position of the text.
~TextComponent()
Destructor for TextComponent.
const std::string getText() const
Get the Text that was set in the class.
void toggleVisibility()
Toggle the visibility of the object. hidden.
void setVisible(const bool visible)
Set the visibility of the object using a boolean.
TextComponent()
Default constructor. Initializes the text component with default values.
const GUI::ECS::Systems::Collision getCollision() const
Function in charge of returning the collision instance of the text component.
const std::string getApplication() const
Get the Application context of the component.
const std::string getName() const
Get the Name text component.
const GUI::ECS::Systems::Colour getNormalColor() const
Get the Normal Color of the text.
const GUI::ECS::Systems::Colour getClickedColor() const
Get the Clicked Color of the text.
const bool getVisible() const
Get the Visibility of the text.
const bool isVisible() const
Check if the text is set to be rendered or not.
void setApplication(const std::string &application)
Set the application context of the component.
const std::uint32_t getSize() const
Get the Size of the text.
std::any render() const
Function in charge of rendering the text if it is set to visible, otherwise, does nothing.
void setNormalColor(const GUI::ECS::Systems::Colour &color)
Set the default colour of the text object.
void setFont(const GUI::ECS::Systems::Font &font)
Set the Font of the text using a loaded Font instance from GUI::ECS::Systems::Font.
void update(const GUI::ECS::Systems::MouseInfo &mouse)
The function in charge of updating the stored mouse information.
void setHoverColor(const GUI::ECS::Systems::Colour &color)
Set the Hover Color of the text object.
void setText(const std::string &text)
Set the Text.
void setSize(const std::uint32_t &size)
Set the Size of the text.
void setClickedColor(const GUI::ECS::Systems::Colour &color)
Set the Clicked Color of the text object.
const GUI::ECS::Systems::Font getFont() const
Get the Font object contained in the class.
const std::pair< float, float > getPosition() const
Get the Position of the text.
GUI::ECS::Components::TextComponent & operator=(const GUI::ECS::Components::TextComponent ©)
The overload in charge of allowing a TextComponent update using the '=' sign.
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 Black
Manages font entities in the GUI ECS.
std::ostream & operator<<(std::ostream &os, const AnimationComponent &item)
Outputs the animation's info to a stream.