Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 26 additions & 21 deletions Hazel/src/Hazel/Core/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,37 +90,40 @@ namespace Hazel {
{
HZ_PROFILE_FUNCTION();

while (m_Running)
{
while (m_Running) {
HZ_PROFILE_SCOPE("RunLoop");
OnUpdate();
}
}

float time = Time::GetTime();
Timestep timestep = time - m_LastFrameTime;
m_LastFrameTime = time;
void Application::OnUpdate()
{
float time = Time::GetTime();
Timestep timestep = time - m_LastFrameTime;
m_LastFrameTime = time;

ExecuteMainThreadQueue();
ExecuteMainThreadQueue();

if (!m_Minimized)
if (!m_Minimized)
{
{
{
HZ_PROFILE_SCOPE("LayerStack OnUpdate");
HZ_PROFILE_SCOPE("LayerStack OnUpdate");

for (Layer* layer : m_LayerStack)
layer->OnUpdate(timestep);
}
for (Layer* layer : m_LayerStack)
layer->OnUpdate(timestep);
}

m_ImGuiLayer->Begin();
{
HZ_PROFILE_SCOPE("LayerStack OnImGuiRender");
m_ImGuiLayer->Begin();
{
HZ_PROFILE_SCOPE("LayerStack OnImGuiRender");

for (Layer* layer : m_LayerStack)
layer->OnImGuiRender();
}
m_ImGuiLayer->End();
for (Layer* layer : m_LayerStack)
layer->OnImGuiRender();
}

m_Window->OnUpdate();
m_ImGuiLayer->End();
}

m_Window->OnUpdate();
}

bool Application::OnWindowClose(WindowCloseEvent& e)
Expand All @@ -142,6 +145,8 @@ namespace Hazel {
m_Minimized = false;
Renderer::OnWindowResize(e.GetWidth(), e.GetHeight());

OnUpdate();

return false;
}

Expand Down
1 change: 1 addition & 0 deletions Hazel/src/Hazel/Core/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ namespace Hazel {
void SubmitToMainThread(const std::function<void()>& function);
private:
void Run();
void OnUpdate();
bool OnWindowClose(WindowCloseEvent& e);
bool OnWindowResize(WindowResizeEvent& e);

Expand Down