Fixes
This commit is contained in:
161
Src/Editor/imp/cpp/UI/View/Main.cpp
Normal file
161
Src/Editor/imp/cpp/UI/View/Main.cpp
Normal file
@ -0,0 +1,161 @@
|
||||
// IAEngine: 2D Game Engine by IA
|
||||
// Copyright (C) 2025 IASoft (PVT) LTD (oss@iasoft.dev)
|
||||
//
|
||||
// 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 <UI/View/AssetBrowser.hpp>
|
||||
#include <UI/View/Main.hpp>
|
||||
#include <UI/View/Scene.hpp>
|
||||
#include <UI/View/Asset.hpp>
|
||||
#include <UI/View/Console.hpp>
|
||||
#include <UI/View/Nodes.hpp>
|
||||
#include <UI/View/Package.hpp>
|
||||
#include <UI/View/Properties.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
EXTERN IVec2 g_windowExtent;
|
||||
|
||||
View_Scene g_sceneView;
|
||||
View_Asset g_assetView;
|
||||
View_Console g_consoleView;
|
||||
View_Nodes g_nodesView;
|
||||
View_Package g_packageView;
|
||||
View_Properties g_propertiesView;
|
||||
View_AssetBrowser g_assetBrowserView;
|
||||
|
||||
Vector<IView *> g_bViews = {&g_assetBrowserView, &g_consoleView};
|
||||
Vector<IView *> g_tlViews = {&g_nodesView, &g_packageView};
|
||||
Vector<IView *> g_tmViews = {&g_sceneView};
|
||||
Vector<IView *> g_trViews = {&g_propertiesView, &g_assetView};
|
||||
|
||||
VOID View_Main::Initialize()
|
||||
{
|
||||
for (const auto &v : g_bViews)
|
||||
v->Initialize();
|
||||
for (const auto &v : g_tlViews)
|
||||
v->Initialize();
|
||||
for (const auto &v : g_tmViews)
|
||||
v->Initialize();
|
||||
for (const auto &v : g_trViews)
|
||||
v->Initialize();
|
||||
}
|
||||
|
||||
VOID View_Main::Terminate()
|
||||
{
|
||||
for (const auto &v : g_bViews)
|
||||
v->Terminate();
|
||||
for (const auto &v : g_tlViews)
|
||||
v->Terminate();
|
||||
for (const auto &v : g_tmViews)
|
||||
v->Terminate();
|
||||
for (const auto &v : g_trViews)
|
||||
v->Terminate();
|
||||
}
|
||||
|
||||
VOID View_Main::Render()
|
||||
{
|
||||
PreRender();
|
||||
|
||||
{ // Top Left Window
|
||||
ImGui::Begin("TL_Window", nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoTitleBar);
|
||||
ImGui::SetWindowPos({0.0f, MENUBAR_HEIGHT});
|
||||
ImGui::SetWindowSize(
|
||||
{g_windowExtent.x * LAYOUT_TOP_LEFT_VIEW_EXTENT.x, g_windowExtent.y * LAYOUT_TOP_LEFT_VIEW_EXTENT.y});
|
||||
ImGui::BeginTabBar("TL_TabBar");
|
||||
|
||||
for (const auto &v : g_tlViews)
|
||||
{
|
||||
if (ImGui::BeginTabItem(v->IconAndName().c_str()))
|
||||
{
|
||||
v->Render();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTabBar();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
{ // Top Middle Window
|
||||
ImGui::Begin("TM_Window", nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoTitleBar);
|
||||
ImGui::SetWindowPos({g_windowExtent.x * LAYOUT_TOP_LEFT_VIEW_EXTENT.x, MENUBAR_HEIGHT});
|
||||
ImGui::SetWindowSize({g_windowExtent.x * LAYOUT_TOP_MIDDLE_VIEW_EXTENT.x,
|
||||
g_windowExtent.y * LAYOUT_TOP_MIDDLE_VIEW_EXTENT.y});
|
||||
ImGui::BeginTabBar("TM_TabBar");
|
||||
|
||||
for (const auto &v : g_tmViews)
|
||||
{
|
||||
if (ImGui::BeginTabItem(v->IconAndName().c_str()))
|
||||
{
|
||||
v->Render();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTabBar();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
{ // Top Right Window
|
||||
ImGui::Begin("TR_Window", nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoTitleBar);
|
||||
ImGui::SetWindowPos({g_windowExtent.x * (1.0f - LAYOUT_TOP_RIGHT_VIEW_EXTENT.x), MENUBAR_HEIGHT});
|
||||
ImGui::SetWindowSize(
|
||||
{g_windowExtent.x * LAYOUT_TOP_RIGHT_VIEW_EXTENT.x, g_windowExtent.y * LAYOUT_TOP_RIGHT_VIEW_EXTENT.y});
|
||||
ImGui::BeginTabBar("TR_TabBar");
|
||||
|
||||
for (const auto &v : g_trViews)
|
||||
{
|
||||
if (ImGui::BeginTabItem(v->IconAndName().c_str()))
|
||||
{
|
||||
v->Render();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTabBar();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
{ // Bottom Window
|
||||
ImGui::Begin("B_Window", nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoTitleBar);
|
||||
ImGui::SetWindowPos({0.0f, LAYOUT_TOP_MIDDLE_VIEW_EXTENT.y * g_windowExtent.y + MENUBAR_HEIGHT});
|
||||
ImGui::SetWindowSize(
|
||||
{g_windowExtent.x * LAYOUT_BOTTOM_VIEW_EXTENT.x, g_windowExtent.y * LAYOUT_BOTTOM_VIEW_EXTENT.y - MENUBAR_HEIGHT});
|
||||
ImGui::BeginTabBar("B_TabBar");
|
||||
|
||||
for (const auto &v : g_bViews)
|
||||
{
|
||||
if (ImGui::BeginTabItem(v->IconAndName().c_str()))
|
||||
{
|
||||
v->Render();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTabBar();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
PostRender();
|
||||
}
|
||||
} // namespace ia::iae
|
||||
Reference in New Issue
Block a user