17#include <SFML/Graphics/Rect.hpp>
18#include <SFML/Graphics/Vertex.hpp>
41 Collision(
const std::uint32_t entityId = 0,
const float width = 0,
const float height = 0,
const float positionX = 0,
const float positionY = 0);
50 void setPosition(
const std::pair<float, float> &position);
52 void setDimension(
const std::pair<float, float> &dimension);
58 void update(
const std::pair<int, int> &mousePosition);
89 const std::string
getInfo(
const unsigned int indent = 0)
const;
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 is the header file containing the class for the mouse information.
Defines a rectangle class (Rect) mimicking sf::Rect without relying on SFML.
Represents a rectangular component that can detect collisions and mouse interactions,...
void setPositionY(const float &posY)
Sets the Y-coordinate of the component's position and updates collision data.
const std::pair< float, float > getDimension() const
Get the dimension of the item in the form of an sf::Vector2i.
void setHeight(const float &height)
Sets the height of the component and updates collision data.
const bool isClicked() const
Checks if the component is clicked by the mouse.
void updateMouseInfo(const GUI::ECS::Systems::MouseInfo &mouse)
Updates the mouse info object used for collision checks.
void setWidth(const float &width)
Sets the width of the component and updates collision data.
void _updateMouseCollisionData()
Updates the mouse collision data, setting hover and click states.
const float getWidth() const
Gets the width of the component.
void setDimension(const std::pair< float, float > &dimension)
Set the dimension of the object.
void update(const std::pair< int, int > &mousePosition)
Update the mouse info object used for mouse tracking.
const float getHeight() const
Gets the height of the component.
~Collision()
Default destructor.
const bool isColliding(const Collision &itemTwo) const
Checks if this component is colliding with another Collision.
void setPositionX(const float &posX)
Sets the X-coordinate of the component's position and updates collision data.
const Recoded::FloatRect getGeometry() const
This is the function in charge of returning the coordinates in the form of an sf::FloatRect.
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 std::pair< float, float > getPosition() const
Get the position of the item in the form of an sf::Vector2i.
const float getPositionY() const
Gets the Y-coordinate of the component's position.
void setMousePosition(const std::pair< int, int > &position)
Updates the mouse position for collision checks.
const GUI::ECS::Systems::MouseInfo getMouseInfo() const
This is the function in charge of returning the MouseInfo class instance.
void setGeometry(const Recoded::FloatRect &rect)
Set the dimensions of the object using the FloatRect recode.
Collision(const std::uint32_t entityId=0, const float width=0, const float height=0, const float positionX=0, const float positionY=0)
Constructs a Collision with the specified dimensions and position.
GUI::ECS::Systems::MouseInfo _mouse
void setPosition(const std::pair< float, float > &position)
Set the position of the object.
const float getPositionX() const
Gets the X-coordinate of the component's position.
const bool isHovered() const
Checks if the component is currently hovered by the mouse.
Collision & operator=(const GUI::ECS::Systems::Collision ©)
This is the overload in charge of allowing the user to update their variables using the = sign.
A generic 2D rectangle class that holds position and size as pairs.
const Collision operator+(Collision left, Collision right)
Adds two collision components component-wise.
const Collision & operator+=(Collision &left, Collision right)
Adds another collision component to the current collision component component-wise.
const Collision operator-(Collision left, Collision right)
Subtracts two collision components component-wise.
const Collision operator*(Collision left, Collision right)
Multiplies two collision components component-wise.
const bool operator==(Collision left, Collision right)
Compares two collision components for equality.
const bool operator!=(Collision left, Collision right)
Compares two collision components for inequality.
std::ostream & operator<<(std::ostream &os, const Clock &item)
Outputs the clock's info to a stream.
const Collision & operator*=(Collision &left, Collision right)
Multiplies another collision component with the current collision component component-wise.
const Collision & operator-=(Collision &left, Collision right)
Subtracts another collision component from the current collision component component-wise.