This commit is contained in:
Isuru Samarathunga
2025-11-10 09:49:22 +05:30
parent 73d26b2f35
commit 67cb23d589
69 changed files with 9716 additions and 194 deletions

BIN
Resources/logo-868x507.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
Resources/logo-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

BIN
Resources/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -1,4 +1,4 @@
<Resources>
<Assets>
<IAEngine>
<EngineVersion>1.0.0</EngineVersion>
<EditorVersion>1.0.0</EditorVersion>
@ -31,4 +31,4 @@
<TileSheet name="TileSheet_Cliff" path="Cute_Fantasy_Free/Tiles/Cliff_Tile.png" tileWidth="16" tileHeight="16"></TileSheet>
<TileSheet name="TileSheet_FarmLand" path="Cute_Fantasy_Free/Tiles/FarmLand_Tile.png" tileWidth="16" tileHeight="16"></TileSheet>
</Entries>
</Resources>
</Assets>

View File

Before

Width:  |  Height:  |  Size: 622 B

After

Width:  |  Height:  |  Size: 622 B

View File

Before

Width:  |  Height:  |  Size: 983 B

After

Width:  |  Height:  |  Size: 983 B

View File

Before

Width:  |  Height:  |  Size: 735 B

After

Width:  |  Height:  |  Size: 735 B

View File

Before

Width:  |  Height:  |  Size: 748 B

After

Width:  |  Height:  |  Size: 748 B

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 386 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 648 B

After

Width:  |  Height:  |  Size: 648 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 371 B

View File

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 99 B

View File

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 99 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 99 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -8,7 +8,7 @@
<Extent width="800" height="608"></Extent>
</Properties>
<Resources>
<Assets>
<Entry name="SpriteSheet_Player"></Entry>
<Entry name="TileSheet_MiddlePath"></Entry>
<Entry name="TileSheet_MiddleWater"></Entry>
@ -18,7 +18,7 @@
<Entry name="TileSheet_Beach"></Entry>
<Entry name="TileSheet_Cliff"></Entry>
<Entry name="TileSheet_FarmLand"></Entry>
</Resources>
</Assets>
<Nodes>

11
Samples/RPG/Project.iae Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<Project name="RPG Sample">
<IAEngine>
<EngineVersion>1.0.0</EngineVersion>
<EditorVersion>1.0.0</EditorVersion>
</IAEngine>
<Properties>
<Window x="1920" y="23" />
<StartupScene>MainMenu</StartupScene>
</Properties>
</Project>

View File

@ -1,6 +1,6 @@
add_subdirectory(Common/)
add_subdirectory(ConfigParser/)
add_subdirectory(ConfigData/)
add_subdirectory(RenderCore/)
add_subdirectory(IAEngine/)
add_subdirectory(CLI/)

View File

@ -18,6 +18,8 @@
#include <IACore/File.hpp>
#include <filesystem>
namespace ia::iae
{
ConfigData::ConfigData(IN pugi::xml_document &&document, IN CONST String &type, IN CONST String &name,
@ -29,7 +31,9 @@ namespace ia::iae
RefPtr<ConfigData> ConfigData::LoadFromFile(IN CONST String &path)
{
return LoadFromMemory(File::ReadToString(path));
const auto result = LoadFromMemory(File::ReadToString(path));
result->m_filePath = std::filesystem::canonical(path.c_str()).string().c_str();
return result;
}
RefPtr<ConfigData> ConfigData::LoadFromMemory(IN CONST String &data)
@ -76,6 +80,14 @@ namespace ia::iae
propertiesNode, IA_MOVE(childNodes));
}
VOID ConfigData::WriteChangesToDisk()
{
if (m_filePath.empty())
return;
m_document.save_file(m_filePath.c_str());
}
pugi::xml_node ConfigData::Property(IN CONST String &name)
{
return m_propertiesNode.child(name.c_str());

View File

@ -26,6 +26,8 @@ namespace ia::iae
STATIC RefPtr<ConfigData> LoadFromFile(IN CONST String &path);
STATIC RefPtr<ConfigData> LoadFromMemory(IN CONST String &data);
VOID WriteChangesToDisk();
public:
pugi::xml_node Property(IN CONST String &name);
@ -46,6 +48,8 @@ namespace ia::iae
}
private:
String m_filePath{};
CONST String m_type;
CONST String m_name;
CONST pugi::xml_document m_document;

