diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index 3060c1c77..8ab0245e5 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -363,6 +363,22 @@ void EditorComponent::Load() float step = 105, x = -step; + cinemaModeCheckBox = new wiCheckBox("Cinema Mode: "); + cinemaModeCheckBox->SetSize(XMFLOAT2(20, 20)); + cinemaModeCheckBox->SetPos(XMFLOAT2(screenW - 55 - 860 - 120, 0)); + cinemaModeCheckBox->SetTooltip("Toggle Cinema Mode (All HUD disabled). Press ESC to exit."); + cinemaModeCheckBox->OnClick([&](wiEventArgs args) { + if (renderPath != nullptr) + { + renderPath->GetGUI().SetVisible(false); + } + GetGUI().SetVisible(false); + wiProfiler::GetInstance().ENABLED = false; + main->infoDisplay.active = false; + }); + GetGUI().AddWidget(cinemaModeCheckBox); + + wiComboBox* renderPathComboBox = new wiComboBox("Render Path: "); renderPathComboBox->SetSize(XMFLOAT2(100, 20)); renderPathComboBox->SetPos(XMFLOAT2(screenW - 55 - 860, 0)); @@ -890,6 +906,20 @@ void EditorComponent::Update(float dt) cam->Lerp(cam, cameraWnd->proxy, 1.0f - cameraWnd->followSlider->GetValue()); } + // Exit cinema mode: + if (wiInputManager::GetInstance()->down(VK_ESCAPE)) + { + if (renderPath != nullptr) + { + renderPath->GetGUI().SetVisible(true); + } + GetGUI().SetVisible(true); + wiProfiler::GetInstance().ENABLED = true; + main->infoDisplay.active = true; + + cinemaModeCheckBox->SetCheck(false); + } + if (!wiBackLog::isActive() && !GetGUI().HasFocus()) { @@ -1429,6 +1459,7 @@ void EditorComponent::Update(float dt) void EditorComponent::Render() { // hover box + if (!cinemaModeCheckBox->GetCheck()) { if (hovered.object != nullptr) { @@ -1449,7 +1480,7 @@ void EditorComponent::Render() } - if (!selected.empty()) + if (!cinemaModeCheckBox->GetCheck() && !selected.empty()) { if (translator_active) { @@ -1491,6 +1522,11 @@ void EditorComponent::Compose() { renderPath->Compose(); + if (cinemaModeCheckBox->GetCheck()) + { + return; + } + //static Texture2D* clouds = nullptr; //if (clouds == nullptr) //{ diff --git a/Editor/Editor.h b/Editor/Editor.h index 95dab5697..a7ca8c5b2 100644 --- a/Editor/Editor.h +++ b/Editor/Editor.h @@ -50,6 +50,8 @@ public: Editor* main; + wiCheckBox* cinemaModeCheckBox; + EditorLoadingScreen* loader; Renderable3DComponent* renderPath; enum RENDERPATH diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index aa20e8067..e014dff23 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -6,7 +6,7 @@ using namespace std; -wiGUI::wiGUI(GRAPHICSTHREAD threadID) :threadID(threadID), activeWidget(nullptr), focus(false), pointerpos(XMFLOAT2(0,0)) +wiGUI::wiGUI(GRAPHICSTHREAD threadID) :threadID(threadID), activeWidget(nullptr), focus(false), visible(true), pointerpos(XMFLOAT2(0,0)) { } @@ -18,6 +18,11 @@ wiGUI::~wiGUI() void wiGUI::Update(float dt) { + if (!visible) + { + return; + } + XMFLOAT4 _p = wiInputManager::GetInstance()->getpointer(); pointerpos.x = _p.x; pointerpos.y = _p.y; @@ -49,6 +54,11 @@ void wiGUI::Update(float dt) void wiGUI::Render() { + if (!visible) + { + return; + } + wiRenderer::GetDevice()->EventBegin("GUI", GetGraphicsThread()); for (auto&x : widgets) { @@ -128,5 +138,10 @@ bool wiGUI::IsWidgetDisabled(wiWidget* widget) } bool wiGUI::HasFocus() { + if (!visible) + { + return false; + } + return focus; } diff --git a/WickedEngine/wiGUI.h b/WickedEngine/wiGUI.h index 06ec3b628..546f9deb2 100644 --- a/WickedEngine/wiGUI.h +++ b/WickedEngine/wiGUI.h @@ -16,6 +16,7 @@ private: wiWidget* activeWidget; GRAPHICSTHREAD threadID; bool focus; + bool visible; XMFLOAT2 pointerpos; public: @@ -38,6 +39,9 @@ public: // returns true if any gui element has the focus bool HasFocus(); + void SetVisible(bool value) { visible = value; } + bool IsVisible() { return visible; } + GRAPHICSTHREAD GetGraphicsThread() { return threadID; } void ResetScissor(); diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 8210d29d7..d75324370 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 18; // minor bug fixes, alterations, refactors, updates - const int revision = 2; + const int revision = 3; long GetVersion()