feat(core): create an application that the engine manages instead of the user

This commit is contained in:
illyum 2024-09-16 23:28:37 -06:00
parent 8489b1e3a2
commit 1015569263
3 changed files with 44 additions and 0 deletions

View File

@ -6,5 +6,6 @@
#define ICENGINE_HPP #define ICENGINE_HPP
#include "src/core/Logger.hpp" #include "src/core/Logger.hpp"
#include "src/core/ICEApplication.hpp"
#endif //ICENGINE_HPP #endif //ICENGINE_HPP

View File

@ -0,0 +1,24 @@
//
// Created by illyum on 9/15/2024.
//
#include "ICEngine.hpp"
#include "pch.hpp"
namespace ICEngine {
void StartApplication() {
Log::Init();
CORE_LOG_TRACE("Starting ICEngine");
ICEApplication* app = CreateICEApplication();
if (app) {
CORE_LOG_TRACE("Starting User Application");
app->Run();
delete app;
} else {
CORE_LOG_FATAL("Could not start User Application");
}
CORE_LOG_TRACE("Shutting down ICEngine");
}
}

View File

@ -0,0 +1,19 @@
//
// Created by illyum on 9/15/2024.
//
#pragma once
namespace ICEngine {
class ICEApplication {
public:
ICEApplication() {}
virtual ~ICEApplication() {}
virtual void Run() = 0;
};
void StartApplication(); // Starts the application, managed by the engine.
// Application-specific function that will be defined by the user
extern ICEApplication* CreateICEApplication();
}