smart rendering?

This commit is contained in:
2025-04-25 23:52:36 +02:00
parent 1ec12fa728
commit 3715ecf841
6 changed files with 603 additions and 58 deletions

View File

@@ -2,6 +2,7 @@ use std::sync::Arc;
use tokio::runtime::Runtime;
use winit::dpi::LogicalSize;
use winit::event::WindowEvent;
use winit::keyboard::{Key, NamedKey};
use winit::window::Window;
mod rendering;
@@ -54,11 +55,29 @@ impl winit::application::ApplicationHandler for Application {
state.render().unwrap();
}
WindowEvent::KeyboardInput {
device_id,
device_id: _,
event,
is_synthetic,
is_synthetic: _,
} => {
todo!()
if event.state.is_pressed() {
match event.logical_key {
Key::Named(k) => match k {
NamedKey::Enter => {
state.handle_enter();
}
_ => todo!(),
},
Key::Character(c) => {
state.add_text(&event.text.unwrap());
}
Key::Dead(_) => {
todo!()
}
Key::Unidentified(_) => {
todo!()
}
}
}
}
WindowEvent::CloseRequested => event_loop.exit(),
_ => {}