Tweak keybinds.rs to make camera mode toggle smoother
This commit is contained in:
parent
ded85dcd72
commit
e88ce258ce
1 changed files with 8 additions and 3 deletions
|
|
@ -4,17 +4,22 @@ use raidillon_core::scene::Scene;
|
||||||
use raidillon_ecs::components::CameraMode;
|
use raidillon_ecs::components::CameraMode;
|
||||||
use raidillon_engine::{EngineResources, InputState};
|
use raidillon_engine::{EngineResources, InputState};
|
||||||
use raidillon_engine::system::System;
|
use raidillon_engine::system::System;
|
||||||
use raidillon_platform::Camera;
|
use raidillon_platform::{Camera, PlatformContext};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct KeybindsSystem;
|
pub struct KeybindsSystem {
|
||||||
|
camera_toggle_held: bool,
|
||||||
|
}
|
||||||
|
|
||||||
impl System for KeybindsSystem {
|
impl System for KeybindsSystem {
|
||||||
fn fixed_update(&mut self, res: &mut EngineResources, scene: &mut Scene) {
|
fn fixed_update(&mut self, res: &mut EngineResources, scene: &mut Scene) {
|
||||||
let input = res.get::<InputState>().unwrap();
|
let input = res.get::<InputState>().unwrap();
|
||||||
|
|
||||||
if input.key_held(KeyCode::F5) {
|
if input.key_held(KeyCode::F5) {
|
||||||
|
if self.camera_toggle_held { return }
|
||||||
self.toggle_camera_mode(scene);
|
self.toggle_camera_mode(scene);
|
||||||
|
self.camera_toggle_held = true;
|
||||||
|
} else {
|
||||||
|
self.camera_toggle_held = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue