Automatically hide the cursor when the spotlight is activated

master
Wynd 2024-11-07 12:28:49 +02:00
parent 49d8745374
commit 9a03b4a36c
2 changed files with 4 additions and 6 deletions

View File

@ -101,7 +101,9 @@ impl Spotlight {
} }
} }
pub fn update(&mut self) {} pub fn update(&mut self, window: &winit::window::Window) {
window.set_cursor_visible(!self.is_ctrl_pressed);
}
} }
#[repr(C)] #[repr(C)]

View File

@ -233,10 +233,6 @@ impl<'a> State<'a> {
if char == "r" { if char == "r" {
self.camera_controller.reset_camera(&mut self.camera); self.camera_controller.reset_camera(&mut self.camera);
} }
else if char == "h" {
self.hide_cursor = !self.hide_cursor;
self.window.set_cursor_visible(!self.hide_cursor);
}
} }
return true; return true;
} }
@ -256,7 +252,7 @@ impl<'a> State<'a> {
bytemuck::cast_slice(&[self.camera_info.uniform]), bytemuck::cast_slice(&[self.camera_info.uniform]),
); );
self.spotlight.update(); self.spotlight.update(&self.window);
self.spotlight_info self.spotlight_info
.uniform .uniform
.update(&self.spotlight, &self.camera_controller); .update(&self.spotlight, &self.camera_controller);