mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
Debug toggling (#9)
#8 introduced some additional debug information to the view, which was already rendering some information and visualizations which were not necessary relevant to the end-user experience. This PR adds an input action (bound to Ctrl + `) to toggle the display of those visualizations, and disables them by default.
This commit is contained in:
@@ -15,6 +15,7 @@ impl Plugin for StudioInputPlugin {
|
||||
PreUpdate,
|
||||
(
|
||||
translate_selection_events,
|
||||
translate_debug_toggle,
|
||||
translate_dcc_camera_events,
|
||||
translate_fps_camera_events,
|
||||
)
|
||||
@@ -38,6 +39,7 @@ pub enum Lifecycle {
|
||||
pub enum Action {
|
||||
Camera(CameraMotion),
|
||||
Selection(Selection),
|
||||
ToggleDebug,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
@@ -83,6 +85,16 @@ fn translate_selection_events(keyboard: Res<Input<KeyCode>>, mut input: EventWri
|
||||
}
|
||||
}
|
||||
|
||||
fn translate_debug_toggle(keyboard: Res<Input<KeyCode>>, mut input: EventWriter<InputAction>) {
|
||||
if keyboard.pressed(KeyCode::ControlLeft) || keyboard.pressed(KeyCode::ControlRight) {
|
||||
if keyboard.just_pressed(KeyCode::Grave) {
|
||||
input.send(InputAction(Lifecycle::Start, Action::ToggleDebug));
|
||||
} else if keyboard.just_released(KeyCode::Grave) {
|
||||
input.send(InputAction(Lifecycle::Stop, Action::ToggleDebug));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn translate_dcc_camera_events(
|
||||
mouse_motion: EventReader<MouseMotion>,
|
||||
mouse_buttons: Res<Input<MouseButton>>,
|
||||
|
||||
Reference in New Issue
Block a user