This commit is contained in:
2025-08-15 15:48:00 -04:00
parent c5aa0a02e2
commit 78ea738b8e
8 changed files with 222 additions and 52 deletions

View File

@@ -1,3 +1,4 @@
use gui::Ui;
use winit::{
application::ApplicationHandler,
event::WindowEvent,
@@ -9,7 +10,7 @@ use super::Client;
#[derive(Default)]
pub struct App {
client: Option<Client>,
client: Option<(Client, Ui<Client>)>,
}
impl App {
@@ -25,12 +26,14 @@ impl ApplicationHandler for App {
let window = event_loop
.create_window(Window::default_attributes())
.unwrap();
let client = Client::new(window.into());
self.client = Some(client);
let (ui, ids) = Client::create_ui();
let client = Client::new(window.into(), ids);
self.client = Some((client, ui));
}
}
fn window_event(&mut self, event_loop: &ActiveEventLoop, _id: WindowId, event: WindowEvent) {
self.client.as_mut().unwrap().event(event, event_loop);
let (client, ui) = self.client.as_mut().unwrap();
client.event(event, event_loop, ui);
}
}