Bomberman
Text.hpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2021
3 ** Bomberman
4 ** File description:
5 ** Text
6 */
7 
8 #ifndef TEXT_HPP_
9 #define TEXT_HPP_
10 
12 #include <string>
13 
16  class Text: public ADrawable2D
17  {
18  public:
20  static constexpr int DefaultLetterSpacing = 1;
26  Text(std::string content, int fontSize, const Vector2 &position, const Color &color);
27 
34  Text(std::string content, int fontSize, int x, int y, const Color &color);
35 
37  Text(const Text &) = default;
38 
40  Text &operator=(const Text &) = default;
41 
43  ~Text() override = default;
44 
46  const std::string &getString(void);
47 
49  int getFontSize(void) const;
50 
52  int getLetterSpacing(void) const;
53 
55  Text &setFont(const Font &font);
56 
58  Text &setText(const std::string &text);
59 
61  Text &setLetterSpacing(int spacing);
62 
64  Text &setFontSize(int size);
65 
67  void drawOn(RAY::Window &) override;
69  void drawOn(RAY::Image &image) override;
70 
71  private:
73  std::string _text;
74 
77 
79  int _size;
80 
82  int _spacing;
83  };
84 };
85 
86 #endif /* !TEXT_HPP_ */
RAY::Drawables::Drawables2D::Text::getFontSize
int getFontSize(void) const
Definition: Text.cpp:40
RAY::Drawables::Drawables2D::Text::setFont
Text & setFont(const Font &font)
Definition: Text.cpp:45
RAY::Window
Definition: Window.hpp:32
RAY::Drawables::Drawables2D::Text::_spacing
int _spacing
spacing of chars
Definition: Text.hpp:82
RAY::Drawables::Drawables2D::Text::_font
Font _font
Font.
Definition: Text.hpp:76
RAY::Drawables::Drawables2D::Text::getString
const std::string & getString(void)
Definition: Text.cpp:35
RAY::Vector2
A Two-dimensionnal Vector data type.
Definition: Vector2.hpp:15
RAY::Drawables::Drawables2D::Text::Text
Text(std::string content, int fontSize, const Vector2 &position, const Color &color)
Text constructor.
Definition: Text.cpp:15
RAY::Drawables::Drawables2D::Text::setLetterSpacing
Text & setLetterSpacing(int spacing)
set text spacing
Definition: Text.cpp:68
RAY::Drawables::Drawables2D::Text::setText
Text & setText(const std::string &text)
set text content
Definition: Text.cpp:51
RAY::Drawables::Drawables2D::Text::getLetterSpacing
int getLetterSpacing(void) const
Definition: Text.cpp:63
RAY::Drawables::Drawables2D::Text::operator=
Text & operator=(const Text &)=default
A text is assignable.
RAY::Drawables::Drawables2D::Text::_text
std::string _text
Text, just text.
Definition: Text.hpp:73
RAY::Drawables::Drawables2D::Text
Text in a two-dimensionnal space.
Definition: Text.hpp:16
RAY::Drawables::Drawables2D::Text::DefaultLetterSpacing
static constexpr int DefaultLetterSpacing
The Letter spacing used when creating a Text instance.
Definition: Text.hpp:20
RAY::Drawables::Drawables2D::Text::~Text
~Text() override=default
A default destructor.
RAY::Drawables::Drawables2D::Text::_size
int _size
font size of the text
Definition: Text.hpp:79
RAY::Image
Object representation of a framebuffer.
Definition: Image.hpp:20
RAY::Drawables::Drawables2D::Text::setFontSize
Text & setFontSize(int size)
set font size
Definition: Text.cpp:57
RAY::Color
Object representation of color.
Definition: Color.hpp:15
RAY::Drawables::Drawables2D::Text::drawOn
void drawOn(RAY::Window &) override
Draw point on window.
Definition: Text.cpp:74
RAY::Drawables::ADrawable2D
Abstraction of any two-dimensionnal drawable.
Definition: ADrawable2D.hpp:21
RAY::Font
A font manager.
Definition: Font.hpp:18
ADrawable2D.hpp
RAY::Drawables::Drawables2D
Definition: Circle.cpp:11