aboutsummaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
authorLibravatar Silas Bartha <silas@exvacuum.dev>2024-11-21 12:33:58 -0500
committerLibravatar Silas Bartha <silas@exvacuum.dev>2024-11-21 12:33:58 -0500
commitc2d89772336c52cce0b629f6ffc506eb1f221867 (patch)
tree96f30f3d94b7821fb769b0f2c86b17248f36a6d9 /src/widgets
parente1eb0d99f17e6604e79496db68b191202cb95d60 (diff)
Thu Nov 21 12:33:58 PM EST 2024
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/mod.rs3
-rw-r--r--src/widgets/systems.rs6
2 files changed, 9 insertions, 0 deletions
diff --git a/src/widgets/mod.rs b/src/widgets/mod.rs
index 46bfa20..7751b2d 100644
--- a/src/widgets/mod.rs
+++ b/src/widgets/mod.rs
@@ -17,5 +17,8 @@ pub trait TerminalWidget: DowncastSync {
/// Called when a terminal input event is invoked to update any state accordingly
fn handle_events(&mut self, _event: &TerminalInputEvent, _commands: &mut Commands) {}
+
+ /// Called every frame during the Update schedule
+ fn update(&mut self, _time: &Time, _commands: &mut Commands) {}
}
impl_downcast!(sync TerminalWidget);
diff --git a/src/widgets/systems.rs b/src/widgets/systems.rs
index 2626ec6..0638b01 100644
--- a/src/widgets/systems.rs
+++ b/src/widgets/systems.rs
@@ -16,3 +16,9 @@ pub fn widget_input_handling(
}
}
}
+
+pub fn update_widgets(mut widgets: Query<&mut Widget>, time: Res<Time>, mut commands: Commands) {
+ for mut widget in widgets.iter_mut() {
+ widget.widget.update(&time, &mut commands);
+ }
+}