diff options
author | Benji Dial <benji@benjidial.net> | 2024-07-31 13:36:53 -0400 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-07-31 13:36:53 -0400 |
commit | b1cf9e5dfbc8967bd7cb2a22ec1e5e521f4e0e6e (patch) | |
tree | 00837891f9b9bf232e540a6f9b3e16f2438865c3 /libraries/pake/source/widgets/fixed-text.cpp | |
parent | 86b343f17175ef3e1fad2197636f75770466aa7c (diff) | |
download | hilbert-os-b1cf9e5dfbc8967bd7cb2a22ec1e5e521f4e0e6e.tar.gz |
add clock
Diffstat (limited to 'libraries/pake/source/widgets/fixed-text.cpp')
-rw-r--r-- | libraries/pake/source/widgets/fixed-text.cpp | 12 |
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; + } } |