set gui visible mode + editor cinema mode

This commit is contained in:
turanszkij
2018-07-05 12:50:29 +02:00
parent 7a82885d4b
commit bcc407073f
5 changed files with 60 additions and 3 deletions
+37 -1
View File
@@ -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)
//{
+2
View File
@@ -50,6 +50,8 @@ public:
Editor* main;
wiCheckBox* cinemaModeCheckBox;
EditorLoadingScreen* loader;
Renderable3DComponent* renderPath;
enum RENDERPATH
+16 -1
View File
@@ -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;
}
+4
View File
@@ -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();
+1 -1
View File
@@ -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()