wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wLengthComponent.hpp
Go to the documentation of this file.
1/*
2+---------------------------------------------------------------------------------------------------------------------------------------------------+
3Created by Wilfried Koch.
4Copyright @ 2025 Wilfried Koch. All rights reserved.
5+---------------------------------------------------------------------------------------------------------------------------------------------------+
6*/
7
8#ifndef W_LENGTH_COMPONENT_HPP
9#define W_LENGTH_COMPONENT_HPP
10
12
13#pragma GCC diagnostic push
14#pragma GCC diagnostic ignored "-Wfloat-equal"
15#pragma GCC diagnostic ignored "-Wswitch-default"
16#include <SFML/Graphics.hpp>
17#pragma GCC diagnostic pop
18
19namespace wEngine
20{
21
36 {
37 public:
43 LengthComponent( float length = 2.0f );
44
45 /*
46 * @brief Virtual destructor.
47 */
48 virtual ~LengthComponent( ) = default;
49
54 [[nodiscard]] float getLength( ) const;
55
61 void setLength( float newLength );
62
66 void debugPrint( ) const;
67 private:
68 float mLength;
69
75 void validatePositive( float value ) const;
76 };
77
78}//End of namespace wEngine
79
80#endif
Component()
Protected constructor to restrict instantiation to derived classes.
Definition wComponent.cpp:17
void debugPrint() const
Outputs the current length value to the console for debugging.
Definition wLengthComponent.cpp:50
void setLength(float newLength)
Sets a new length value.
Definition wLengthComponent.cpp:38
LengthComponent(float length=2.0f)
Constructs the component with an initial positive length.
Definition wLengthComponent.cpp:21
float getLength() const
Returns the current length.
Definition wLengthComponent.cpp:33
virtual ~LengthComponent()=default
Definition wColorComponent.cpp:9