Tweak keybinds.rs to make camera mode toggle smoother

This commit is contained in:
reo 2025-10-29 21:37:49 +03:00
parent ded85dcd72
commit e88ce258ce

View file

@ -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::<InputState>().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;
}
}