From b1cf9e5dfbc8967bd7cb2a22ec1e5e521f4e0e6e Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Wed, 31 Jul 2024 13:36:53 -0400 Subject: add clock --- libraries/pake/source/widgets/fixed-text.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'libraries/pake/source/widgets/fixed-text.cpp') 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; + } } -- cgit v1.2.3