refactor(close #12): Clean Engine::Run function
This commit is contained in:
parent
9a866d16ef
commit
a87e392d71
@ -4,5 +4,7 @@
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
Editor::Init();
|
Editor::Init();
|
||||||
std::cout << argv << std::endl;
|
std::cout << "Argument count: " << argc << std::endl;
|
||||||
|
for(int i = 0; i < argc; i++)
|
||||||
|
std::cout << "Arguments: " << argv[i] << std::endl;
|
||||||
}
|
}
|
@ -28,7 +28,6 @@ public:
|
|||||||
|
|
||||||
static void Init();
|
static void Init();
|
||||||
static void Render();
|
static void Render();
|
||||||
static void End();
|
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
|
|
||||||
static RendererData GetData();
|
static RendererData GetData();
|
||||||
|
@ -20,10 +20,7 @@ Engine::~Engine()
|
|||||||
void Engine::Run()
|
void Engine::Run()
|
||||||
{
|
{
|
||||||
while (!glfwWindowShouldClose(m_Window->GetWindow())) {
|
while (!glfwWindowShouldClose(m_Window->GetWindow())) {
|
||||||
UI::Run();
|
|
||||||
Renderer::Render();
|
Renderer::Render();
|
||||||
UI::Render(*Renderer::GetData().m_FBO);
|
|
||||||
Renderer::End();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +71,12 @@ void Renderer::SetupBuffers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Render() {
|
void Renderer::Render() {
|
||||||
|
glfwPollEvents();
|
||||||
glClearColor(0.0f, 0.1f, 0.2f, 1.0f);
|
glClearColor(0.0f, 0.1f, 0.2f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
UI::Run();
|
||||||
|
|
||||||
s_Data.m_FBO->Bind();
|
s_Data.m_FBO->Bind();
|
||||||
|
|
||||||
s_Data.m_Shader->Use();
|
s_Data.m_Shader->Use();
|
||||||
@ -83,12 +87,10 @@ void Renderer::Render() {
|
|||||||
s_Data.m_VAO->Bind();
|
s_Data.m_VAO->Bind();
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
FrameBuffer::Unbind();
|
FrameBuffer::Unbind();
|
||||||
}
|
|
||||||
|
|
||||||
void Renderer::End()
|
UI::Render(*s_Data.m_FBO);
|
||||||
{
|
|
||||||
glfwSwapBuffers(Engine::Get().GetWindow().GetWindow());
|
glfwSwapBuffers(Engine::Get().GetWindow().GetWindow());
|
||||||
glfwPollEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Shutdown()
|
void Renderer::Shutdown()
|
||||||
@ -97,4 +99,5 @@ void Renderer::Shutdown()
|
|||||||
s_Data.m_VBO->Shutdown();
|
s_Data.m_VBO->Shutdown();
|
||||||
s_Data.m_FBO->Shutdown();
|
s_Data.m_FBO->Shutdown();
|
||||||
s_Data.m_Shader->Shutdown();
|
s_Data.m_Shader->Shutdown();
|
||||||
|
s_Data.m_Texture->Shutdown();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user