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:
Danny McGee
2023-11-02 15:25:14 -04:00
committed by GitHub
parent 06751e54f6
commit edbc1fa30f
7 changed files with 203 additions and 119 deletions
+12
View File
@@ -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>>,