ECS component that holds a color value.
More...
#include <wColorComponent.hpp>
|
| ColorComponent (sf::Color color=sf::Color::Black) |
| Constructor with optional color.
|
virtual | ~ColorComponent ()=default |
sf::Color | getColor () const |
| Gets the current color.
|
void | setColor (sf::Color newColor) |
| Sets a new color.
|
void | debugPrint () const |
| Outputs the RGBA values of the color to standard output.
|
virtual | ~Component ()=default |
virtual void | enable () |
virtual void | disable () |
bool | isEnabled () const |
| Checks whether the component is currently active.
|
void | setParent (Entity *parent) |
| Sets the parent entity of this component.
|
Entity * | getParent () const |
| Returns the parent entity of this component.
|
|
| Component () |
| Protected constructor to restrict instantiation to derived classes.
|
ECS component that holds a color value.
This component stores an RGBA color (from SFML) associated with an entity. It can be used to define the rendering color of graphical elements.
Usage Examples:
- With predefined SFML colors:
addComponent< wEngine::ColorComponent >( sf::Color::Red );
- With a custom RGBA color:
sf::Color customColor(128, 64, 200, 255);
addComponent< wEngine::ColorComponent >( customColor );
- Author
- Wilfried Koch
- Copyright
- © 2025 Wilfried Koch. All rights reserved.
◆ ColorComponent()
wEngine::ColorComponent::ColorComponent |
( |
sf::Color | color = sf::Color::Black | ) |
|
Constructor with optional color.
- Parameters
-
color | The initial color (default is sf::Color::Black). |
◆ ~ColorComponent()
virtual wEngine::ColorComponent::~ColorComponent |
( |
| ) |
|
|
virtualdefault |
◆ getColor()
sf::Color wEngine::ColorComponent::getColor |
( |
| ) |
const |
|
nodiscard |
Gets the current color.
- Returns
- The color stored in the component.
◆ setColor()
void wEngine::ColorComponent::setColor |
( |
sf::Color | newColor | ) |
|
Sets a new color.
- Parameters
-
newColor | The new color to assign. |
◆ debugPrint()
void wEngine::ColorComponent::debugPrint |
( |
| ) |
const |
Outputs the RGBA values of the color to standard output.
The documentation for this class was generated from the following files: