![]() |
R-Type
2
Doom but in better
|
Represents an image component in the GUI ECS system. More...
#include <ImageComponent.hpp>
Public Member Functions | |
ImageComponent () | |
Default constructor. Initializes the ImageComponent with default values. | |
ImageComponent (const std::uint32_t entityId) | |
Constructor with an entity ID. | |
ImageComponent (const std::uint32_t entityId, const GUI::ECS::Components::TextureComponent &imageTexture, const std::string &name="", const std::string &application="") | |
Constructor with an entity ID and an image path. | |
ImageComponent (const std::uint32_t entityId, const GUI::ECS::Components::TextureComponent &imageTexture, std::pair< unsigned int, unsigned int > dimensions, const std::string &name="", const std::string &application="") | |
Constructor with an entity ID, font path, text content, and font size. | |
ImageComponent (const std::uint32_t entityId, const GUI::ECS::Components::TextureComponent &imageTexture, std::pair< unsigned int, unsigned int > dimensions, const GUI::ECS::Systems::Colour &normalColor, 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="") | |
Constructor with detailed parameters. | |
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="") | |
Constructor with full parameter specification. | |
ImageComponent (const std::uint32_t entityId, const std::string &imagePath, const std::string &name="", const std::string &application="") | |
Constructor with an entity ID and an image path. | |
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="") | |
Constructor with an entity ID, font path, text content, and font size. | |
ImageComponent (const std::uint32_t entityId, const std::string &imagePath, std::pair< unsigned int, unsigned int > dimensions, const GUI::ECS::Systems::Colour &normalColor, 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="") | |
Constructor with detailed parameters. | |
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="") | |
Constructor with full parameter specification. | |
~ImageComponent () | |
Destructor for ImageComponent. | |
void | setName (const std::string &name) |
Set the Name of the image. | |
void | setApplication (const std::string &application) |
Set the Application (the context) of the image. | |
void | setNormalColor (const GUI::ECS::Systems::Colour &color) |
Sets the normal color of the image. | |
void | setHoverColor (const GUI::ECS::Systems::Colour &color) |
Sets the hover color of the image. | |
void | setClickedColor (const GUI::ECS::Systems::Colour &color) |
Sets the clicked color of the image. | |
void | setImage (const GUI::ECS::Components::TextureComponent &image, const std::string &name="") |
Assigns a texture to the image component. | |
void | setImage (const std::string &path, const std::string &name="") |
Loads and assigns an image from a file path. | |
void | setDimension (const std::pair< float, float > &dimension) |
Sets the dimensions of the image. | |
void | setPosition (const std::pair< int, int > &position) |
Sets the position of the image. | |
void | setVisible (const bool visible) |
Set the visibility of the object using a boolean. | |
void | setLevelBackgroundCompatible (const bool levelBackground) |
Set the Level Background Compatible variable. | |
void | toggleVisibility () |
Toggles the visibility of the image. | |
const bool | isVisible () const |
Get the visibility state of the Image. | |
const bool | isLevelBackgroundCompatible () const |
Know if the background can be used as a level bacground. | |
const std::string | getName () const |
Get the Name of the image. | |
const std::string | getApplication () const |
Get the Application of the image. | |
const GUI::ECS::Components::TextureComponent | getImage () const |
Retrieves the texture associated with the image. | |
const GUI::ECS::Systems::Colour | getNormalColor () const |
Retrieves the normal color of the image. | |
const GUI::ECS::Systems::Colour | getHoverColor () const |
Retrieves the hover color of the image. | |
const GUI::ECS::Systems::Colour | getClickedColor () const |
Retrieves the clicked color of the image. | |
const std::pair< float, float > | getDimension () const |
Get the Size of the text. | |
const std::pair< int, int > | getPosition () const |
Get the Position of the image. | |
const bool | getVisible () const |
Get the Visibility of the text. | |
const GUI::ECS::Systems::Collision | getCollision () const |
Get the Collision object. | |
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 call. It will dump them for itself and any of it's underlying classes. | |
const bool | getLevelBackgroundCompatibility () const |
Get the Level Background Compatibility object. | |
std::any | render () const |
Renders the image to the given window. | |
void | update (const GUI::ECS::Systems::MouseInfo &mouse) |
Updates the image based on mouse interactions. | |
void | update (const GUI::ECS::Components::ImageComponent ©) |
Updates this ImageComponent with values from another instance. | |
GUI::ECS::Components::ImageComponent & | operator= (const GUI::ECS::Components::ImageComponent ©) |
Assigns values from another ImageComponent. | |
![]() | |
EntityNode (const size_t entityId=0) | |
virtual | ~EntityNode ()=default |
virtual size_t | getEntityNodeId () const |
Additional Inherited Members | |
![]() | |
size_t | _entityID |
Represents an image component in the GUI ECS system.
This component manages textures, colors, dimensions, and positioning for rendering images within the ECS framework.
Definition at line 43 of file ImageComponent.hpp.
GUI::ECS::Components::ImageComponent::ImageComponent | ( | ) |
Default constructor. Initializes the ImageComponent with default values.
Definition at line 16 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent::ImageComponent | ( | const std::uint32_t | entityId | ) |
Constructor with an entity ID.
entityId | The ID of the associated entity. |
Definition at line 22 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent::ImageComponent | ( | const std::uint32_t | entityId, |
const GUI::ECS::Components::TextureComponent & | imageTexture, | ||
const std::string & | name = "", | ||
const std::string & | application = "" ) |
Constructor with an entity ID and an image path.
entityId | The ID of the associated entity. |
imageTexture | The texture for the image |
name | The name of the image |
application | The application (context) of the image |
Definition at line 28 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent::ImageComponent | ( | const std::uint32_t | entityId, |
const GUI::ECS::Components::TextureComponent & | imageTexture, | ||
std::pair< unsigned int, unsigned int > | dimensions, | ||
const std::string & | name = "", | ||
const std::string & | application = "" ) |
Constructor with an entity ID, font path, text content, and font size.
entityId | The ID of the entity this component is associated with. |
imageTexture | The texture for the image |
dimension | The dimension of the image. |
name | The name of the image |
application | The application (context) of the image |
Definition at line 39 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent::ImageComponent | ( | const std::uint32_t | entityId, |
const GUI::ECS::Components::TextureComponent & | imageTexture, | ||
std::pair< unsigned int, unsigned int > | dimensions, | ||
const GUI::ECS::Systems::Colour & | normalColor, | ||
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 = "" ) |
Constructor with detailed parameters.
entityId | The ID of the entity this component is associated with. |
imageTexture | The texture for the image |
dimension | The dimension of the image. |
normalColor | The normal color of the text. |
hoverColor | The color of the text when hovered. |
clickedColor | The color of the text when clicked. |
name | The name of the image |
application | The application (context) of the image |
Definition at line 51 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent::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 = "" ) |
Constructor with full parameter specification.
entityId | The ID of the entity this component is associated with. |
imageTexture | The texture for the image |
dimension | The dimension of the image. |
position | The position of the text in 2D space. |
normalColor | The normal color of the text. |
hoverColor | The color of the text when hovered. |
clickedColor | The color of the text when clicked. |
name | The name of the image |
application | The application (context) of the image |
Definition at line 66 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent::ImageComponent | ( | const std::uint32_t | entityId, |
const std::string & | imagePath, | ||
const std::string & | name = "", | ||
const std::string & | application = "" ) |
Constructor with an entity ID and an image path.
entityId | The ID of the associated entity. |
imagePath | The texture for the image |
name | The name of the image |
application | The application (context) of the image |
Definition at line 82 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent::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 = "" ) |
Constructor with an entity ID, font path, text content, and font size.
entityId | The ID of the entity this component is associated with. |
imagePath | The texture for the image |
dimension | The dimension of the image. |
name | The name of the image |
application | The application (context) of the image |
Definition at line 93 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent::ImageComponent | ( | const std::uint32_t | entityId, |
const std::string & | imagePath, | ||
std::pair< unsigned int, unsigned int > | dimensions, | ||
const GUI::ECS::Systems::Colour & | normalColor, | ||
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 = "" ) |
Constructor with detailed parameters.
entityId | The ID of the entity this component is associated with. |
imagePath | The texture for the image |
dimension | The dimension of the image. |
normalColor | The normal color of the text. |
hoverColor | The color of the text when hovered. |
clickedColor | The color of the text when clicked. |
name | The name of the image |
application | The application (context) of the image |
Definition at line 105 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent::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 = "" ) |
Constructor with full parameter specification.
entityId | The ID of the entity this component is associated with. |
imagePath | The texture for the image |
dimension | The dimension of the image. |
position | The position of the text in 2D space. |
normalColor | The normal color of the text. |
hoverColor | The color of the text when hovered. |
clickedColor | The color of the text when clicked. |
name | The name of the image |
application | The application (context) of the image |
Definition at line 120 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent::~ImageComponent | ( | ) |
Destructor for ImageComponent.
Definition at line 137 of file ImageComponent.cpp.
const std::string GUI::ECS::Components::ImageComponent::getApplication | ( | ) | const |
Get the Application of the image.
Definition at line 241 of file ImageComponent.cpp.
const GUI::ECS::Systems::Colour GUI::ECS::Components::ImageComponent::getClickedColor | ( | ) | const |
Retrieves the clicked color of the image.
Definition at line 261 of file ImageComponent.cpp.
const GUI::ECS::Systems::Collision GUI::ECS::Components::ImageComponent::getCollision | ( | ) | const |
Get the Collision object.
Definition at line 281 of file ImageComponent.cpp.
const std::pair< float, float > GUI::ECS::Components::ImageComponent::getDimension | ( | ) | const |
Get the Size of the text.
Definition at line 266 of file ImageComponent.cpp.
const GUI::ECS::Systems::Colour GUI::ECS::Components::ImageComponent::getHoverColor | ( | ) | const |
Retrieves the hover color of the image.
Definition at line 256 of file ImageComponent.cpp.
const GUI::ECS::Components::TextureComponent GUI::ECS::Components::ImageComponent::getImage | ( | ) | const |
Retrieves the texture associated with the image.
Definition at line 246 of file ImageComponent.cpp.
const std::string GUI::ECS::Components::ImageComponent::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 call. It will dump them for itself and any of it's underlying classes.
indent | The level to which the class should be indented in the dump. |
Definition at line 286 of file ImageComponent.cpp.
const bool GUI::ECS::Components::ImageComponent::getLevelBackgroundCompatibility | ( | ) | const |
Get the Level Background Compatibility object.
isLevelBackgroundCompatible
for the same effect. Definition at line 310 of file ImageComponent.cpp.
const std::string GUI::ECS::Components::ImageComponent::getName | ( | ) | const |
Get the Name of the image.
Definition at line 236 of file ImageComponent.cpp.
const GUI::ECS::Systems::Colour GUI::ECS::Components::ImageComponent::getNormalColor | ( | ) | const |
Retrieves the normal color of the image.
Definition at line 251 of file ImageComponent.cpp.
const std::pair< int, int > GUI::ECS::Components::ImageComponent::getPosition | ( | ) | const |
Get the Position of the image.
Definition at line 271 of file ImageComponent.cpp.
const bool GUI::ECS::Components::ImageComponent::getVisible | ( | ) | const |
Get the Visibility of the text.
Definition at line 276 of file ImageComponent.cpp.
const bool GUI::ECS::Components::ImageComponent::isLevelBackgroundCompatible | ( | ) | const |
Know if the background can be used as a level bacground.
Definition at line 231 of file ImageComponent.cpp.
const bool GUI::ECS::Components::ImageComponent::isVisible | ( | ) | const |
Get the visibility state of the Image.
Definition at line 226 of file ImageComponent.cpp.
GUI::ECS::Components::ImageComponent & GUI::ECS::Components::ImageComponent::operator= | ( | const GUI::ECS::Components::ImageComponent & | copy | ) |
Assigns values from another ImageComponent.
copy | The source ImageComponent. |
Definition at line 354 of file ImageComponent.cpp.
std::any GUI::ECS::Components::ImageComponent::render | ( | ) | const |
Renders the image to the given window.
Definition at line 315 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::setApplication | ( | const std::string & | application | ) |
Set the Application (the context) of the image.
application |
Definition at line 144 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::setClickedColor | ( | const GUI::ECS::Systems::Colour & | color | ) |
Sets the clicked color of the image.
color | The clicked color. |
Definition at line 159 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::setDimension | ( | const std::pair< float, float > & | dimension | ) |
Sets the dimensions of the image.
dimension | The new dimensions as a pair (width, height). |
Definition at line 187 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::setHoverColor | ( | const GUI::ECS::Systems::Colour & | color | ) |
Sets the hover color of the image.
color | The hover color. |
Definition at line 154 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::setImage | ( | const GUI::ECS::Components::TextureComponent & | image, |
const std::string & | name = "" ) |
Assigns a texture to the image component.
image | The texture component. |
name | An optional name for the image. |
Definition at line 164 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::setImage | ( | const std::string & | path, |
const std::string & | name = "" ) |
Loads and assigns an image from a file path.
path | Path to the image file. |
name | An optional name for the image. |
Definition at line 176 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::setLevelBackgroundCompatible | ( | const bool | levelBackground | ) |
Set the Level Background Compatible variable.
levelBackground |
Definition at line 212 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::setName | ( | const std::string & | name | ) |
void GUI::ECS::Components::ImageComponent::setNormalColor | ( | const GUI::ECS::Systems::Colour & | color | ) |
Sets the normal color of the image.
color | The normal color. |
Definition at line 149 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::setPosition | ( | const std::pair< int, int > & | position | ) |
Sets the position of the image.
position | The new position as a pair (x, y). |
Definition at line 197 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::setVisible | ( | const bool | visible | ) |
Set the visibility of the object using a boolean.
visible | The boolean value |
Definition at line 207 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::toggleVisibility | ( | ) |
Toggles the visibility of the image.
Definition at line 217 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::update | ( | const GUI::ECS::Components::ImageComponent & | copy | ) |
Updates this ImageComponent with values from another instance.
copy | The source ImageComponent. |
Definition at line 330 of file ImageComponent.cpp.
void GUI::ECS::Components::ImageComponent::update | ( | const GUI::ECS::Systems::MouseInfo & | mouse | ) |
Updates the image based on mouse interactions.
mouse | The mouse information. |
Definition at line 324 of file ImageComponent.cpp.