aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------depends/mgl0
-rw-r--r--include/mglpp/graphics/Text.hpp7
-rw-r--r--src/graphics/Text.cpp12
3 files changed, 16 insertions, 3 deletions
diff --git a/depends/mgl b/depends/mgl
-Subproject b52ed4028309fd20e3955c5f1a6adce9aa12c87
+Subproject 2a91f0dca320f6be061224cb42ceb31c32a51b6
diff --git a/include/mglpp/graphics/Text.hpp b/include/mglpp/graphics/Text.hpp
index 5126eab..84782e8 100644
--- a/include/mglpp/graphics/Text.hpp
+++ b/include/mglpp/graphics/Text.hpp
@@ -22,9 +22,14 @@ namespace mgl {
~Text();
void set_position(vec2f position) override;
- void set_color(Color color) override;
vec2f get_position() const override;
+ void set_color(Color color) override;
+ // If |max_width| is 0 then the text has no max width
+ void set_max_width(float max_width);
+ // If |max_rows| is 0 then the text can display an unlimited amount of rows
+ void set_max_rows(unsigned int max_rows);
+
FloatRect get_bounds();
void set_string(std::string str);
const std::string& get_string() const;
diff --git a/src/graphics/Text.cpp b/src/graphics/Text.cpp
index a30cdf3..e138a28 100644
--- a/src/graphics/Text.cpp
+++ b/src/graphics/Text.cpp
@@ -47,12 +47,20 @@ namespace mgl {
mgl_text_set_position(&text, {position.x, position.y});
}
+ vec2f Text::get_position() const {
+ return { text.position.x, text.position.y };
+ }
+
void Text::set_color(Color color) {
mgl_text_set_color(&text, {color.r, color.g, color.b, color.a});
}
- vec2f Text::get_position() const {
- return { text.position.x, text.position.y };
+ void Text::set_max_width(float max_width) {
+ mgl_text_set_max_width(&text, max_width);
+ }
+
+ void Text::set_max_rows(unsigned int max_rows) {
+ mgl_text_set_max_rows(&text, max_rows);
}
FloatRect Text::get_bounds() {