wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wScaleComponent.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_SCALE_COMPONENT_HPP
9#define W_SCALE_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
34 {
35 public:
41 ScaleComponent( sf::Vector2f scale = { 1.0f, 1.0f } );
42
43 /*
44 * @brief Virtual destructor.
45 */
46 virtual ~ScaleComponent( ) = default;
47
52 [[nodiscard]] sf::Vector2f getScale( ) const;
53
59 void setScale( sf::Vector2f newScale );
60
64 void debugPrint( ) const;
65 private:
66 sf::Vector2f mScale;
67
73 void validatePositive( const sf::Vector2f& value ) const;
74 };
75
76}//End of namespace wEngine
77
78#endif
Component()
Protected constructor to restrict instantiation to derived classes.
Definition wComponent.cpp:17
void debugPrint() const
Outputs the scale to standard output for debugging.
Definition wScaleComponent.cpp:46
ScaleComponent(sf::Vector2f scale={ 1.0f, 1.0f })
Constructs a ScaleComponent with the given scale.
Definition wScaleComponent.cpp:17
void setScale(sf::Vector2f newScale)
Sets a new scale factor.
Definition wScaleComponent.cpp:34
sf::Vector2f getScale() const
Retrieves the current scale factor.
Definition wScaleComponent.cpp:29
virtual ~ScaleComponent()=default
Definition wColorComponent.cpp:9