This commit is contained in:
Isuru Samarathunga
2025-10-09 19:28:54 +05:30
parent 1f9d5426b8
commit 96bad30f15
25 changed files with 813 additions and 69 deletions

View File

@ -38,15 +38,17 @@ namespace ia::iae
VOID __Internal_Engine::Initialize()
{
const auto config = g_gameFunctions.GetConfigRequest();
IAE_LOG_INFO("Booting IAEngine for ", g_gameFunctions.GetName());
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMEPAD))
THROW_UNKNOWN("Failed to intialize SDL: ", SDL_GetError());
if (!(g_windowHandle = SDL_CreateWindow(g_gameFunctions.GetName(), 800, 600, SDL_WINDOW_RESIZABLE)))
if (!(g_windowHandle = SDL_CreateWindow(g_gameFunctions.GetName(), config.ScreenWidth, config.ScreenHeight, SDL_WINDOW_RESIZABLE)))
THROW_UNKNOWN("Failed to create the SDL window: ", SDL_GetError());
SDL_SetWindowResizable(g_windowHandle, false);
//SDL_SetWindowResizable(g_windowHandle, false);
const auto gameVersion = g_gameFunctions.GetVersion();
SDL_SetAppMetadata(g_gameFunctions.GetName(), BuildString(gameVersion).c_str(),
@ -60,6 +62,7 @@ namespace ia::iae
InputManager::Initialize();
ResourceManager::Initialize();
WorldManager::Initialize();
UI::Initialize();
g_gameFunctions.OnInitialize();
}
@ -68,6 +71,7 @@ namespace ia::iae
{
g_gameFunctions.OnTerminate();
UI::Terminate();
WorldManager::Terminate();
ResourceManager::Terminate();
InputManager::Terminate();
@ -84,6 +88,7 @@ namespace ia::iae
VOID __Internal_Engine::Iterate()
{
UI::Update();
WorldManager::Update();
WorldManager::FixedUpdate();
g_gameFunctions.OnUpdate(Time::GetFrameDeltaTime());
@ -91,6 +96,7 @@ namespace ia::iae
Renderer::BeginFrame();
WorldManager::Draw();
UI::Draw();
Renderer::EndFrame();
}
@ -104,6 +110,7 @@ namespace ia::iae
}
InputManager::OnSDLEvent(event);
EventManager::OnSDLEvent(event);
UI::OnSDLEvent(event);
ImGui_ImplSDL3_ProcessEvent(event);
}
@ -115,6 +122,8 @@ namespace ia::iae
BOOL ValidateGameFunctionTable(IN GameFunctionTable gameFunctionTable)
{
if (!gameFunctionTable.GetConfigRequest)
return false;
if (!gameFunctionTable.OnInitialize)
return false;
if (!gameFunctionTable.OnTerminate)