Update app structure

This commit is contained in:
2026-07-14 12:18:28 -04:00
parent a0d3e28a8b
commit 712a149735
+12 -6
View File
@@ -4,22 +4,28 @@ pub mod unit;
pub mod widget; pub mod widget;
pub trait App { pub trait App {
// State
fn init(&mut self);
fn update(&mut self);
fn tick(&self);
// Rendering // Rendering
fn layout(&self) -> layout::Allocation; fn layout(&self) -> layout::Allocation;
fn render(&mut self, layout: layout::Allocation); fn render(&mut self, layout: layout::Allocation);
// State
fn init(&mut self);
fn update(&mut self);
fn refresh(&mut self) { fn refresh(&mut self) {
self.render(self.layout()); self.render(self.layout());
} }
// Run // Running
fn run(&mut self) { fn run(&mut self) {
self.init(); self.init();
self.refresh(); self.refresh();
loop {
self.tick();
self.update();
self.refresh();
}
} }
} }