R-Type  2
Doom but in better
Loading...
Searching...
No Matches
Font.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2024
3** rtype (Workspace)
4** File description:
5** Font.hpp
6*/
7
18#pragma once
19
20#include <any>
21#include <SFML/Graphics/Font.hpp>
22
23#include "Log.hpp"
24#include "LogMacros.hpp"
25#include "Utilities.hpp"
26#include "CustomExceptions.hpp"
28
29namespace GUI
30{
31 namespace ECS
32 {
33 namespace Systems
34 {
45 class Font : public EntityNode {
46 public:
52 Font();
58 Font(const std::uint32_t entityId);
63 Font(const GUI::ECS::Systems::Font &other);
70 Font(const std::string &name, const std::string &path);
78 Font(const std::string &name, const std::string &path, const unsigned int size);
87 Font(const std::string &name, const std::string &path, const unsigned int size, const std::string &application);
97 Font(const std::string &name, const std::string &path, const unsigned int size, const std::string &application, const bool bold);
108 Font(const std::string &name, const std::string &path, const unsigned int size, const std::string &application, const bool bold, const bool italic);
116 Font(const std::uint32_t entityId, const std::string &name, const std::string &path);
125 Font(const std::uint32_t entityId, const std::string &name, const std::string &path, const unsigned int size);
135 Font(const std::uint32_t entityId, const std::string &name, const std::string &path, const unsigned int size, const std::string &application);
146 Font(const std::uint32_t entityId, const std::string &name, const std::string &path, const unsigned int size, const std::string &application, const bool bold);
158 Font(const std::uint32_t entityId, const std::string &name, const std::string &path, const unsigned int size, const std::string &application, const bool bold, const bool italic);
159
163 ~Font();
164
170 void setBold(const bool bold);
176 void setItalic(const bool italic);
182 void setFontName(const std::string &name);
188 void setFontPath(const std::string &path);
194 void setFontDefaultSize(const unsigned int size);
200 void setFontApplication(const std::string application);
201
207 const bool isBold() const;
213 const bool isItalic() const;
214
220 const std::string getFontName() const;
226 const std::string getFontPath() const;
232 const std::string getApplication() const;
238 const unsigned int getDefaultSize() const;
244 const std::any getFontInstance() const;
254 const std::string getInfo(const unsigned int indent = 0) const;
255
261 void update(const GUI::ECS::Systems::Font &copy);
262
268 const bool isLoaded() const;
269
278
279 private:
280
281 bool _bold = false;
282 bool _italic = false;
283 std::string _fontName = "";
284 std::string _fontPath = "";
285 bool _fontInstanceSet = false;
286 std::shared_ptr<sf::Font> _fontInstance;
287 std::string _fontApplication = "";
288 unsigned int _fontDefaultSize = 30;
289 };
290
291
300 std::ostream &operator<<(std::ostream &os, const Font &item);
301 }
302 }
303}
File in charge of containing the custom errors that are going to be used for custom description error...
This is the file that links the EntityNode children.
Macro definitions for logging messages with varying levels of detail and formatting.
This is the file in charge of containing the Log class (the one in charge of outputing info only when...
Manages font entities in the GUI ECS.
Definition Font.hpp:45
const std::any getFontInstance() const
Retrieves the font instance.
Definition Font.cpp:205
void setFontPath(const std::string &path)
Sets the file path of the font and loads it.
Definition Font.cpp:144
const bool isItalic() const
Checks if the font is italic.
Definition Font.cpp:180
Font()
Default constructor.
Definition Font.cpp:16
void setFontApplication(const std::string application)
Sets the application or context for the font.
Definition Font.cpp:170
void update(const GUI::ECS::Systems::Font &copy)
Updates the font with properties from another font.
Definition Font.cpp:239
const bool isLoaded() const
Checks if the font instance is loaded.
Definition Font.cpp:263
const std::string getApplication() const
Retrieves the application context of the font.
Definition Font.cpp:195
void setFontName(const std::string &name)
Sets the font name.
Definition Font.cpp:139
const std::string getFontPath() const
Retrieves the file path of the font.
Definition Font.cpp:190
const std::string getFontName() const
Retrieves the font name.
Definition Font.cpp:185
~Font()
Destructor.
Definition Font.cpp:127
GUI::ECS::Systems::Font & operator=(const GUI::ECS::Systems::Font &copy)
Assignment operator.
Definition Font.cpp:268
void setItalic(const bool italic)
Sets the italic property of the font.
Definition Font.cpp:134
const unsigned int getDefaultSize() const
Retrieves the default size of the font.
Definition Font.cpp:200
const std::string getInfo(const unsigned int indent=0) const
This is a function meant for debugging purposes It will dump the current state of the variables upon ...
Definition Font.cpp:220
const bool isBold() const
Checks if the font is bold.
Definition Font.cpp:175
void setBold(const bool bold)
Sets the bold property of the font.
Definition Font.cpp:129
void setFontDefaultSize(const unsigned int size)
Sets the default size of the font.
Definition Font.cpp:165
std::ostream & operator<<(std::ostream &os, const Clock &item)
Outputs the clock's info to a stream.
Definition Clock.cpp:73