8#ifndef W_AXIS_ENTITY_HPP
9#define W_AXIS_ENTITY_HPP
19#pragma GCC diagnostic push
20#pragma GCC diagnostic ignored "-Wfloat-equal"
21#pragma GCC diagnostic ignored "-Wswitch-default"
22#include <SFML/Graphics.hpp>
23#pragma GCC diagnostic pop
78 AxisEntity( sf::Font& font, sf::Vector2f origin, sf::Vector2f scale, sf::Vector2f offset,
AxisType type, sf::Vector2f axisRange );
110 void addTitle(
const std::string& title );
116 void addTitle(
const std::wstring& title );
226 void render( sf::RenderWindow& window );
228 sf::Font& mTitleFont;
229 sf::Font& mLabelsFont;
231 sf::Vector2f mAxisRange;
232 std::unique_ptr< LineEntity > mAxisLine;
235 std::vector< std::unique_ptr< NotchEntity > > mNotches;
238 std::unique_ptr< TitleEntity > mTitle;
241 std::vector< std::unique_ptr< LabelEntity > > mLabels;
251 template <
typename T >
252 void initTitle(
const T& title );
Represents an entity in the ECS (Entity-Component System) architecture.
Definition wEntity.hpp:60
void setTitleOffset(sf::Vector2f titleOffset)
Sets a manual offset for the title position.
Definition wAxisEntity.cpp:72
void setLabelsCharacterSize(unsigned int newSize)
Sets the character size of all labels.
Definition wAxisEntity.cpp:261
void setTitleFont(const sf::Font &font)
Sets the font of the axis title.
Definition wAxisEntity.cpp:89
void addLabelsOffset(sf::Vector2f delta)
Applies an additional offset to all labels.
Definition wAxisEntity.cpp:252
void render(sf::RenderWindow &window)
Renders the axis (line, arrow, title, notches, labels).
Definition wAxisEntity.cpp:302
void setColor(sf::Color color)
Sets the color of the axis line.
Definition wAxisEntity.cpp:49
void setLabelsColor(const sf::Color &color)
Sets the color of all labels.
Definition wAxisEntity.cpp:221
std::vector< sf::Vector2f > getLabelsOffset() const
Gets the current offset of all labels.
Definition wAxisEntity.cpp:230
void setThickness(float thickness)
Sets the thickness of the axis line (in pixels).
Definition wAxisEntity.cpp:55
void setLabelsDecimalPlaces(int places)
Sets the number of decimal places for numeric labels.
Definition wAxisEntity.cpp:269
void setNotchesThickness(float thickness)
Sets the thickness of all notches.
Definition wAxisEntity.cpp:125
void setLabelsOffset(sf::Vector2f offset)
Sets a new offset for all labels.
Definition wAxisEntity.cpp:243
void setNotchesLength(float newLength)
Sets the length of all notches.
Definition wAxisEntity.cpp:150
AxisEntity(sf::Font &font, sf::Vector2f origin, sf::Vector2f scale, sf::Vector2f offset, AxisType type, sf::Vector2f axisRange)
Constructs an AxisEntity with a given orientation, origin, scale, and range.
Definition wAxisEntity.cpp:25
void setArrowSize(float arrowSize)
Sets the size of the arrowhead at the end of the axis.
Definition wAxisEntity.cpp:61
void setTitleColor(sf::Color newColor)
Sets the color of the axis title.
Definition wAxisEntity.cpp:94
void setCustomLabels(const std::vector< std::string > &labels)
Replaces numeric labels with a custom set of strings.
Definition wAxisEntity.cpp:277
sf::Vector2f getTitleOffset() const
Gets the current title offset.
Definition wAxisEntity.cpp:78
void setLabelsFont(const sf::Font &font)
Sets the font of all labels.
Definition wAxisEntity.cpp:213
virtual ~AxisEntity()=default
Virtual destructor.
void addTitle(const std::string &title)
Adds a title to the axis.
Definition wAxisEntity.cpp:372
void setTitleCharacterSize(unsigned int size)
Sets the character size of the axis title.
Definition wAxisEntity.cpp:84
void addNotches(float interval, NotchPosition position, bool hasLabels=false)
Adds notches along the axis.
Definition wAxisEntity.cpp:106
void setNotchesColor(const sf::Color &color)
Sets the color of all notches.
Definition wAxisEntity.cpp:116
Definition wAxisEntity.cpp:17
AxisType
Enum representing the type of axis to render.
Definition wAxisEntity.hpp:35
@ X_AXIS
Definition wAxisEntity.hpp:36
@ Y_AXIS
Definition wAxisEntity.hpp:37
NotchPosition
Enum controlling the visual placement of notches relative to the axis.
Definition wAxisEntity.hpp:45
@ Center
Definition wAxisEntity.hpp:46
@ Above
Definition wAxisEntity.hpp:47
@ Below
Definition wAxisEntity.hpp:48