wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wFrameEntity.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_FRAME_ENTITY_HPP
9#define W_FRAME_ENTITY_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/System/Vector2.hpp>
17#include <SFML/Graphics.hpp>
18#pragma GCC diagnostic pop
19
20namespace wPlot2D
21{
22
23
43 {
44 public:
49 FrameEntity( bool enabled = true );
50
54 virtual ~FrameEntity( ) = default;
55
60 void setEnabled( bool enabled );
61
66 [[nodiscard]] bool isEnabled( ) const;
67
72 [[nodiscard]] sf::Color getFillColor( ) const;
73
78 [[nodiscard]] sf::Color getOutlineColor( ) const;
79
84 [[nodiscard]] float getThickness( ) const;
85
90 [[nodiscard]] sf::Vector2f getPadding( ) const;
91
96 void setFillColor( const sf::Color& color );
97
102 void setOutlineColor( const sf::Color& color );
103
108 void setThickness( float thickness );
109
114 void setPadding( const sf::Vector2f& padding );
115
121 void update( const sf::FloatRect& contentBounds, const sf::Vector2f& position );
122
127 void render( sf::RenderWindow& window );
128 private:
129 bool mEnabled;
130 sf::RectangleShape mFrame;
131 };
132
133}//End of namespace wPlot2D
134
135#endif
Represents an entity in the ECS (Entity-Component System) architecture.
Definition wEntity.hpp:60
void setOutlineColor(const sf::Color &color)
Sets the outline color of the frame.
Definition wFrameEntity.cpp:76
FrameEntity(bool enabled=true)
Constructs a frame entity.
Definition wFrameEntity.cpp:22
bool isEnabled() const
Checks whether the frame is currently enabled.
Definition wFrameEntity.cpp:44
virtual ~FrameEntity()=default
Virtual destructor.
void setThickness(float thickness)
Sets the outline thickness of the frame.
Definition wFrameEntity.cpp:81
void setFillColor(const sf::Color &color)
Sets the fill color of the frame.
Definition wFrameEntity.cpp:71
sf::Color getOutlineColor() const
Gets the current outline color of the frame.
Definition wFrameEntity.cpp:54
sf::Vector2f getPadding() const
Gets the current padding applied around the content.
Definition wFrameEntity.cpp:65
void setPadding(const sf::Vector2f &padding)
Sets the padding around the content.
Definition wFrameEntity.cpp:87
void setEnabled(bool enabled)
Enables or disables the frame.
Definition wFrameEntity.cpp:39
float getThickness() const
Gets the current outline thickness of the frame.
Definition wFrameEntity.cpp:59
void render(sf::RenderWindow &window)
Renders the frame to the given render window.
Definition wFrameEntity.cpp:118
sf::Color getFillColor() const
Gets the current fill color of the frame.
Definition wFrameEntity.cpp:49
void update(const sf::FloatRect &contentBounds, const sf::Vector2f &position)
Updates the size and position of the frame based on content bounds.
Definition wFrameEntity.cpp:99
Definition wAxisEntity.cpp:17