View File

@ -1,11 +1,18 @@
set(SRC_FILES
"imp/cpp/UI.cpp"
"imp/cpp/Main.cpp"
"imp/cpp/Editor.cpp"
"imp/cpp/Project.cpp"
"imp/cpp/GamePreview.cpp"
"imp/cpp/View/AssetBrowser.cpp"
"imp/cpp/Project.cpp"
"imp/cpp/UI/UI.cpp"
"imp/cpp/UI/View/Main.cpp"
"imp/cpp/UI/View/Asset.cpp"
"imp/cpp/UI/View/AssetBrowser.cpp"
"imp/cpp/UI/View/Console.cpp"
"imp/cpp/UI/View/Nodes.cpp"
"imp/cpp/UI/View/Package.cpp"
"imp/cpp/UI/View/Scene.cpp"
"imp/cpp/UI/View/Properties.cpp"
# imgui
"imp/cpp/Vendor/imgui/imgui.cpp"

View File

@ -23,7 +23,9 @@
#include <Vendor/imgui/backends/imgui_impl_sdl3.h>
#include <Vendor/imgui/backends/imgui_impl_sdlgpu3.h>
#include <UI.hpp>
#include <UI/UI.hpp>
#include <LogoIcon.hpp>
namespace ia::iae
{
@ -40,6 +42,11 @@ namespace ia::iae
IVec2 g_windowExtent{800, 600};
RDC_Texture *g_gamePreviewTexture{};
VOID Editor::LoadProject(IN CONST String &directory)
{
m_activeProject = Project::Load(directory);
}
INT32 Editor::Run(IN INT32 argc, IN PCCHAR argv[])
{
INT32 frameCounter{0};
@ -48,13 +55,42 @@ namespace ia::iae
THROW_UNKNOWN("Failed to intialize SDL: ", SDL_GetError());
if (!(g_windowHandle = SDL_CreateWindow("IAEngine", g_windowExtent.x, g_windowExtent.y,
SDL_WINDOW_RESIZABLE | SDL_WINDOW_MAXIMIZED)))
SDL_WINDOW_RESIZABLE)))
THROW_UNKNOWN("Failed to create the SDL window: ", SDL_GetError());
LoadProject(".");
SDL_SetWindowPosition(g_windowHandle, m_activeProject->WindowPosition().x, m_activeProject->WindowPosition().y);
SDL_MaximizeWindow(g_windowHandle);
SDL_GetWindowSizeInPixels(g_windowHandle, &g_windowExtent.x, &g_windowExtent.y);
g_designViewport = gamePreviewResolution;
IAEngine::__Initialize();
SDL_Surface* iconSurface = SDL_CreateSurface(
LOGO_ICON_WIDTH,
LOGO_ICON_HEIGHT,
SDL_PIXELFORMAT_RGBA32
);
if(iconSurface)
{
for(UINT32 i = 0; i < LOGO_ICON_WIDTH * LOGO_ICON_HEIGHT * 4; i += 4)
{
STATIC UINT32 p{0xFFFFFFFF};
const auto pixel = ((PUINT8)&p);
const auto pixels = (PUINT8)iconSurface->pixels;
LOGO_ICON_GET_PIXEL(LOGO_ICON_DATA, pixel);
pixels[i + 0] = pixel[0];
pixels[i + 1] = pixel[1];
pixels[i + 2] = pixel[2];
pixels[i + 3] = 0xFF;
}
SDL_SetWindowIcon(g_windowHandle, iconSurface);
SDL_DestroySurface(iconSurface);
}
SDL_SetWindowTitle(g_windowHandle, BuildString("IAEngine - ", m_activeProject->Name()).c_str());
g_designViewport = SCENE_EDITOR_RESOULTION;
IAEngine::__Initialize(m_activeProject->AssetDirectory());
g_gamePreviewTexture = new RDC_Texture(RDC_Texture::EType::SAMPLED, g_designViewport.x, g_designViewport.y);
@ -67,8 +103,6 @@ namespace ia::iae
imGUIIO.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
imGUIIO.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
ImGui::StyleColorsClassic();
ImGuiStyle &style = ImGui::GetStyle();
style.ScaleAllSizes(mainScale);
style.FontScaleDpi = mainScale;
@ -83,6 +117,8 @@ namespace ia::iae
fontConfig.MergeMode = true;
fontConfig.PixelSnapH = true;
fontConfig.FontDataOwnedByAtlas = false;
fontConfig.GlyphOffset.y = 1.5f;
fontConfig.SizePixels = 12.0f;
static const ImWchar icon_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
imGUIIO.Fonts->AddFontDefault();
@ -149,6 +185,11 @@ namespace ia::iae
RDC_Device::WaitForIdle();
}
IVec2 currentWindowPosition{};
SDL_GetWindowPosition(g_windowHandle, &currentWindowPosition.x, &currentWindowPosition.y);
m_activeProject->WindowPosition() = currentWindowPosition;
m_activeProject->Update();
UI::Terminate();
ImGui_ImplSDL3_Shutdown();
@ -163,9 +204,16 @@ namespace ia::iae
return 0;
}
VOID Editor::LoadProject(IN CONST String &directory)
{
m_activeProject = Project::Load(directory);
}
} // namespace ia::iae
#include <IAEngine/LibInterface.hpp>
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)){}

