88 lines
3.1 KiB
C++
88 lines
3.1 KiB
C++
// 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 <IAEngine/IAEngine.hpp>
|
|
#include <RenderCore/RenderCore.hpp>
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <Vendor/imgui/backends/imgui_impl_sdl3.h>
|
|
#include <Vendor/imgui/backends/imgui_impl_sdlgpu3.h>
|
|
|
|
#include <UI.hpp>
|
|
|
|
#include <View/AssetBrowser.hpp>
|
|
|
|
namespace ia::iae
|
|
{
|
|
EXTERN IVec2 g_windowExtent;
|
|
EXTERN RDC_Texture *g_gamePreviewTexture;
|
|
|
|
View_AssetBrowser g_assetBrowserView;
|
|
|
|
VOID UI::Initialize()
|
|
{
|
|
g_assetBrowserView.Initialize();
|
|
}
|
|
|
|
VOID UI::Terminate()
|
|
{
|
|
g_assetBrowserView.Terminate();
|
|
}
|
|
|
|
VOID UI::Update()
|
|
{
|
|
}
|
|
|
|
VOID UI::Draw()
|
|
{
|
|
ImVec2 gamePreviewViewSize = {(FLOAT32) gamePreviewResolution.x, (FLOAT32) gamePreviewResolution.y};
|
|
|
|
{ // Scene Nodes View
|
|
ImGui::Begin("Nodes", nullptr,
|
|
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
|
|
ImGui::SetWindowPos({0.0f, 0.0f});
|
|
ImGui::SetWindowSize({g_windowExtent.x / 2.0f - gamePreviewViewSize.x / 2.0f, gamePreviewViewSize.y + 35});
|
|
ImGui::End();
|
|
}
|
|
|
|
{ // Scene View
|
|
ImGui::Begin("Scene", nullptr,
|
|
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
|
|
ImGui::SetWindowPos({g_windowExtent.x / 2.0f - gamePreviewViewSize.x / 2.0f, 0.0f});
|
|
ImGui::Image(g_gamePreviewTexture->GetHandle(), gamePreviewViewSize);
|
|
ImGui::End();
|
|
}
|
|
|
|
{ // Properties View
|
|
ImGui::Begin("Properties", nullptr,
|
|
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
|
|
ImGui::SetWindowSize(
|
|
{g_windowExtent.x / 2.0f - gamePreviewViewSize.x / 2.0f - 15.0f, gamePreviewViewSize.y + 35});
|
|
ImGui::SetWindowPos({g_windowExtent.x - ImGui::GetWindowSize().x, 0.0f});
|
|
ImGui::End();
|
|
}
|
|
|
|
{ // Asset Browser View
|
|
ImGui::Begin("Asset Browser", nullptr,
|
|
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
|
|
ImGui::SetWindowPos({0.0f, gamePreviewViewSize.y + 35});
|
|
ImGui::SetWindowSize({(FLOAT32) g_windowExtent.x, (FLOAT32) g_windowExtent.y - gamePreviewViewSize.y - 35});
|
|
g_assetBrowserView.Render();
|
|
ImGui::End();
|
|
}
|
|
}
|
|
} // namespace ia::iae::editor
|