CSEngine
Loading...
Searching...
No Matches
CSE::EngineCore Class Reference

Public Member Functions

 DECLARE_SINGLETON (EngineCore)
 
 GET_CORE_FUNCTION (ResMgr, m_resMgr)
 
 GET_CORE_FUNCTION (GameObjectMgr, m_gameObjectMgr)
 
 GET_CORE_FUNCTION (RenderMgr, m_renderMgr)
 
 GET_CORE_FUNCTION (CameraMgr, m_cameraMgr)
 
 GET_CORE_FUNCTION (LightMgr, m_lightMgr)
 
 GET_CORE_FUNCTION (SceneMgr, m_sceneMgr)
 
 GET_CORE_FUNCTION (MemoryMgr, m_memoryMgr)
 
 GET_CORE_FUNCTION (ScriptMgr, m_scriptMgr)
 
void Init (unsigned int width, unsigned int height)
 
void Update (float elapsedTime)
 
void LateUpdate (float elapsedTime)
 
void Render () const
 
void Exterminate ()
 
void ResizeWindow (unsigned int width, unsigned int height)
 
void GenerateCores ()
 

Detailed Description

Definition at line 34 of file EngineCore.h.

Constructor & Destructor Documentation

◆ ~EngineCore()

EngineCore::~EngineCore ( )

Definition at line 32 of file EngineCore.cpp.

32 {
33
34}

Member Function Documentation

◆ Exterminate()

void EngineCore::Exterminate ( )

Definition at line 72 of file EngineCore.cpp.

72 {
73 static_cast<MemoryMgr*>(m_memoryMgr)->ExterminateObjects(true);
74 for (auto core : m_cores) {
75 SAFE_DELETE(core);
76 }
77 m_cores.clear();
78}

◆ GenerateCores()

void EngineCore::GenerateCores ( )

Definition at line 80 of file EngineCore.cpp.

80 {
81 if(m_isGenerated) return;
82 m_isGenerated = true;
83 m_cores = std::vector<CoreBase*>();
84 m_cores.reserve(ENGINE_COUNT);
85
86 m_resMgr = new ResMgr();
87 m_gameObjectMgr = new GameObjectMgr();
88 m_oglMgr = new OGLMgr();
89 m_renderMgr = new RenderMgr();
90 m_cameraMgr = new CameraMgr();
91 m_lightMgr = new LightMgr();
92 m_sceneMgr = new SceneMgr();
93 m_memoryMgr = new MemoryMgr();
94 m_scriptMgr = new ScriptMgr();
95
96 m_cores.push_back(m_resMgr);
97 m_cores.push_back(m_gameObjectMgr);
98 m_updateCores.push_back(m_gameObjectMgr);
99
100 m_cores.push_back(m_oglMgr);
101 m_renderCores.push_back(m_oglMgr);
102 m_cores.push_back(m_renderMgr);
103 m_renderCores.push_back(dynamic_cast<RenderCoreBase* const>(m_renderMgr));
104 m_cores.push_back(m_cameraMgr);
105 m_cores.push_back(m_lightMgr);
106
107 m_cores.push_back(m_sceneMgr);
108 m_updateCores.push_back(m_sceneMgr);
109 m_cores.push_back(m_memoryMgr);
110
111 m_cores.push_back(m_scriptMgr);
112}
Class for managing rendering operations.
Definition RenderMgr.h:21

◆ Init()

void EngineCore::Init ( unsigned int  width,
unsigned int  height 
)

Definition at line 36 of file EngineCore.cpp.

36 {
37 GenerateCores();
38
39 for (const auto& core : m_cores) {
40 core->Init();
41 }
42
43 m_oglMgr->ResizeWindow(width, height);
44 static_cast<RenderMgr*>(m_renderMgr)->SetViewport();
45
46
47#ifdef __EMSCRIPTEN__
48 static_cast<SceneMgr*>(m_sceneMgr)->SetScene(new WebDemoScene());
49#else
50 static_cast<SceneMgr*>(m_sceneMgr)->SetScene(new FirstDemoScene());
51// SScene* scene = SSceneLoader::LoadScene(CSE::AssetsPath() + "Scene/animation.scene");
52// m_sceneMgr->SetScene(scene);
53#endif
54}

◆ LateUpdate()

void EngineCore::LateUpdate ( float  elapsedTime)

Definition at line 62 of file EngineCore.cpp.

62 {
63 m_gameObjectMgr->DestroyQueuedObject();
64}

◆ Render()

void EngineCore::Render ( ) const

Definition at line 66 of file EngineCore.cpp.

66 {
67 for (const auto& core : m_renderCores) {
68 core->Render();
69 }
70}

◆ ResizeWindow()

void EngineCore::ResizeWindow ( unsigned int  width,
unsigned int  height 
)

Definition at line 114 of file EngineCore.cpp.

114 {
115 m_oglMgr->ResizeWindow(width, height);
116 static_cast<RenderMgr*>(m_renderMgr)->SetViewport();
117}

◆ Update()

void EngineCore::Update ( float  elapsedTime)

Definition at line 56 of file EngineCore.cpp.

56 {
57 for (const auto& core : m_updateCores) {
58 core->Update(elapsedTime);
59 }
60}

The documentation for this class was generated from the following files: