2026-02-13 19:15:05 +01:00
|
|
|
#ifndef CKERNEL_HPP
|
|
|
|
|
#define CKERNEL_HPP
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#define GLM_ENABLE_EXPERIMENTAL
|
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
|
#include <glm/gtx/transform.hpp>
|
|
|
|
|
#include <glm/gtc/type_ptr.hpp>
|
|
|
|
|
|
2026-04-17 21:00:35 +02:00
|
|
|
#include "../Systems/Graphics/Window/CGameWindow.hpp"
|
2026-02-13 19:15:05 +01:00
|
|
|
|
|
|
|
|
#include "../Scene/CScene.hpp"
|
|
|
|
|
|
|
|
|
|
namespace CosmicCore {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @file CKernel.hpp
|
|
|
|
|
* @brief Central class of the game, handle window and I/O.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Central class of the game, handle window and I/O.
|
|
|
|
|
*/
|
|
|
|
|
class CKernel {
|
|
|
|
|
private:
|
|
|
|
|
std::string m_configPath;
|
|
|
|
|
std::string m_gameName;
|
|
|
|
|
// The config.
|
|
|
|
|
//CGameConfiguration m_config;
|
|
|
|
|
//CEngineConfiguration m_engineConfig;
|
|
|
|
|
|
|
|
|
|
// The windows.
|
|
|
|
|
//CLoadingWindow m_loadingWindow;
|
2026-03-14 20:24:17 +01:00
|
|
|
CGameWindow m_window;
|
|
|
|
|
|
2026-02-13 19:15:05 +01:00
|
|
|
// Global game var.
|
|
|
|
|
bool m_finished;
|
|
|
|
|
unsigned int m_deltaTime;
|
|
|
|
|
|
|
|
|
|
// The Scenes.
|
2026-03-14 20:24:17 +01:00
|
|
|
CScene* m_activeScene;
|
|
|
|
|
std::map<std::string, std::unique_ptr<CScene>> m_sceneMap;
|
2026-02-13 19:15:05 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* @brief A pointer to the simulation which is accessible from anywhere.
|
|
|
|
|
*/
|
2026-03-14 20:24:17 +01:00
|
|
|
static CKernel* m_kernel;
|
2026-02-13 19:15:05 +01:00
|
|
|
|
|
|
|
|
CKernel() = delete;
|
|
|
|
|
CKernel(std::string name, std::string gameName);
|
|
|
|
|
|
|
|
|
|
~CKernel();
|
|
|
|
|
|
|
|
|
|
std::string getName() { return m_gameName; };
|
2026-04-02 00:07:49 +02:00
|
|
|
|
2026-02-13 19:15:05 +01:00
|
|
|
//CGameConfiguration* getConfig() { return &m_config; };
|
|
|
|
|
//CEngineConfiguration* getEngineConfig() { return &m_engineConfig; };
|
|
|
|
|
|
|
|
|
|
//void addScene(std::shared_ptr<CScene>& scene);
|
|
|
|
|
//void setActiveScene(std::string scene);
|
2026-04-02 00:07:49 +02:00
|
|
|
|
2026-03-14 20:24:17 +01:00
|
|
|
CScene* getActiveScene();
|
|
|
|
|
void cleanup(){m_sceneMap.clear();};
|
2026-04-02 00:07:49 +02:00
|
|
|
|
2026-02-13 19:15:05 +01:00
|
|
|
//unsigned int getNbScene() { return m_sceneList.size(); };
|
|
|
|
|
//std::map<std::string, CScene*>& getScenes() { return m_sceneList; };
|
|
|
|
|
|
|
|
|
|
/*CKeyboard* getKeyboard(void) {
|
|
|
|
|
return m_inputHandler.getKeyboard();
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
/*CMouse* getMouse(void) {
|
|
|
|
|
return m_inputHandler.getMouse();
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
unsigned int getDeltatime(void) {
|
|
|
|
|
return m_deltaTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setDeltatime(unsigned int delta){
|
|
|
|
|
m_deltaTime = delta;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//CGameWindow& getGameWindow(){return m_window;};
|
2026-04-02 00:07:49 +02:00
|
|
|
|
2026-02-13 19:15:05 +01:00
|
|
|
void start(bool isPreview = false);
|
|
|
|
|
void loop();
|
|
|
|
|
void quit();
|
|
|
|
|
void fullscreen();
|
|
|
|
|
void desktop();
|
|
|
|
|
void focus();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endif
|