Guillaume 1.0.0
Guillaume.
Loading...
Searching...
No Matches
text.hpp
1/*
2 Copyright (c) 2025 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#pragma once
24
25#include <string>
26
27#include "point.hpp"
28#include "primitive.hpp"
29
39class Text : public Primitive {
40private:
41 std::string _content;
42 Point _position;
43 Point _rotation;
44 float _scale;
45
46public:
51 Text(void)
52 : Primitive(), _content(""), _position(0, 0, 0), _rotation(0, 0, 0),
53 _scale(1.0f) {}
54
60 Text(const std::string &content)
61 : Primitive(), _content(content), _position(0, 0, 0), _rotation(0, 0, 0),
62 _scale(1.0f) {}
63
70 Text(const std::string &content, const Point &position)
71 : Primitive(), _content(content), _position(position), _rotation(0, 0, 0),
72 _scale(1.0f) {}
73
83 Text(const std::string &content, const Point &position, const Point &rotation,
84 float scale)
85 : Primitive(), _content(content), _position(position),
86 _rotation(rotation), _scale(scale) {}
87
91 ~Text(void) override = default;
92
98 const std::string &getContent(void) const { return _content; }
99
105 void setContent(const std::string &content) { _content = content; }
106
112 const Point &getPosition(void) const { return _position; }
113
119 void setPosition(const Point &position) { _position = position; }
120
126 const Point &getRotation(void) const { return _rotation; }
127
133 void setRotation(const Point &rotation) { _rotation = rotation; }
134
140 float getScale(void) const { return _scale; }
141
147 void setScale(float scale) { _scale = scale; }
148};
Represents a point in 3D space.
Definition point.hpp:35
Base class for all drawing primitives.
Definition primitive.hpp:34
Represents a text primitive for rendering in 3D space.
Definition text.hpp:39
~Text(void) override=default
Destroy the Text object.
void setPosition(const Point &position)
Sets the text position.
Definition text.hpp:119
const std::string & getContent(void) const
Gets the text content.
Definition text.hpp:98
float getScale(void) const
Gets the text scale.
Definition text.hpp:140
Text(void)
Default constructor - initializes empty text at origin with no rotation and unit scale.
Definition text.hpp:51
Text(const std::string &content, const Point &position)
Constructor with text content and 3D position.
Definition text.hpp:70
void setRotation(const Point &rotation)
Sets the text rotation.
Definition text.hpp:133
const Point & getRotation(void) const
Gets the text rotation.
Definition text.hpp:126
const Point & getPosition(void) const
Gets the text position.
Definition text.hpp:112
Text(const std::string &content)
Constructor with text content.
Definition text.hpp:60
void setScale(float scale)
Sets the text scale.
Definition text.hpp:147
void setContent(const std::string &content)
Sets the text content.
Definition text.hpp:105
Text(const std::string &content, const Point &position, const Point &rotation, float scale)
Constructor with text content, position, rotation, and scale for full 3D control.
Definition text.hpp:83