View File

@ -15,21 +15,39 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <Project.hpp>
#include <ConfigData/ConfigData.hpp>
#include <filesystem>
namespace ia::iae
{
RefPtr<Project> Project::Load(IN CONST String &directory)
{
const auto config = ConfigData::LoadFromFile(BuildString(directory, "/", "Project.iae"));
return MakeRefPtr<Project>(config->Name(), std::filesystem::canonical(directory.c_str()).string().c_str());
auto config = ConfigData::LoadFromFile(BuildString(directory, "/", "Project.iae"));
return MakeRefPtr<Project>(config->Name(), std::filesystem::canonical(directory.c_str()).string().c_str(), IA_MOVE(config));
}
Project::Project(IN CONST String& name, IN CONST String& absolutePath):
m_projectName(name), m_projectAbsolutePath(absolutePath), m_assetDirectory(BuildString(absolutePath, "/Assets/"))
VOID Project::Update()
{
// Update Window Position
const auto windowNode = m_configData->Property("Window");
windowNode.attribute("x").set_value(m_windowPosition.x);
windowNode.attribute("y").set_value(m_windowPosition.y);
m_configData->WriteChangesToDisk();
}
Project::Project(IN CONST String &name, IN CONST String &absolutePath, IN RefPtr<ConfigData> &&configData)
: m_projectName(name), m_projectAbsolutePath(absolutePath),
m_assetDirectory(BuildString(absolutePath, "/Assets/")), m_configData(IA_MOVE(configData))
{
IA_ASSERT(std::filesystem::exists(m_assetDirectory.c_str()));
const auto windowNode = m_configData->Property("Window");
if(windowNode && windowNode.attribute("x") && windowNode.attribute("y"))
{
m_windowPosition.x = windowNode.attribute("x").as_int();
m_windowPosition.y = windowNode.attribute("y").as_int();
}
}
Project::~Project()

View File

@ -1,87 +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 <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

View File

View File

@ -0,0 +1,66 @@
// 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 <UI/UI.hpp>
#include <UI/View/Main.hpp>
namespace ia::iae
{
View_Main g_mainView{};
VOID UI::Initialize()
{
g_mainView.Initialize();
}
VOID UI::Terminate()
{
g_mainView.Terminate();
}
VOID UI::Update()
{
}
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();
}
g_mainView.Render();
}
} // namespace ia::iae

