better global state structure?

This commit is contained in:
2025-12-19 21:54:48 -05:00
parent 30bc55c78e
commit bae17235c6
23 changed files with 335 additions and 230 deletions

View File

@@ -1,22 +1,20 @@
use iris::prelude::*;
use winit::event_loop::ActiveEventLoop;
fn main() {
App::<State>::run();
}
#[derive(DefaultUiState)]
struct State {
ui: Ui<Self>,
ui_state: UiState<Self>,
}
#[default_ui_state]
struct State {}
impl DefaultAppState for State {
fn new(event_loop: &ActiveEventLoop, _proxy: Proxy<Self::Event>) -> Self {
fn new(ui_state: DefaultUiState, _proxy: Proxy<Self::Event>) -> Self {
let mut ui = Ui::new();
let window = event_loop.create_window(Default::default()).unwrap();
let ui_state = UiState::new(window);
rect(Color::RED).set_root(&mut ui);
Self { ui, ui_state }
Self {
ui,
ui_state,
events: EventManager::default(),
}
}
}