@@ -13,6 +13,31 @@ namespace raylib {
1313 */
1414class Text {
1515 public:
16+ /* *
17+ * The internal text.
18+ */
19+ std::string text;
20+
21+ /* *
22+ * The size of the text.
23+ */
24+ float fontSize;
25+
26+ /* *
27+ * The color of the text.
28+ */
29+ ::Color color;
30+
31+ /* *
32+ * The internal raylib font to use for the text.
33+ */
34+ ::Font font;
35+
36+ /* *
37+ * The character spacing for the text.
38+ */
39+ float spacing;
40+
1641 /* *
1742 * Initializes a new Text object.
1843 *
@@ -22,7 +47,17 @@ class Text {
2247 * @param font Font to initialize.
2348 * @param spacing The spacing of the text.
2449 */
25- Text (const std::string& text = " " , float fontSize = 10 , const ::Color& color = WHITE, const ::Font& font = ::GetFontDefault(), float spacing = 0 ) : text(text), fontSize(fontSize), color(color), font(font), spacing(spacing) {
50+ Text (
51+ const std::string& text = " " ,
52+ float fontSize = 10 ,
53+ const ::Color& color = WHITE,
54+ const ::Font& font = ::GetFontDefault(),
55+ float spacing = 0 ) :
56+ text (text),
57+ fontSize (fontSize),
58+ color (color),
59+ font (font),
60+ spacing (spacing) {
2661 // Nothing.
2762 }
2863
@@ -35,7 +70,17 @@ class Text {
3570 * @param spacing The spacing of the text.
3671 * @param color The color of the font.
3772 */
38- Text (const ::Font& font, const std::string& text = " " , float fontSize = 10 , float spacing = 0 , const ::Color& color = WHITE) : font(font), text(text), fontSize(fontSize), spacing(spacing), color(color) {
73+ Text (
74+ const ::Font& font,
75+ const std::string& text = " " ,
76+ float fontSize = 10 ,
77+ float spacing = 0 ,
78+ const ::Color& color = WHITE) :
79+ text (text),
80+ fontSize (fontSize),
81+ color (color),
82+ font (font),
83+ spacing (spacing) {
3984 // Nothing.
4085 }
4186
@@ -56,7 +101,12 @@ class Text {
56101 * Draw text with values in class.
57102 */
58103 inline void Draw (int posX, int posY) {
59- ::DrawTextEx (font, text.c_str(), {static_cast <float >(posX), static_cast <float >(posY)}, fontSize, spacing, color);
104+ ::DrawTextEx (font,
105+ text.c_str(),
106+ { static_cast <float >(posX), static_cast <float >(posY) },
107+ fontSize,
108+ spacing,
109+ color);
60110 }
61111
62112 /* *
@@ -101,7 +151,12 @@ class Text {
101151 *
102152 * @see ::DrawText
103153 */
104- static inline void Draw (const std::string& text, const int posX, const int posY, const int fontSize, const ::Color& color) {
154+ static inline void Draw (
155+ const std::string& text,
156+ const int posX,
157+ const int posY,
158+ const int fontSize,
159+ const ::Color& color) {
105160 ::DrawText (text.c_str(), posX, posY, fontSize, color);
106161 }
107162
@@ -110,7 +165,11 @@ class Text {
110165 *
111166 * @see ::DrawText
112167 */
113- static inline void Draw (const std::string& text, const ::Vector2& pos, const int fontSize, const ::Color& color) {
168+ static inline void Draw (
169+ const std::string& text,
170+ const ::Vector2& pos,
171+ const int fontSize,
172+ const ::Color& color) {
114173 ::DrawText (text.c_str(), static_cast<int>(pos.x), static_cast<int>(pos.y), fontSize, color);
115174 }
116175
@@ -119,7 +178,13 @@ class Text {
119178 *
120179 * @see ::DrawTextEx
121180 */
122- static inline void Draw (const ::Font& font, const std::string& text, const ::Vector2& position, const float fontSize, const float spacing, const ::Color& color) {
181+ static inline void Draw (
182+ const ::Font& font,
183+ const std::string& text,
184+ const ::Vector2& position,
185+ const float fontSize,
186+ const float spacing,
187+ const ::Color& color) {
123188 ::DrawTextEx (font, text.c_str(), position, fontSize, spacing, color);
124189 }
125190
@@ -128,15 +193,17 @@ class Text {
128193 *
129194 * @see ::DrawTextPro
130195 */
131- static inline void Draw (const ::Font& font, const std::string& text, const ::Vector2& position, const ::Vector2& origin, const float rotation, const float fontSize, const float spacing, const ::Color& color) {
196+ static inline void Draw (
197+ const ::Font& font,
198+ const std::string& text,
199+ const ::Vector2& position,
200+ const ::Vector2& origin,
201+ const float rotation,
202+ const float fontSize,
203+ const float spacing,
204+ const ::Color& color) {
132205 ::DrawTextPro (font, text.c_str(), position, origin, rotation, fontSize, spacing, color);
133206 }
134-
135- std::string text;
136- float fontSize;
137- ::Color color;
138- ::Font font;
139- float spacing;
140207};
141208} // namespace raylib
142209
0 commit comments