View File

@ -14,41 +14,24 @@
// 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 <GamePreview.hpp>
#include <RenderCore/RenderCore.hpp>
#include <UI/View/Asset.hpp>
namespace ia::iae
{
}
#include <IAEngine/LibInterface.hpp>
C_DECL(GameRequestedConfig *Game_GetConfigRequest())
VOID View_Asset::Initialize()
{
return nullptr;
SetName("Asset");
SetIcon(ICON_FA_STAR);
}
C_DECL(VOID Game_OnInitialize())
VOID View_Asset::Terminate()
{
}
C_DECL(VOID Game_OnTerminate())
VOID View_Asset::Render()
{
}
PreRender();
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))
{
PostRender();
}
} // namespace ia::iae

View File

@ -14,12 +14,15 @@
// 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 <View/AssetBrowser.hpp>
#include <UI/View/AssetBrowser.hpp>
namespace ia::iae
{
VOID View_AssetBrowser::Initialize()
{
SetName("Asset Browser");
SetIcon(ICON_FA_BOX_OPEN);
if (!std::filesystem::exists("Assets"))
THROW_INVALID_DATA("Not a valid IAEngine project directory");
m_assetDirectoryPath = std::filesystem::current_path() / "Assets/";
@ -35,30 +38,49 @@ namespace ia::iae
{
PreRender();
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2{7.5f, 7.5f});
if (ImGui::BeginTable("root", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_SizingStretchProp))
{
ImGui::TableSetupColumn("Navigation", ImGuiTableColumnFlags_WidthStretch, 0.25f);
ImGui::TableSetupColumn("Asset Browser", ImGuiTableColumnFlags_WidthStretch, 0.75f);
ImGui::TableSetupColumn("Navigation", ImGuiTableColumnFlags_WidthStretch, 0.15f);
ImGui::TableSetupColumn("Asset Browser", ImGuiTableColumnFlags_WidthStretch, 0.85f);
ImGui::TableNextColumn();
if (ImGui::BeginChild("Navigation", ImVec2(0, -FLT_MIN)))
if (ImGui::BeginChild("Navigation", ImVec2(0, -FLT_MIN), ImGuiChildFlags_AlwaysUseWindowPadding))
{
for (const auto &t : m_assetDirectoryFiles)
{
ImGui::Text("%s %s", t.Icon, t.Name.c_str());
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 1.75f);
if (ImGui::Selectable(t.IconAndName.c_str()) && t.IsDirectory)
ChangeCurrentOpenDirectory(t.Path);
}
}
ImGui::EndChild();
ImGui::TableNextColumn();
if (ImGui::BeginChild("Asset Browser", ImVec2(0, -FLT_MIN)))
if (ImGui::BeginChild("Asset Browser", ImVec2(0, -FLT_MIN), ImGuiChildFlags_AlwaysUseWindowPadding))
{
for (const auto &t : m_currentOpenDirectoryFiles)
{
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 1.75f);
if (ImGui::Selectable(t.IconAndName.c_str()))
{
if (t.IsDirectory)
{
ChangeCurrentOpenDirectory(t.Path);
break;
}
OpenAsset(t.Path);
}
}
}
ImGui::EndChild();
ImGui::EndTable();
}
ImGui::PopStyleVar();
PostRender();
}
@ -66,17 +88,25 @@ namespace ia::iae
{
m_currentOpenDirectoryPath = path;
std::filesystem::current_path(m_currentOpenDirectoryPath);
if (path == m_assetDirectoryPath)
m_currentOpenDirectoryFiles.clear();
else
FillFileEntries(m_currentOpenDirectoryPath, m_currentOpenDirectoryFiles);
}
VOID View_AssetBrowser::FillFileEntries(IN CONST std::filesystem::path &path, IN Vector<FileEntry> &fileEntries)
{
fileEntries.clear();
for (const auto &t : std::filesystem::directory_iterator(path))
{
if (!t.is_directory())
continue;
fileEntries.pushBack(
{.Icon = ICON_FA_FOLDER, .Name = t.path().filename().string().c_str(), .IsDirectory = true});
fileEntries.pushBack({.Icon = ICON_FA_FOLDER,
.Name = t.path().filename().string().c_str(),
.IsDirectory = true,
.Path = t.path()});
fileEntries.back().IconAndName = BuildString(fileEntries.back().Icon, " ", fileEntries.back().Name);
}
for (const auto &t : std::filesystem::directory_iterator(path))
{
@ -84,7 +114,9 @@ namespace ia::iae
continue;
fileEntries.pushBack({.Icon = GetFileEntryIcon(t.path().extension().string().c_str()),
.Name = t.path().filename().string().c_str(),
.IsDirectory = false});
.IsDirectory = false,
.Path = t.path()});
fileEntries.back().IconAndName = BuildString(fileEntries.back().Icon, " ", fileEntries.back().Name);
}
}
@ -92,6 +124,13 @@ namespace ia::iae
{
if (!strcmp(extension, ".xml"))
return ICON_FA_CODE;
return "";
if (!strcmp(extension, ".png") || !strcmp(extension, ".jpg"))
return ICON_FA_IMAGE;
return ICON_FA_FILE;
}
} // namespace ia::iae::editor
VOID View_AssetBrowser::OpenAsset(IN CONST std::filesystem::path &path)
{
}
} // namespace ia::iae

