animated example

This commit is contained in:
Jorijn van der Graaf 2026-05-02 00:03:24 +02:00
commit c9fd1b1585
17 changed files with 576 additions and 465 deletions

View file

@ -123,10 +123,14 @@ void UIScene::Initialize(Window& window, const std::filesystem::path& spvPath) {
}
);
// Per-frame: re-layout, emit, push items.
// Per-frame: re-layout, emit, push items. We capture FrameTime here
// so we can advance the scene's clock (caret blink, animations).
updateListener_ = std::make_unique<EventListener<FrameTime>>(
&window.onUpdate,
[this](FrameTime) { RebuildFrame(); }
[this](FrameTime ft) {
elapsedSec_ += static_cast<float>(ft.delta.count());
RebuildFrame();
}
);
}
@ -153,6 +157,7 @@ void UIScene::RebuildFrame() {
drawList.atlas = &renderer.atlas;
drawList.bindlessBaseHeapIdx = renderer.BindlessBaseHeapIdx();
drawList.scale = sc;
drawList.time = elapsedSec_;
if (background_) {
drawList.AddRect(
{ 0, 0, static_cast<float>(window_->width), static_cast<float>(window_->height) },