diff --git a/RenderingManager.cpp b/RenderingManager.cpp index e48481d..6956528 100644 --- a/RenderingManager.cpp +++ b/RenderingManager.cpp @@ -385,10 +385,17 @@ float Rendering::MonitorHeight() return height; } + + +bool Rendering::IsFullscreen () +{ + return (glfwGetWindowMonitor(main_window_) != nullptr); +} + void Rendering::ToggleFullscreen() { // if in fullscreen mode - if (glfwGetWindowMonitor(main_window_) != nullptr) { + if (IsFullscreen()) { // set to window mode glfwSetWindowMonitor( main_window_, nullptr, Settings::application.windows.front().x, Settings::application.windows.front().y, diff --git a/RenderingManager.h b/RenderingManager.h index 4dfd178..06c2164 100644 --- a/RenderingManager.h +++ b/RenderingManager.h @@ -69,6 +69,7 @@ public: class Screenshot *CurrentScreenshot(); // request fullscreen + bool IsFullscreen (); void ToggleFullscreen(); // get width of rendering area float Width(); diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index 1a9b2ea..f6c15b6 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -203,6 +203,7 @@ void UserInterface::handleKeyboard() // Application "CTRL +"" Shortcuts if ( io.KeyCtrl ) { + keyboard_modifier_active = true; if (ImGui::IsKeyPressed( GLFW_KEY_Q )) { // Quit @@ -240,9 +241,13 @@ void UserInterface::handleKeyboard() } else { - // Normal keys + keyboard_modifier_active = false; + + // Action keys if (ImGui::IsKeyPressed( GLFW_KEY_BACKSPACE )) Mixer::manager().deleteCurrentSource(); + else if (ImGui::IsKeyPressed( GLFW_KEY_GRAVE_ACCENT )) + navigator.toggleMenu(); // Application F-Keys else if (ImGui::IsKeyPressed( GLFW_KEY_F1 )) Mixer::manager().setCurrentView(View::MIXING); @@ -250,10 +255,12 @@ void UserInterface::handleKeyboard() Mixer::manager().setCurrentView(View::GEOMETRY); else if (ImGui::IsKeyPressed( GLFW_KEY_F12 )) Rendering::manager().ToggleFullscreen(); + else if (ImGui::IsKeyPressed( GLFW_KEY_ESCAPE )){ + if (Rendering::manager().IsFullscreen()) + Rendering::manager().ToggleFullscreen(); + } else if (ImGui::IsKeyPressed( GLFW_KEY_PRINT_SCREEN )) toolbox.StartScreenshot(); - else if (ImGui::IsKeyPressed( GLFW_KEY_GRAVE_ACCENT )) - navigator.toggleMenu(); } } diff --git a/UserInterfaceManager.h b/UserInterfaceManager.h index 1109620..24ab27d 100644 --- a/UserInterfaceManager.h +++ b/UserInterfaceManager.h @@ -59,7 +59,6 @@ public: void Render(); }; -// TODO: class ShaderEditor class UserInterface { @@ -67,16 +66,12 @@ class UserInterface Navigator navigator; ToolBox toolbox; + bool keyboard_modifier_active; bool show_about; bool show_imgui_about; bool show_gst_about; bool show_opengl_about; - std::string currentTextEdit; - - void handleKeyboard(); - void handleMouse(); - void showMenuFile(); // typedef enum { // FILE_DIALOG_INACTIVE = 0, @@ -109,14 +104,23 @@ public: void Render(); // Post-loop termination void Terminate(); - // + + // status querries + inline bool keyboardModifier() { return keyboard_modifier_active; } + + + // TODO implement the shader editor + std::string currentTextEdit; void fillShaderEditor(std::string text); protected: + void showMenuFile(); void RenderPreview(); void RenderMediaPlayer(); void RenderShaderEditor(); + void handleKeyboard(); + void handleMouse(); };