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:74
void setLabelsCharacterSize(unsigned int newSize)
Sets the character size of all labels.
Definition wAxisEntity.cpp:263
void setTitleFont(const sf::Font &font)
Sets the font of the axis title.
Definition wAxisEntity.cpp:91
void addLabelsOffset(sf::Vector2f delta)
Applies an additional offset to all labels.
Definition wAxisEntity.cpp:254
void render(sf::RenderWindow &window)
Renders the axis (line, arrow, title, notches, labels).
Definition wAxisEntity.cpp:304
void setColor(sf::Color color)
Sets the color of the axis line.
Definition wAxisEntity.cpp:51
void setLabelsColor(const sf::Color &color)
Sets the color of all labels.
Definition wAxisEntity.cpp:223
std::vector< sf::Vector2f > getLabelsOffset() const
Gets the current offset of all labels.
Definition wAxisEntity.cpp:232
void setThickness(float thickness)
Sets the thickness of the axis line (in pixels).
Definition wAxisEntity.cpp:57
void setLabelsDecimalPlaces(int places)
Sets the number of decimal places for numeric labels.
Definition wAxisEntity.cpp:271
void setNotchesThickness(float thickness)
Sets the thickness of all notches.
Definition wAxisEntity.cpp:127
void setLabelsOffset(sf::Vector2f offset)
Sets a new offset for all labels.
Definition wAxisEntity.cpp:245
void setNotchesLength(float newLength)
Sets the length of all notches.
Definition wAxisEntity.cpp:152
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:27
void setArrowSize(float arrowSize)
Sets the size of the arrowhead at the end of the axis.
Definition wAxisEntity.cpp:63
void setTitleColor(sf::Color newColor)
Sets the color of the axis title.
Definition wAxisEntity.cpp:96
void setCustomLabels(const std::vector< std::string > &labels)
Replaces numeric labels with a custom set of strings.
Definition wAxisEntity.cpp:279
sf::Vector2f getTitleOffset() const
Gets the current title offset.
Definition wAxisEntity.cpp:80
void setLabelsFont(const sf::Font &font)
Sets the font of all labels.
Definition wAxisEntity.cpp:215
virtual ~AxisEntity()=default
Virtual destructor.
void addTitle(const std::string &title)
Adds a title to the axis.
Definition wAxisEntity.cpp:374
void setTitleCharacterSize(unsigned int size)
Sets the character size of the axis title.
Definition wAxisEntity.cpp:86
void addNotches(float interval, NotchPosition position, bool hasLabels=false)
Adds notches along the axis.
Definition wAxisEntity.cpp:108
void setNotchesColor(const sf::Color &color)
Sets the color of all notches.
Definition wAxisEntity.cpp:118
Definition wAxisEntity.cpp:19
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