// 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 . #include #include #include #include #include #include #include #include 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 g_bViews = {&g_assetBrowserView, &g_consoleView}; Vector g_tlViews = {&g_nodesView, &g_packageView}; Vector g_tmViews = {&g_sceneView}; Vector 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