From c431ebf74522cdf6cee8d034c5f4d9ac5f2c75b3 Mon Sep 17 00:00:00 2001 From: reo Date: Wed, 29 Oct 2025 21:37:49 +0300 Subject: [PATCH] Tweak keybinds.rs to make camera mode toggle smoother --- game/src/systems/keybinds.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/game/src/systems/keybinds.rs b/game/src/systems/keybinds.rs index 6bc3e70..e701dad 100644 --- a/game/src/systems/keybinds.rs +++ b/game/src/systems/keybinds.rs @@ -4,17 +4,22 @@ use raidillon_core::scene::Scene; use raidillon_ecs::components::CameraMode; use raidillon_engine::{EngineResources, InputState}; use raidillon_engine::system::System; -use raidillon_platform::Camera; +use raidillon_platform::{Camera, PlatformContext}; #[derive(Default)] -pub struct KeybindsSystem; +pub struct KeybindsSystem { + camera_toggle_held: bool, +} impl System for KeybindsSystem { fn fixed_update(&mut self, res: &mut EngineResources, scene: &mut Scene) { let input = res.get::().unwrap(); - if input.key_held(KeyCode::F5) { + if self.camera_toggle_held { return } self.toggle_camera_mode(scene); + self.camera_toggle_held = true; + } else { + self.camera_toggle_held = false; } }