diff --git a/src/spotlight.rs b/src/spotlight.rs index 8a564d7..f521a72 100644 --- a/src/spotlight.rs +++ b/src/spotlight.rs @@ -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)] diff --git a/src/state.rs b/src/state.rs index 3da5927..7feabb3 100644 --- a/src/state.rs +++ b/src/state.rs @@ -233,10 +233,6 @@ impl<'a> State<'a> { if char == "r" { 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; } @@ -256,7 +252,7 @@ impl<'a> State<'a> { bytemuck::cast_slice(&[self.camera_info.uniform]), ); - self.spotlight.update(); + self.spotlight.update(&self.window); self.spotlight_info .uniform .update(&self.spotlight, &self.camera_controller);