wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wEngine::ColorComponent Class Reference

ECS component that holds a color value. More...

#include <wColorComponent.hpp>

Inheritance diagram for wEngine::ColorComponent:
Inheritance graph

Public Member Functions

 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.
Public Member Functions inherited from wEngine::Component
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.
EntitygetParent () const
 Returns the parent entity of this component.

Additional Inherited Members

Protected Member Functions inherited from wEngine::Component
 Component ()
 Protected constructor to restrict instantiation to derived classes.

Detailed Description

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); // R, G, B, A
    addComponent< wEngine::ColorComponent >( customColor );
Author
Wilfried Koch

Constructor & Destructor Documentation

◆ ColorComponent()

wEngine::ColorComponent::ColorComponent ( sf::Color color = sf::Color::Black)

Constructor with optional color.

Parameters
colorThe initial color (default is sf::Color::Black).

◆ ~ColorComponent()

virtual wEngine::ColorComponent::~ColorComponent ( )
virtualdefault

Member Function Documentation

◆ 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
newColorThe 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: