summaryrefslogtreecommitdiff
path: root/libraries/pake/source/widgets/fixed-text.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/pake/source/widgets/fixed-text.cpp')
-rw-r--r--libraries/pake/source/widgets/fixed-text.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/libraries/pake/source/widgets/fixed-text.cpp b/libraries/pake/source/widgets/fixed-text.cpp
index c3a9a10..69c4046 100644
--- a/libraries/pake/source/widgets/fixed-text.cpp
+++ b/libraries/pake/source/widgets/fixed-text.cpp
@@ -15,12 +15,18 @@ namespace pake::widgets {
daguerre::hilbert_color fg,
halign ha, valign va)
: font(font), bg(bg), fg(fg),
- text(std::move(text)), ha(ha), va(va) {}
+ text(std::move(text)),
+ ha(ha), va(va) {}
+
+ void fixed_text::set_text(std::string &&text) {
+ this->text = std::move(text);
+ text_changed = true;
+ }
void fixed_text::render(
dirtiable_image &onto, int x_off, int y_off, bool force) {
- if (force) {
+ if (force || text_changed) {
//TODO: check overflow
@@ -54,6 +60,8 @@ namespace pake::widgets {
*font, fg, x_off, y_off,
text.data(), draw_if_true);
+ text_changed = false;
+
}
}