From 25ccd185952cf6aa2b282b76581bd6a6e60c741f Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Tue, 15 Feb 2022 09:01:52 -0500 Subject: [PATCH] Add keybind to toggle all imgui ui off --- engine/core/include/engine.hpp | 1 + engine/core/src/engine.cpp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/engine/core/include/engine.hpp b/engine/core/include/engine.hpp index 604fe11..8e4b6d5 100755 --- a/engine/core/include/engine.hpp +++ b/engine/core/include/engine.hpp @@ -302,6 +302,7 @@ namespace prism { #endif bool console_enabled = true; + bool ui_enabled = true; private: void setup_scene(Scene& scene); diff --git a/engine/core/src/engine.cpp b/engine/core/src/engine.cpp index f05a242..fc6280d 100755 --- a/engine/core/src/engine.cpp +++ b/engine/core/src/engine.cpp @@ -449,6 +449,9 @@ void engine::process_key_down(const unsigned int keyCode) { if(keyCode == platform::get_keycode(InputButton::C)) console_enabled = !console_enabled; + + if(keyCode == platform::get_keycode(InputButton::Backspace)) + ui_enabled = !ui_enabled; } void engine::process_key_up(const unsigned int keyCode) { @@ -620,12 +623,14 @@ void engine::update_animation(const Animation& anim, const float time) { void engine::begin_frame(const float delta_time) { imgui->begin_frame(delta_time); - - if(debug_enabled) - draw_debug_ui(); - if(console_enabled) - draw_console(); + if(ui_enabled) { + if (debug_enabled) + draw_debug_ui(); + + if (console_enabled) + draw_console(); + } if(current_app != nullptr) current_app->begin_frame();