Fixes
This commit is contained in:
108
Src/Editor/imp/cpp/UI/TabContainer.cpp
Normal file
108
Src/Editor/imp/cpp/UI/TabContainer.cpp
Normal file
@ -0,0 +1,108 @@
|
||||
// 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/TabContainer.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
INT32 g_tabContainerCount{0};
|
||||
|
||||
TabContainer::TabContainer() : m_containerID(BuildString("TabContainer##", g_tabContainerCount++)), m_tabBarID(BuildString("TabBar##", g_tabContainerCount++))
|
||||
{
|
||||
}
|
||||
|
||||
VOID TabContainer::Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
VOID TabContainer::Terminate()
|
||||
{
|
||||
for (const auto &t : m_tabViews)
|
||||
RemoveTab(t->Key);
|
||||
}
|
||||
|
||||
VOID TabContainer::Draw(IN ImVec2 position, IN ImVec2 size)
|
||||
{
|
||||
ImGui::Begin(m_containerID.c_str(), nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoTitleBar);
|
||||
ImGui::SetWindowPos(position);
|
||||
ImGui::SetWindowSize(size);
|
||||
ImGui::BeginTabBar(m_tabBarID.c_str());
|
||||
|
||||
for (const auto &v : m_tabViews)
|
||||
{
|
||||
ImGuiTabItemFlags flags{};
|
||||
if (m_pendingActiveTabName && m_pendingActiveTabName == v->Key)
|
||||
{
|
||||
flags |= ImGuiTabItemFlags_SetSelected;
|
||||
m_pendingActiveTabName = nullptr;
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem(v->Value->IconAndName().c_str(), nullptr, flags))
|
||||
{
|
||||
v->Value->Render();
|
||||
ImGui::EndTabItem();
|
||||
|
||||
m_activeTabName = v->Key.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTabBar();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
VOID TabContainer::Update()
|
||||
{
|
||||
for (const auto &t : m_tabViews)
|
||||
t->Value->Update();
|
||||
}
|
||||
|
||||
VOID TabContainer::ProcessEvent(IN SDL_Event *event)
|
||||
{
|
||||
for (const auto &t : m_tabViews)
|
||||
t->Value->ProcessEvent(event);
|
||||
}
|
||||
|
||||
VOID TabContainer::AddTab(IN CONST String &name, IN IView *view)
|
||||
{
|
||||
RemoveTab(name);
|
||||
view->Initialize();
|
||||
m_tabViews[name] = view;
|
||||
if (!m_activeTabName)
|
||||
m_activeTabName = name.c_str();
|
||||
}
|
||||
|
||||
VOID TabContainer::RemoveTab(IN CONST String &name)
|
||||
{
|
||||
if (!m_tabViews.contains(name))
|
||||
return;
|
||||
if (m_tabViews[name])
|
||||
m_tabViews[name]->Terminate();
|
||||
delete m_tabViews[name];
|
||||
m_tabViews[name] = nullptr;
|
||||
}
|
||||
|
||||
VOID TabContainer::ChangeActiveTab(IN PCCHAR name)
|
||||
{
|
||||
m_pendingActiveTabName = name;
|
||||
}
|
||||
|
||||
IView *TabContainer::GetTab(IN CONST String &name)
|
||||
{
|
||||
return m_tabViews[name];
|
||||
}
|
||||
} // namespace ia::iae
|
||||
@ -18,49 +18,166 @@
|
||||
#include <RenderCore/RenderCore.hpp>
|
||||
|
||||
#include <UI/UI.hpp>
|
||||
#include <UI/View/Main.hpp>
|
||||
#include <UI/View/Asset.hpp>
|
||||
#include <UI/View/AssetBrowser.hpp>
|
||||
#include <UI/View/Console.hpp>
|
||||
#include <UI/View/Nodes.hpp>
|
||||
#include <UI/View/Package.hpp>
|
||||
#include <UI/View/Properties.hpp>
|
||||
#include <UI/View/Scene.hpp>
|
||||
|
||||
#include <UI/TabContainer.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
View_Main g_mainView{};
|
||||
STATIC CONSTEXPR PCCHAR VIEW_NAME_ASSET_BROWSER = "AssetBrowser";
|
||||
STATIC CONSTEXPR PCCHAR VIEW_NAME_ASSET = "Asset";
|
||||
STATIC CONSTEXPR PCCHAR VIEW_NAME_CONSOLE = "Console";
|
||||
STATIC CONSTEXPR PCCHAR VIEW_NAME_NODES = "Nodes";
|
||||
STATIC CONSTEXPR PCCHAR VIEW_NAME_PACKAGE = "Package";
|
||||
STATIC CONSTEXPR PCCHAR VIEW_NAME_PROPERTIES = "Properties";
|
||||
STATIC CONSTEXPR PCCHAR VIEW_NAME_SCENE = "SCENE";
|
||||
|
||||
EXTERN IVec2 g_windowExtent;
|
||||
|
||||
IView *UI::s_focusedView{};
|
||||
|
||||
TabContainer g_tabContainerB;
|
||||
TabContainer g_tabContainerTL;
|
||||
TabContainer g_tabContainerTM;
|
||||
TabContainer g_tabContainerTR;
|
||||
|
||||
VOID UI::FocusAssetView()
|
||||
{
|
||||
g_tabContainerTR.ChangeActiveTab(VIEW_NAME_ASSET);
|
||||
}
|
||||
|
||||
class View_Asset *UI::GetAssetView()
|
||||
{
|
||||
return (View_Asset*)g_tabContainerTR.GetTab(VIEW_NAME_ASSET);
|
||||
}
|
||||
|
||||
VOID UI::Initialize()
|
||||
{
|
||||
g_mainView.Initialize();
|
||||
g_tabContainerB.Initialize();
|
||||
g_tabContainerTL.Initialize();
|
||||
g_tabContainerTM.Initialize();
|
||||
g_tabContainerTR.Initialize();
|
||||
|
||||
g_tabContainerB.AddTab<View_AssetBrowser>(VIEW_NAME_ASSET_BROWSER);
|
||||
g_tabContainerB.AddTab<View_Console>(VIEW_NAME_CONSOLE);
|
||||
|
||||
g_tabContainerTL.AddTab<View_Nodes>(VIEW_NAME_NODES);
|
||||
g_tabContainerTL.AddTab<View_Package>(VIEW_NAME_PACKAGE);
|
||||
|
||||
g_tabContainerTM.AddTab<View_Scene>(VIEW_NAME_SCENE);
|
||||
|
||||
g_tabContainerTR.AddTab<View_Properties>(VIEW_NAME_PROPERTIES);
|
||||
g_tabContainerTR.AddTab<View_Asset>(VIEW_NAME_ASSET);
|
||||
}
|
||||
|
||||
VOID UI::Terminate()
|
||||
{
|
||||
g_mainView.Terminate();
|
||||
g_tabContainerB.Terminate();
|
||||
g_tabContainerTL.Terminate();
|
||||
g_tabContainerTM.Terminate();
|
||||
g_tabContainerTR.Terminate();
|
||||
}
|
||||
|
||||
VOID UI::Update()
|
||||
{
|
||||
g_tabContainerB.Update();
|
||||
g_tabContainerTL.Update();
|
||||
g_tabContainerTM.Update();
|
||||
g_tabContainerTR.Update();
|
||||
}
|
||||
|
||||
VOID UI::ProcessEvent(IN SDL_Event *event)
|
||||
{
|
||||
g_tabContainerB.ProcessEvent(event);
|
||||
g_tabContainerTL.ProcessEvent(event);
|
||||
g_tabContainerTM.ProcessEvent(event);
|
||||
g_tabContainerTR.ProcessEvent(event);
|
||||
}
|
||||
|
||||
VOID UI::Draw()
|
||||
{
|
||||
if (ImGui::BeginMainMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("File"))
|
||||
{
|
||||
if (ImGui::MenuItem("New Scene", nullptr, nullptr))
|
||||
{
|
||||
}
|
||||
//padY();
|
||||
if (ImGui::MenuItem("Open Scene", nullptr, nullptr))
|
||||
{
|
||||
}
|
||||
//padY();
|
||||
ImGui::Separator();
|
||||
//padY();
|
||||
if (ImGui::MenuItem("Exit", nullptr, nullptr))
|
||||
SDL_Quit();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
DrawMenuBar();
|
||||
|
||||
g_mainView.Render();
|
||||
g_tabContainerB.Draw({0.0f, LAYOUT_TOP_MIDDLE_VIEW_EXTENT.y * g_windowExtent.y + MENUBAR_HEIGHT},
|
||||
{g_windowExtent.x * LAYOUT_BOTTOM_VIEW_EXTENT.x,
|
||||
g_windowExtent.y * LAYOUT_BOTTOM_VIEW_EXTENT.y - MENUBAR_HEIGHT});
|
||||
g_tabContainerTL.Draw({0.0f, MENUBAR_HEIGHT}, {g_windowExtent.x * LAYOUT_TOP_LEFT_VIEW_EXTENT.x,
|
||||
g_windowExtent.y * LAYOUT_TOP_LEFT_VIEW_EXTENT.y});
|
||||
g_tabContainerTM.Draw(
|
||||
{g_windowExtent.x * LAYOUT_TOP_LEFT_VIEW_EXTENT.x, MENUBAR_HEIGHT},
|
||||
{g_windowExtent.x * LAYOUT_TOP_MIDDLE_VIEW_EXTENT.x, g_windowExtent.y * LAYOUT_TOP_MIDDLE_VIEW_EXTENT.y});
|
||||
g_tabContainerTR.Draw(
|
||||
{g_windowExtent.x * (1.0f - LAYOUT_TOP_RIGHT_VIEW_EXTENT.x), MENUBAR_HEIGHT},
|
||||
{g_windowExtent.x * LAYOUT_TOP_RIGHT_VIEW_EXTENT.x, g_windowExtent.y * LAYOUT_TOP_RIGHT_VIEW_EXTENT.y});
|
||||
}
|
||||
|
||||
VOID UI::DrawMenuBar()
|
||||
{
|
||||
if (ImGui::BeginMainMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("File"))
|
||||
{
|
||||
if (ImGui::MenuItem("New Scene", nullptr, nullptr))
|
||||
{
|
||||
}
|
||||
UI::PadY();
|
||||
if (ImGui::MenuItem("Open Scene", nullptr, nullptr))
|
||||
{
|
||||
}
|
||||
UI::PadY();
|
||||
ImGui::Separator();
|
||||
UI::PadY();
|
||||
if (ImGui::MenuItem("Exit", nullptr, nullptr))
|
||||
SDL_Quit();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
}
|
||||
|
||||
VOID UI::PadX(IN FLOAT32 v)
|
||||
{
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + v);
|
||||
}
|
||||
|
||||
VOID UI::PadY(IN FLOAT32 v)
|
||||
{
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + v);
|
||||
}
|
||||
|
||||
VOID UI::AlignCursorLeft(IN CONST ImRect &rect)
|
||||
{
|
||||
ImGui::SetCursorPosX(rect.GetTL().x);
|
||||
}
|
||||
|
||||
VOID UI::AlignCursorRight(IN CONST ImRect &rect, IN FLOAT32 width)
|
||||
{
|
||||
ImGui::SetCursorPosX(rect.GetWidth() - width);
|
||||
}
|
||||
|
||||
VOID UI::AlignCursorTop(IN CONST ImRect &rect)
|
||||
{
|
||||
ImGui::SetCursorPosY(rect.AsVec4().y);
|
||||
}
|
||||
|
||||
VOID UI::AlignCursorBottom(IN CONST ImRect &rect, IN FLOAT32 height)
|
||||
{
|
||||
ImGui::SetCursorPosY(rect.GetHeight() - height);
|
||||
}
|
||||
|
||||
VOID UI::AlignCursorHCenter(IN CONST ImRect &rect, IN FLOAT32 width)
|
||||
{
|
||||
ImGui::SetCursorPosX((rect.GetWidth() - width) / 2.0f);
|
||||
}
|
||||
|
||||
VOID UI::AlignCursorVCenter(IN CONST ImRect &rect, IN FLOAT32 height)
|
||||
{
|
||||
ImGui::SetCursorPosY((rect.GetHeight() - height) / 2.0f);
|
||||
}
|
||||
} // namespace ia::iae
|
||||
|
||||
@ -18,6 +18,11 @@
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
struct AssetCacheEntry
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
VOID View_Asset::Initialize()
|
||||
{
|
||||
SetName("Asset");
|
||||
@ -32,6 +37,33 @@ namespace ia::iae
|
||||
{
|
||||
PreRender();
|
||||
|
||||
if(m_assetPath.empty())
|
||||
{
|
||||
PostRender();
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::Text("%s", m_assetPath.filename().string().c_str());
|
||||
|
||||
PostRender();
|
||||
}
|
||||
|
||||
VOID View_Asset::Update()
|
||||
{
|
||||
}
|
||||
|
||||
VOID View_Asset::OnEvent(IN SDL_Event *event)
|
||||
{
|
||||
}
|
||||
|
||||
VOID View_Asset::Open(IN Path path)
|
||||
{
|
||||
Close();
|
||||
m_assetPath = path;
|
||||
}
|
||||
|
||||
VOID View_Asset::Close()
|
||||
{
|
||||
m_assetPath = Path();
|
||||
}
|
||||
} // namespace ia::iae
|
||||
@ -14,6 +14,7 @@
|
||||
// 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.hpp>
|
||||
#include <UI/View/AssetBrowser.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
@ -51,8 +52,15 @@ namespace ia::iae
|
||||
for (const auto &t : m_assetDirectoryFiles)
|
||||
{
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 1.75f);
|
||||
if (ImGui::Selectable(t.IconAndName.c_str()) && t.IsDirectory)
|
||||
ChangeCurrentOpenDirectory(t.Path);
|
||||
if (ImGui::Selectable(t.IconAndName.c_str()))
|
||||
{
|
||||
if (t.IsDirectory)
|
||||
{
|
||||
ChangeCurrentOpenDirectory(t.Path);
|
||||
break;
|
||||
}
|
||||
OpenAsset(t.Path);
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
@ -84,6 +92,14 @@ namespace ia::iae
|
||||
PostRender();
|
||||
}
|
||||
|
||||
VOID View_AssetBrowser::Update()
|
||||
{
|
||||
}
|
||||
|
||||
VOID View_AssetBrowser::OnEvent(IN SDL_Event *event)
|
||||
{
|
||||
}
|
||||
|
||||
VOID View_AssetBrowser::ChangeCurrentOpenDirectory(IN CONST std::filesystem::path &path)
|
||||
{
|
||||
m_currentOpenDirectoryPath = path;
|
||||
@ -131,6 +147,6 @@ namespace ia::iae
|
||||
|
||||
VOID View_AssetBrowser::OpenAsset(IN CONST std::filesystem::path &path)
|
||||
{
|
||||
|
||||
Editor::Instance().OpenAsset(path);
|
||||
}
|
||||
} // namespace ia::iae
|
||||
@ -34,4 +34,13 @@ namespace ia::iae
|
||||
|
||||
PostRender();
|
||||
}
|
||||
|
||||
VOID View_Console::Update(){
|
||||
|
||||
}
|
||||
|
||||
VOID View_Console::OnEvent(IN SDL_Event *event)
|
||||
{
|
||||
|
||||
}
|
||||
} // namespace ia::iae
|
||||
38
Src/Editor/imp/cpp/UI/View/IView.cpp
Normal file
38
Src/Editor/imp/cpp/UI/View/IView.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
// 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/IView.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
VOID IView::ProcessEvent(IN SDL_Event *event)
|
||||
{
|
||||
if (UI::GetFocusedView() == this)
|
||||
OnEvent(event);
|
||||
}
|
||||
|
||||
VOID IView::SetIcon(IN PCCHAR icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
m_iconAndName = BuildString(m_icon, " ", m_name);
|
||||
}
|
||||
|
||||
VOID IView::SetName(IN CONST String &name)
|
||||
{
|
||||
m_name = name;
|
||||
m_iconAndName = m_icon ? BuildString(m_icon, " ", m_name) : m_name;
|
||||
}
|
||||
} // namespace ia::iae
|
||||
@ -1,161 +0,0 @@
|
||||
// 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
|
||||
@ -34,4 +34,13 @@ namespace ia::iae
|
||||
|
||||
PostRender();
|
||||
}
|
||||
|
||||
VOID View_Nodes::Update(){
|
||||
|
||||
}
|
||||
|
||||
VOID View_Nodes::OnEvent(IN SDL_Event *event)
|
||||
{
|
||||
|
||||
}
|
||||
} // namespace ia::iae
|
||||
@ -34,4 +34,13 @@ namespace ia::iae
|
||||
|
||||
PostRender();
|
||||
}
|
||||
|
||||
VOID View_Package::Update(){
|
||||
|
||||
}
|
||||
|
||||
VOID View_Package::OnEvent(IN SDL_Event *event)
|
||||
{
|
||||
|
||||
}
|
||||
} // namespace ia::iae
|
||||
@ -34,4 +34,13 @@ namespace ia::iae
|
||||
|
||||
PostRender();
|
||||
}
|
||||
|
||||
VOID View_Properties::Update(){
|
||||
|
||||
}
|
||||
|
||||
VOID View_Properties::OnEvent(IN SDL_Event *event)
|
||||
{
|
||||
|
||||
}
|
||||
} // namespace ia::iae
|
||||
@ -14,24 +14,86 @@
|
||||
// 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.hpp>
|
||||
#include <UI/View/Scene.hpp>
|
||||
|
||||
#include <RenderCore/RenderCore.hpp>
|
||||
|
||||
#include <IAEngine/LibInterface.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
VOID View_Scene::Initialize()
|
||||
{
|
||||
SetName("Scene");
|
||||
SetIcon(ICON_FA_HASHTAG);
|
||||
|
||||
IAEngine::__Initialize(SCENE_EDITOR_RESOULTION, Editor::Instance().GetActiveProject()->AssetDirectory());
|
||||
|
||||
m_gamePreviewTexture = new RDC_Texture(RDC_Texture::EType::SAMPLED, SCENE_EDITOR_RESOULTION.x, SCENE_EDITOR_RESOULTION.y);
|
||||
}
|
||||
|
||||
VOID View_Scene::Terminate()
|
||||
{
|
||||
delete m_gamePreviewTexture;
|
||||
}
|
||||
|
||||
VOID View_Scene::Render()
|
||||
{
|
||||
PreRender();
|
||||
|
||||
ImGui::Image(m_gamePreviewTexture->GetHandle(), {SCENE_EDITOR_RESOULTION.x, SCENE_EDITOR_RESOULTION.y});
|
||||
|
||||
PostRender();
|
||||
}
|
||||
} // namespace ia::iae
|
||||
|
||||
VOID View_Scene::Update()
|
||||
{
|
||||
STATIC INT32 frameCounter{0};
|
||||
|
||||
IAEngine::__Update();
|
||||
|
||||
frameCounter++;
|
||||
if (frameCounter >= 60)
|
||||
{
|
||||
frameCounter = 0;
|
||||
IAEngine::__FixedUpdate();
|
||||
}
|
||||
|
||||
IAEngine::__RenderToTexture(m_gamePreviewTexture->GetHandle());
|
||||
}
|
||||
|
||||
VOID View_Scene::OnEvent(IN SDL_Event *event)
|
||||
{
|
||||
IAEngine::__ProcessEvent(event);
|
||||
}
|
||||
} // namespace ia::iae
|
||||
|
||||
C_DECL(GameRequestedConfig *Game_GetConfigRequest())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
C_DECL(VOID Game_OnInitialize())
|
||||
{
|
||||
}
|
||||
|
||||
C_DECL(VOID Game_OnTerminate())
|
||||
{
|
||||
}
|
||||
|
||||
C_DECL(VOID Game_OnDebugDraw())
|
||||
{
|
||||
}
|
||||
|
||||
C_DECL(VOID Game_OnFixedUpdate())
|
||||
{
|
||||
}
|
||||
|
||||
C_DECL(VOID Game_OnUpdate(IN FLOAT32 deltaTime))
|
||||
{
|
||||
}
|
||||
|
||||
C_DECL(VOID Game_OnResize(IN INT32 newWidth, IN INT32 newHeight))
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user