wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wOffsetComponent.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_OFFSET_COMPONENT_HPP
9#define W_OFFSET_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
41 {
42 public:
47 OffsetComponent( sf::Vector2f offset = sf::Vector2f( 0.0f, 0.0f ) );
48
49 /*
50 * @brief Virtual destructor.
51 */
52 virtual ~OffsetComponent( ) = default;
53
58 [[nodiscard]] sf::Vector2f getOffset( ) const;
59
64 void setOffset( sf::Vector2f offset );
65
70 void addOffset( sf::Vector2f delta );
71
75 void debugPrint( ) const;
76 private:
77 sf::Vector2f mOffset;
78 };
79
80}//End of namespace wEngine
81
82#endif
Component()
Protected constructor to restrict instantiation to derived classes.
Definition wComponent.cpp:17
OffsetComponent(sf::Vector2f offset=sf::Vector2f(0.0f, 0.0f))
Constructs the component with an optional offset.
Definition wOffsetComponent.cpp:17
virtual ~OffsetComponent()=default
sf::Vector2f getOffset() const
Returns the current offset.
Definition wOffsetComponent.cpp:29
void setOffset(sf::Vector2f offset)
Updates the logical offset value.
Definition wOffsetComponent.cpp:34
void debugPrint() const
Outputs the current offset value to the console for debugging.
Definition wOffsetComponent.cpp:56
void addOffset(sf::Vector2f delta)
Increments the current offset by a given vector.
Definition wOffsetComponent.cpp:45
Definition wColorComponent.cpp:9