diff --git a/drivermode.cpp b/drivermode.cpp index 5b34c827..5a96e5a2 100644 --- a/drivermode.cpp +++ b/drivermode.cpp @@ -444,6 +444,11 @@ driver_mode::on_key( int const Key, int const Scancode, int const Action, int co // give the ui first shot at the input processing... if( !anyModifier && true == m_userinterface->on_key( Key, Action ) ) { return; } + if (Key == (GLFW_MOD_SHIFT | GLFW_KEY_F12) && Action == GLFW_PRESS) + { + m_userinterface->showDebugUI(); + return; + } // ...if the input is left untouched, pass it on if( true == m_input.keyboard.key( Key, Action ) ) { return; } diff --git a/driveruilayer.cpp b/driveruilayer.cpp index 33e787ac..481fe601 100644 --- a/driveruilayer.cpp +++ b/driveruilayer.cpp @@ -87,6 +87,11 @@ void driver_ui::render_menu_contents() { } } +void driver_ui::showDebugUI() +{ + m_debugpanel.is_open = !m_debugpanel.is_open; +} + // potentially processes provided input key. returns: true if key was processed, false otherwise bool driver_ui::on_key( int const Key, int const Action ) { @@ -101,8 +106,7 @@ driver_ui::on_key( int const Key, int const Action ) { case GLFW_KEY_F10: case GLFW_KEY_F12: { // ui mode selectors - if( ( true == Global.ctrlState ) - || ( true == Global.shiftState ) ) { + if( ( true == Global.ctrlState )) { // only react to keys without modifiers return false; } @@ -157,10 +161,13 @@ driver_ui::on_key( int const Key, int const Action ) { return true; } - case GLFW_KEY_F12: { + case GLFW_KEY_F12 : { // debug panel - m_debugpanel.is_open = !m_debugpanel.is_open; - return true; + if (Global.shiftState) + { + m_debugpanel.is_open = !m_debugpanel.is_open; + return true; + } } default: { diff --git a/driveruilayer.h b/driveruilayer.h index 487feaa6..3c1ea344 100644 --- a/driveruilayer.h +++ b/driveruilayer.h @@ -27,6 +27,7 @@ public: // constructors driver_ui(); // methods + void showDebugUI() override; // potentially processes provided input key. returns: true if the input was processed, false otherwise bool on_key( int const Key, int const Action ) override; @@ -43,6 +44,7 @@ public: protected: void render_menu_contents() override; + private: // methods // sets visibility of the cursor diff --git a/uilayer.h b/uilayer.h index 3cd80c4d..3cb4ddbf 100644 --- a/uilayer.h +++ b/uilayer.h @@ -75,13 +75,14 @@ public: // destructor virtual ~ui_layer(); -// methods + // methods static bool init( GLFWwindow *Window ); static void imgui_style(); // assign texturing hardware unit static void set_unit( GLint const Textureunit ) { m_textureunit = GL_TEXTURE0 + Textureunit; } static void shutdown(); + virtual void showDebugUI() {}; // potentially processes provided input key. returns: true if the input was processed, false otherwise virtual bool on_key( int Key, int Action ); // potentially processes provided mouse movement. returns: true if the input was processed, false otherwise