CSEngine
Loading...
Searching...
No Matches
EngineCore.h
1//
2// Created by ounol on 2021-03-22.
3//
4#pragma once
5
6#include <vector>
7#include <list>
8#include "../MacroDef.h"
9#include "Base/CoreBase.h"
10#include "Base/RenderCoreBase.h"
11
12#define GET_CORE_FUNCTION(CORENAME, core_instance) \
13CORENAME* Get##CORENAME##Core() const { \
14 return static_cast<CORENAME*>(core_instance); \
15}
16
17#define CORE EngineCore::getInstance()
18#define GetCore(CORENAME) Get##CORENAME##Core()
19
20// Core Class Predeclaration
21namespace CSE {
22 class ResMgr;
23 class GameObjectMgr;
24 class RenderMgr;
25 class CameraMgr;
26 class LightMgr;
27 class SceneMgr;
28 class MemoryMgr;
29 class ScriptMgr;
30 class OGLMgr;
31}
32
33namespace CSE {
34 class EngineCore {
35 public:
36 DECLARE_SINGLETON(EngineCore);
38
39 GET_CORE_FUNCTION(ResMgr, m_resMgr);
40 GET_CORE_FUNCTION(GameObjectMgr, m_gameObjectMgr);
41 GET_CORE_FUNCTION(RenderMgr, m_renderMgr);
42 GET_CORE_FUNCTION(CameraMgr, m_cameraMgr);
43 GET_CORE_FUNCTION(LightMgr, m_lightMgr);
44 GET_CORE_FUNCTION(SceneMgr, m_sceneMgr);
45 GET_CORE_FUNCTION(MemoryMgr, m_memoryMgr);
46 GET_CORE_FUNCTION(ScriptMgr, m_scriptMgr);
47
48 void Init(unsigned int width, unsigned int height);
49 void Update(float elapsedTime);
50 void LateUpdate(float elapsedTime);
51 void Render() const;
52 void Exterminate();
53 void ResizeWindow(unsigned int width, unsigned int height);
54 void GenerateCores();
55
56 private:
57 std::vector<CoreBase*> m_cores;
58 std::list<RenderCoreBase*> m_renderCores;
59 std::list<CoreBase*> m_updateCores;
60
61 //For Reference
62 ResMgr* m_resMgr = nullptr;
63 GameObjectMgr* m_gameObjectMgr = nullptr;
64 RenderMgr* m_renderMgr = nullptr;
65 CameraMgr* m_cameraMgr = nullptr;
66 LightMgr* m_lightMgr = nullptr;
67 SceneMgr* m_sceneMgr = nullptr;
68 MemoryMgr* m_memoryMgr = nullptr;
69 ScriptMgr* m_scriptMgr = nullptr;
70
71 OGLMgr* m_oglMgr = nullptr;
72
73 bool m_isGenerated = false;
74 };
75}
Class for managing rendering operations.
Definition RenderMgr.h:21