View File

@ -0,0 +1,37 @@
// 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/Console.hpp>
namespace ia::iae
{
VOID View_Console::Initialize()
{
SetName("Console");
SetIcon(ICON_FA_TERMINAL);
}
VOID View_Console::Terminate()
{
}
VOID View_Console::Render()
{
PreRender();
PostRender();
}
} // namespace ia::iae

View 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

View File

@ -0,0 +1,37 @@
// 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/Nodes.hpp>
namespace ia::iae
{
VOID View_Nodes::Initialize()
{
SetName("Nodes");
SetIcon(ICON_FA_CIRCLE_NODES);
}
VOID View_Nodes::Terminate()
{
}
VOID View_Nodes::Render()
{
PreRender();
PostRender();
}
} // namespace ia::iae

View File

@ -0,0 +1,37 @@
// 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/Package.hpp>
namespace ia::iae
{
VOID View_Package::Initialize()
{
SetName("Package");
SetIcon(ICON_FA_BOX_ARCHIVE);
}
VOID View_Package::Terminate()
{
}
VOID View_Package::Render()
{
PreRender();
PostRender();
}
} // namespace ia::iae

View File

@ -14,33 +14,24 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#pragma once
#include <Base.hpp>
#include <UI/View/Properties.hpp>
namespace ia::iae
{
class IView
VOID View_Properties::Initialize()
{
public:
PURE_VIRTUAL(VOID Initialize());
PURE_VIRTUAL(VOID Terminate());
PURE_VIRTUAL(VOID Render());
protected:
INLINE VOID PreRender();
INLINE VOID PostRender();
protected:
ImVec2 m_extent{};
};
VOID IView::PreRender()
{
m_extent = ImGui::GetWindowSize();
SetName("Properties");
SetIcon(ICON_FA_LIST);
}
VOID IView::PostRender()
VOID View_Properties::Terminate()
{
}
} // namespace ia::iae::editor
VOID View_Properties::Render()
{
PreRender();
PostRender();
}
} // namespace ia::iae

View File

@ -0,0 +1,37 @@
// 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/Scene.hpp>
namespace ia::iae
{
VOID View_Scene::Initialize()
{
SetName("Scene");
SetIcon(ICON_FA_HASHTAG);
}
VOID View_Scene::Terminate()
{
}
VOID View_Scene::Render()
{
PreRender();
PostRender();
}
} // namespace ia::iae

