From 6d6a55602f7cdc7faad74282024fb5eb1f4f40e7 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Fri, 26 Feb 2021 14:40:15 +0300 Subject: [PATCH] Update ui example --- examples/ui.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/ui.cpp b/examples/ui.cpp index 5c767c89..fdc70138 100644 --- a/examples/ui.cpp +++ b/examples/ui.cpp @@ -57,13 +57,14 @@ struct ui_example text->set_multiline(ui::label::multiline_mode::minimize_lines); auto frame = element_factory.make_frame(); frame->set_child(text); - frame->set_fixed_size({200.f, 300.f}); screen->add(frame, ui::screen::x_policy::center, ui::screen::y_policy::center); - auto updater = util::recursive([this, frame, i = 0](auto && self) mutable -> void { - frame->set_fixed_size({200.f + i * 2.f, 300.f}); - ++i; - loop.post_at(async::clock::now() + std::chrono::milliseconds{10}, self); + auto updater = util::recursive([this, text, i = 0](auto && self) mutable -> void { + text->set_halign(static_cast(i % 3)); + text->set_valign(static_cast(i / 3)); + + i = (i + 1) % 9; + loop.post_at(async::clock::now() + std::chrono::milliseconds{1000}, self); }); updater();