Project Skeleton 1/2

This commit is contained in:
Isuru Samarathunga
2025-10-03 21:20:05 +05:30
parent be7a1df305
commit ff73221cae
16 changed files with 464 additions and 1 deletions

View File

@ -0,0 +1,13 @@
set(SRC_FILES
"Src/Imp/CPP/Engine.cpp"
)
add_library(IAEngine SHARED ${SRC_FILES})
target_compile_definitions(IAEngine PRIVATE "__BUILDING_IAENGINE=1")
target_include_directories(IAEngine PUBLIC Src/Inc)
target_include_directories(IAEngine PRIVATE Src/Imp/HPP)
target_link_libraries(IAEngine PUBLIC IACore ImGui glm::glm)
target_link_libraries(IAEngine PRIVATE SDL3::SDL3 SDL3_mixer::SDL3_mixer RmlUi::RmlUi)

View File

@ -0,0 +1,74 @@
// 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 <Engine.hpp>
#include <IAEngine/Engine.hpp>
GameFunctionTable g_gameFunctions{};
//SDL_SetAppMetadata("SDL Hello World Example", "1.0", "com.example.sdl-hello-world");
namespace ia::iae
{
}
#include <IAEngine/EngineInterface.hpp>
BOOL ValidateGameFunctionTable(IN GameFunctionTable gameFunctionTable)
{
if(!gameFunctionTable.OnInitialize) return false;
if(!gameFunctionTable.OnTerminate) return false;
if(!gameFunctionTable.OnDebugDraw) return false;
if(!gameFunctionTable.OnFixedUpdate) return false;
if(!gameFunctionTable.OnUpdate) return false;
if(!gameFunctionTable.OnResize) return false;
if(!gameFunctionTable.GetName) return false;
if(!gameFunctionTable.GetVersion) return false;
if(!gameFunctionTable.GetPackageName) return false;
if(!gameFunctionTable.GetDeveloperName) return false;
if(!gameFunctionTable.GetPublisherName) return false;
return true;
}
C_DECL(IAE_DLL_API ia::BOOL IAEngine_OnInitialize(IN GameFunctionTable gameFunctionTable))
{
if(!ValidateGameFunctionTable(gameFunctionTable))
{
IAE_LOG_ERROR("Invalid game function table was passed to the engine. Exiting..");
return false;
}
g_gameFunctions = gameFunctionTable;
IAE_LOG_INFO("Booting IAEngine for ", gameFunctionTable.GetName());
return true;
}
C_DECL(IAE_DLL_API ia::VOID IAEngine_OnTerminate())
{
IAE_LOG_INFO("Shutting down IAEngine");
}
C_DECL(IAE_DLL_API ia::BOOL IAEngine_OnIterate())
{
return true;
}
C_DECL(IAE_DLL_API ia::VOID IAEngine_OnEvent(IN PVOID event))
{
}

View File

@ -0,0 +1,24 @@
// 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 <IAEngine/Base.hpp>
namespace ia::iae
{
}

View File

@ -0,0 +1,43 @@
// 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 <IACore/Logger.hpp>
#include <IACore/Vector.hpp>
#include <IACore/Memory.hpp>
#include <IACore/String.hpp>
#include <IACore/Exception.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <glm/mat4x4.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/ext/matrix_clip_space.hpp>
#include <glm/ext/scalar_constants.hpp>
#define IAE_LOG_TAG "[IAE]: "
#define IAE_LOG_INFO(...) ia::Logger::Info(IAE_LOG_TAG, __VA_ARGS__)
#define IAE_LOG_WARN(...) ia::Logger::Warn(IAE_LOG_TAG, __VA_ARGS__)
#define IAE_LOG_ERROR(...) ia::Logger::Error(IAE_LOG_TAG, __VA_ARGS__)
namespace ia::iae
{
using Handle = INT64;
STATIC CONSTEXPR Handle INVALID_HANDLE = -1;
} // namespace ia::iae

View File

@ -0,0 +1,24 @@
// 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 <IAEngine/Base.hpp>
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 <IAEngine/GameInterface.hpp>
#if defined(__BUILDING_IAENGINE) && (__BUILDING_IAENGINE)
#define IAE_DLL_API IA_DLL_EXPORT
#else
#define IAE_DLL_API IA_DLL_IMPORT
#endif
C_DECL(IAE_DLL_API ia::BOOL IAEngine_OnInitialize(IN GameFunctionTable gameFunctionTable));
C_DECL(IAE_DLL_API ia::VOID IAEngine_OnTerminate());
C_DECL(IAE_DLL_API ia::BOOL IAEngine_OnIterate());
C_DECL(IAE_DLL_API ia::VOID IAEngine_OnEvent(IN PVOID event));

View File

@ -0,0 +1,62 @@
// 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 <IAEngine/Engine.hpp>
using namespace ia;
using namespace ia::iae;
#if defined(__BUILDING_IAENGINE_GAME) && (__BUILDING_IAENGINE_GAME)
#define GAME_LOG_TAG "[GAME]: "
#define GAME_LOG_INFO(...) ia::Logger::Info(IAE_LOG_TAG, __VA_ARGS__)
#define GAME_LOG_WARN(...) ia::Logger::Warn(IAE_LOG_TAG, __VA_ARGS__)
#define GAME_LOG_ERROR(...) ia::Logger::Error(IAE_LOG_TAG, __VA_ARGS__)
C_DECL(IA_DLL_EXPORT VOID Game_OnInitialize());
C_DECL(IA_DLL_EXPORT VOID Game_OnTerminate());
C_DECL(IA_DLL_EXPORT VOID Game_OnDebugDraw());
C_DECL(IA_DLL_EXPORT VOID Game_OnFixedUpdate());
C_DECL(IA_DLL_EXPORT VOID Game_OnUpdate(IN FLOAT32 deltaTime));
C_DECL(IA_DLL_EXPORT VOID Game_OnResize(IN INT32 newWidth, IN INT32 newHeight));
C_DECL(IA_DLL_EXPORT PCCHAR Game_GetName());
C_DECL(IA_DLL_EXPORT UINT64 Game_GetVersion());
C_DECL(IA_DLL_EXPORT PCCHAR Game_GetPackageName());
C_DECL(IA_DLL_EXPORT PCCHAR Game_GetDeveloperName());
C_DECL(IA_DLL_EXPORT PCCHAR Game_GetPublisherName());
#else
struct GameFunctionTable
{
VOID (*OnInitialize)() {nullptr};
VOID (*OnTerminate)() {nullptr};
VOID (*OnDebugDraw)() {nullptr};
VOID (*OnFixedUpdate)() {nullptr};
VOID (*OnUpdate)(IN FLOAT32 deltaTime) {nullptr};
VOID (*OnResize)(IN INT32 newWidth, IN INT32 newHeight) {nullptr};
PCCHAR (*GetName)() {nullptr};
UINT64 (*GetVersion)() {nullptr};
PCCHAR (*GetPackageName)() {nullptr};
PCCHAR (*GetDeveloperName)() {nullptr};
PCCHAR (*GetPublisherName)() {nullptr};
};
#endif