View File

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@
#pragma once
#include <Base.hpp>
#include <ConfigData/ConfigData.hpp>
namespace ia::iae
{
@ -25,7 +26,14 @@ namespace ia::iae
public:
STATIC RefPtr<Project> Load(IN CONST String &directory);
VOID Update();
public:
IVec2 &WindowPosition()
{
return m_windowPosition;
}
CONST String &Name() CONST
{
return m_projectName;
@ -37,12 +45,16 @@ namespace ia::iae
}
private:
IVec2 m_windowPosition{};
CONST String m_projectName;
CONST String m_assetDirectory;
CONST String m_projectAbsolutePath;
RefPtr<ConfigData> m_configData;
public:
Project(IN CONST String &name, IN CONST String &absolutePath);
Project(IN CONST String &name, IN CONST String &absolutePath, IN RefPtr<ConfigData>&& configData);
~Project();
};
} // namespace ia::iae

View File

@ -0,0 +1,31 @@
// 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/>.
#pragma once
#include <Base.hpp>
namespace ia::iae
{
STATIC CONSTEXPR IVec2 SCENE_EDITOR_RESOULTION = {800, 604};
STATIC CONSTEXPR Vec2 LAYOUT_TOP_LEFT_VIEW_EXTENT = {0.275f, 0.55f};
STATIC CONSTEXPR Vec2 LAYOUT_TOP_MIDDLE_VIEW_EXTENT = {0.45f, 0.55f};
STATIC CONSTEXPR Vec2 LAYOUT_TOP_RIGHT_VIEW_EXTENT = {0.275f, 0.55f};
STATIC CONSTEXPR Vec2 LAYOUT_BOTTOM_VIEW_EXTENT = {1.0f, 0.45f};
STATIC CONSTEXPR FLOAT32 MENUBAR_HEIGHT = 18.0f;
} // namespace ia::iae

View File

View File

@ -16,17 +16,16 @@
#pragma once
#include <Base.hpp>
#include <UI/Base.hpp>
namespace ia::iae
{
CONST IVec2 gamePreviewResolution = {800, 608};
class UI
{
public:
STATIC VOID Initialize();
STATIC VOID Terminate();
STATIC VOID Update();
STATIC VOID Draw();
};

View File

@ -16,12 +16,15 @@
#pragma once
#include <Base.hpp>
#include <UI/View/IView.hpp>
namespace ia::iae
{
class GamePreview
class View_Asset : public IView
{
public:
VOID Initialize();
VOID Terminate();
VOID Render();
};
}

View File

@ -16,7 +16,7 @@
#pragma once
#include <View/IView.hpp>
#include <UI/View/IView.hpp>
#include <filesystem>
@ -29,6 +29,8 @@ namespace ia::iae
PCCHAR Icon{""};
String Name{};
BOOL IsDirectory{};
String IconAndName{};
std::filesystem::path Path{};
};
public:
@ -42,6 +44,8 @@ namespace ia::iae
PCCHAR GetFileEntryIcon(IN PCCHAR extension);
VOID OpenAsset(IN CONST std::filesystem::path &path);
private:
Vector<FileEntry> m_assetDirectoryFiles;
std::filesystem::path m_assetDirectoryPath{};

View File

@ -0,0 +1,30 @@
// 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/>.
#pragma once
#include <UI/View/IView.hpp>
namespace ia::iae
{
class View_Console : public IView
{
public:
VOID Initialize();
VOID Terminate();
VOID Render();
};
}

View File

