Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed the screen flickering issue when resizing the window from … #616

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion Hazel/src/Hazel/Core/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ namespace Hazel {

ExecuteMainThreadQueue();

m_Window->OnUpdate();

if (!m_Minimized)
{
{
Expand All @@ -119,7 +121,7 @@ namespace Hazel {
m_ImGuiLayer->End();
}

m_Window->OnUpdate();
m_Window->OnRender();
}
}

Expand Down
1 change: 1 addition & 0 deletions Hazel/src/Hazel/Core/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace Hazel {
virtual ~Window() = default;

virtual void OnUpdate() = 0;
virtual void OnRender() = 0;

virtual uint32_t GetWidth() const = 0;
virtual uint32_t GetHeight() const = 0;
Expand Down
6 changes: 6 additions & 0 deletions Hazel/src/Platform/Windows/WindowsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ namespace Hazel {
HZ_PROFILE_FUNCTION();

glfwPollEvents();
}

void WindowsWindow::OnRender()
{
HZ_PROFILE_FUNCTION();

m_Context->SwapBuffers();
}

Expand Down
3 changes: 2 additions & 1 deletion Hazel/src/Platform/Windows/WindowsWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Hazel {
virtual ~WindowsWindow();

void OnUpdate() override;
void OnRender() override;

unsigned int GetWidth() const override { return m_Data.Width; }
unsigned int GetHeight() const override { return m_Data.Height; }
Expand Down Expand Up @@ -43,4 +44,4 @@ namespace Hazel {
WindowData m_Data;
};

}
}