aboutsummaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
authorLibravatar Silas Bartha <silas@exvacuum.dev>2024-12-20 08:02:55 -0500
committerLibravatar Silas Bartha <silas@exvacuum.dev>2024-12-20 08:02:55 -0500
commit652a17e0f90a045b99a80044be313e23b9529005 (patch)
tree0fec702d8a143cc67c1845eb4214aba5ee0d1d7d /src/widgets
parent87172fd904a9d461b10438be7dc55660e7ced680 (diff)
parent39e8be3872232d929c4ccaa1b595bf61d656b2fe (diff)
Merge branch 'wip'
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);
+ }
+}