@ -0,0 +1,79 @@
// 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/>.
#pragma once
#include <UI/Base.hpp>
namespace ia::iae
{
class IView
{
public:
PURE_VIRTUAL(VOID Initialize());
PURE_VIRTUAL(VOID Terminate());
PURE_VIRTUAL(VOID Render());
public:
VOID SetIcon(IN PCCHAR icon)
{
m_icon = icon;
m_iconAndName = BuildString(m_icon, " ", m_name);
}
VOID SetName(IN CONST String &name)
{
m_name = name;
m_iconAndName = m_icon ? BuildString(m_icon, " ", m_name) : m_name;
}
public:
CONST String &Name() CONST
{
return m_name;
}
CONST PCCHAR Icon() CONST
{
return m_icon;
}
CONST String &IconAndName() CONST
{
return m_iconAndName;
}
protected:
INLINE VOID PreRender();
INLINE VOID PostRender();
protected:
ImVec2 m_extent{};
String m_name{};
PCCHAR m_icon{};
String m_iconAndName{};
};
VOID IView::PreRender()
{
m_extent = ImGui::GetWindowSize();
}
VOID IView::PostRender()
{
}
} // namespace ia::iae

View File

@ -0,0 +1,30 @@
// 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/>.
#pragma once
#include <UI/View/IView.hpp>
namespace ia::iae
{
class View_Main : public IView
{
public:
VOID Initialize();
VOID Terminate();
VOID Render();
};
} // namespace ia::iae

View File

@ -0,0 +1,30 @@
// 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/>.
#pragma once
#include <UI/View/IView.hpp>
namespace ia::iae
{
class View_Nodes : public IView
{
public:
VOID Initialize();
VOID Terminate();
VOID Render();
};
}

View File

@ -0,0 +1,30 @@
// 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/>.
#pragma once
#include <UI/View/IView.hpp>
namespace ia::iae
{
class View_Package : public IView
{
public:
VOID Initialize();
VOID Terminate();
VOID Render();
};
}

View File

@ -0,0 +1,30 @@
// 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/>.
#pragma once
#include <UI/View/IView.hpp>
namespace ia::iae
{
class View_Properties : public IView
{
public:
VOID Initialize();
VOID Terminate();
VOID Render();
};
}

View File

@ -0,0 +1,30 @@
// 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/>.
#pragma once
#include <UI/View/IView.hpp>
namespace ia::iae
{
class View_Scene : public IView
{
public:
VOID Initialize();
VOID Terminate();
VOID Render();
};
}

View File

View File

@ -82,7 +82,7 @@ namespace ia::iae
// EmbeddedResources::Initialize();
IAEngine::__Initialize();
IAEngine::__Initialize("./Assets/");
SDL_Event event{};
while (true)
@ -117,7 +117,7 @@ namespace ia::iae
namespace ia::iae
{
VOID IAEngine::__Initialize()
VOID IAEngine::__Initialize(IN CONST String& assetDirectory)
{
g_isHeadlessMode = false;
@ -125,6 +125,7 @@ namespace ia::iae
g_defaultAssetManager = new AssetManager();
g_assetManager = g_defaultAssetManager;
g_assetManager->SetAssetDirectory(assetDirectory);
GameData::Initialize();
@ -138,7 +139,7 @@ namespace ia::iae
p->OnInitialize();
}
VOID IAEngine::__InitializeHeadless()
VOID IAEngine::__InitializeHeadless(IN CONST String& assetDirectory)
{
g_isHeadlessMode = true;
@ -147,6 +148,7 @@ namespace ia::iae
g_defaultAssetManager = new AssetManager();
g_assetManager = g_defaultAssetManager;
g_assetManager->SetAssetDirectory(assetDirectory);
GameData::Initialize();

View File

@ -45,8 +45,8 @@ namespace ia::iae
IN BOOL flipH = false, IN BOOL flipV = false, IN Vec2 uvOffset = {});
public:
STATIC VOID __Initialize();
STATIC VOID __InitializeHeadless();
STATIC VOID __Initialize(IN CONST String& assetDirectory);
STATIC VOID __InitializeHeadless(IN CONST String& assetDirectory);
STATIC VOID __Terminate();
STATIC VOID __RenderToWindow();
STATIC VOID __RenderToTexture(IN PVOID textureHandle);