feat(core): create an application that the engine manages instead of the user
This commit is contained in:
parent
8489b1e3a2
commit
1015569263
@ -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
|
||||||
|
24
engine/src/core/ICEApplication.cpp
Normal file
24
engine/src/core/ICEApplication.cpp
Normal 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");
|
||||||
|
}
|
||||||
|
}
|
19
engine/src/core/ICEApplication.hpp
Normal file
19
engine/src/core/ICEApplication.hpp
Normal 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();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user