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

ECS component that defines the length of a drawable object. More...

#include <wLengthComponent.hpp>

Inheritance diagram for wEngine::LengthComponent:
Inheritance graph

Public Member Functions

 LengthComponent (float length=2.0f)
 Constructs the component with an initial positive length.
virtual ~LengthComponent ()=default
float getLength () const
 Returns the current length.
void setLength (float newLength)
 Sets a new length value.
void debugPrint () const
 Outputs the current length value to the console for debugging.
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 defines the length of a drawable object.

This component stores a positive float value representing the length (in pixels) of lines or shapes. The value must be strictly positive.

Exceptions
std::invalid_argumentif the value is zero or negative.
Author
Wilfried Koch

Constructor & Destructor Documentation

◆ LengthComponent()

wEngine::LengthComponent::LengthComponent ( float length = 2.0f)

Constructs the component with an initial positive length.

Parameters
lengthInitial length value (default is 2.0f).
Exceptions
std::invalid_argumentif the value is zero or negative.

◆ ~LengthComponent()

virtual wEngine::LengthComponent::~LengthComponent ( )
virtualdefault

Member Function Documentation

◆ getLength()

float wEngine::LengthComponent::getLength ( ) const
nodiscard

Returns the current length.

Returns
A positive float representing the line length (in pixels).

◆ setLength()

void wEngine::LengthComponent::setLength ( float newLength)

Sets a new length value.

Parameters
newLengthA strictly positive float.
Exceptions
std::invalid_argumentif the value is zero or negative.

◆ debugPrint()

void wEngine::LengthComponent::debugPrint ( ) const

Outputs the current length value to the console for debugging.


The documentation for this class was generated from the following files: