17 :
EntityNode(entityId), _callback(nullptr), _componentText(entityId), _componentShape(entityId)
20 _textSize = _componentText.
getSize();
24 :
EntityNode(0), _componentText(0), _componentShape(
std::uint32_t(0))
26 _componentText.
update(textItem);
27 _componentShape.
update(shapeItem);
29 _textSize = _componentText.
getSize();
33 :
EntityNode(0), _componentText(0), _componentShape(
std::uint32_t(0)), _callback(callback)
35 _componentText.
update(textItem);
36 _componentShape.
update(shapeItem);
38 _textSize = _componentText.
getSize();
42 :
EntityNode(0), _componentText(0), _componentShape(
std::uint32_t(0))
44 _componentText.
update(textItem);
45 _componentShape.
update(shapeItem);
50 :
EntityNode(0), _componentText(0), _componentShape(
std::uint32_t(0)), _callback(callback)
52 _componentText.
update(textItem);
53 _componentShape.
update(shapeItem);
59 :
EntityNode(entityId), _componentText(entityId), _componentShape(entityId)
61 _componentText.
update(textItem);
62 _componentShape.
update(shapeItem);
64 _textSize = _componentText.
getSize();
68 :
EntityNode(entityId), _componentText(entityId), _componentShape(entityId), _callback(callback)
70 _componentText.
update(textItem);
71 _componentShape.
update(shapeItem);
73 _textSize = _componentText.
getSize();
77 :
EntityNode(entityId), _componentText(entityId), _componentShape(entityId)
79 _componentText.
update(textItem);
80 _componentShape.
update(shapeItem);
85 :
EntityNode(entityId), _componentText(entityId), _componentShape(entityId), _callback(callback)
87 _componentText.
update(textItem);
88 _componentShape.
update(shapeItem);
96 _componentShape.setHoverColor(hoverColor);
101 _componentShape.setNormalColor(normalColor);
106 _componentShape.setClickedColor(clickedColor);
110 _componentText.setHoverColor(hoverColor);
115 _componentText.setNormalColor(normalColor);
120 _componentText.setClickedColor(clickedColor);
125 _componentText.setText(text);
130 _componentText.setPosition(position);
131 _componentShape.setPosition(position);
137 _componentText.setSize(textSize);
138 _componentShape.setDimension(dimension);
143 _componentText.setPosition(position);
149 if (_textSize == textSize) {
152 _componentText.setSize(textSize);
153 _textSize = textSize;
158 _componentShape.setPosition(position);
163 _componentShape.setDimension(dimension);
170 if (_collision.isClicked()) {
177 _callback = callback;
178 _callbackName = callbackName;
184 _componentText.setVisible(visible);
185 _componentShape.setVisible(visible);
195 _application = application;
212 _componentText.setVisible(
false);
213 _componentShape.setVisible(
false);
216 _componentText.setVisible(
true);
217 _componentShape.setVisible(
true);
223 return _componentShape.getClickedColor();
228 return _componentShape.getNormalColor();
233 return _componentShape.getHoverColor();
237 return _componentText.getClickedColor();
242 return _componentText.getNormalColor();
247 return _componentText.getHoverColor();
257 return _collision.getPosition();
262 return _collision.getDimension();
267 return _componentText.getPosition();
272 return _componentShape.getPosition();
277 return _componentShape.getDimension();
287 return _callbackName;
312 return _componentText;
317 return _componentShape;
324 std::string indentation =
"";
325 for (
unsigned int i = 0; i < indent; ++i) {
328 std::string result = indentation +
"Button:\n";
331 result += indentation +
"- Name: " + _name +
"\n";
332 result += indentation +
"- Application: " + _application +
"\n";
333 result += indentation +
"- Callback: " + _callbackName +
"\n";
334 result += indentation +
"- Text: {\n" + _componentText.
getInfo(indent + 1) + indentation +
"}\n";
335 result += indentation +
"- Shape: {\n" + _componentShape.getInfo(indent + 1) + indentation +
"}\n";
337 result += indentation +
"- Collision: {\n" + _collision.getInfo(indent + 1) + indentation +
"}\n";
343 _collision.update(mouse);
344 _componentText.update(mouse);
345 _componentShape.update(mouse);
346 if (_collision.isClicked() || _componentShape.getCollision().isClicked() || _componentText.getCollision().isClicked()) {
353 _componentText = copy;
358 _componentShape = copy;
374 std::unordered_map<std::type_index, std::any> result;
Manages shapes and their associated properties in the ECS framework.
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 update(const GUI::ECS::Systems::MouseInfo &mouse)
Update the mouse information of the component (this is used for mouse collision calculations)
const GUI::ECS::Systems::Collision getCollision() const
Get the Collision Component of the object.
A class that represents a text component in the GUI system. It manages font, size,...
const std::uint32_t getSize() const
Get the Size of the text.
void update(const GUI::ECS::Systems::MouseInfo &mouse)
The function in charge of updating the stored mouse information.
Represents a rectangular component that can detect collisions and mouse interactions,...
const std::pair< float, float > getDimension() const
Get the dimension of the item in the form of an sf::Vector2i.
const std::pair< float, float > getPosition() const
Get the position of the item in the form of an sf::Vector2i.
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.
const std::string myToString(const Rect< RectType > &rectangle)
Converts a Rect<T> object to its string representation.