- Updated License to GPL v3.0 - Added New Math Nodes - Prototype Rendering Code for Debugging Functions
69 lines
1.7 KiB
C++
69 lines
1.7 KiB
C++
// =====================================================================================================================
|
|
// OpenShaderDesigner, an open source software utility to create materials and shaders.
|
|
// Copyright (C) 2024 Medusa Slockbower
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
// =====================================================================================================================
|
|
|
|
#include <Editor/EditorWindow.h>
|
|
|
|
using namespace OpenShaderDesigner;
|
|
|
|
void EditorWindow::Open()
|
|
{
|
|
if(bOpen_) return;
|
|
bOpen_ = true;
|
|
OnOpen();
|
|
}
|
|
|
|
void EditorWindow::Draw()
|
|
{
|
|
const bool prev = bOpen_;
|
|
if(ImGui::Begin(Title.c_str(), &bOpen_, Flags_))
|
|
{
|
|
if(HasMenuBar())
|
|
{
|
|
if(ImGui::BeginMenuBar())
|
|
{
|
|
DrawMenu();
|
|
|
|
ImGui::EndMenuBar();
|
|
}
|
|
}
|
|
|
|
DrawWindow();
|
|
}
|
|
ImGui::End();
|
|
|
|
if(bOpen_ != prev)
|
|
{
|
|
bOpen_ ? OnOpen() : OnClose();
|
|
}
|
|
}
|
|
|
|
void EditorWindow::Close()
|
|
{
|
|
if(!bOpen_) return;
|
|
bOpen_ = false;
|
|
|
|
OnClose();
|
|
}
|
|
|
|
EditorWindow::EditorWindow(const std::string &title, ImGuiWindowFlags flags)
|
|
: Title(title)
|
|
, Flags_(flags)
|
|
, bOpen_(false)
|
|
{
|
|
|
|
} |