From a5d2668c1848f0ac9d8867a3fec92ad5a026ceaf Mon Sep 17 00:00:00 2001 From: dnesov Date: Tue, 24 Jun 2025 14:48:55 +0200 Subject: [PATCH] Move layouting to Render instead of Update, use Update for input. --- TODO.md | 2 +- Voile/Source/UI/UISystem.cs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index f1a74ec..6d8ab48 100644 --- a/TODO.md +++ b/TODO.md @@ -78,7 +78,7 @@ - ~~GridContainer~~ - ~~FlexContainer~~ - ~~Positioning (anchors)~~ -- Move layouting to Render instead of Update, use Update for input. +- ~~Move layouting to Render instead of Update, use Update for input.~~ - Input propagation - Basic input elements (button, text field, toggle). - Styling. diff --git a/Voile/Source/UI/UISystem.cs b/Voile/Source/UI/UISystem.cs index ddeb463..bc18fc1 100644 --- a/Voile/Source/UI/UISystem.cs +++ b/Voile/Source/UI/UISystem.cs @@ -35,16 +35,17 @@ public class UISystem : IUpdatableSystem, IRenderableSystem public void Update(double deltaTime) { HandleInput(); + } + public void Render(RenderSystem renderer) + { + // Update elements each time UI system is rendered. foreach (var element in _elements) { if (element is not IUpdatableElement updatable) continue; updatable.Update(); } - } - public void Render(RenderSystem renderer) - { foreach (var element in _elements) { if (element is IRenderableElement renderable)