diff --git a/examples/common/entry_windows.cpp b/examples/common/entry_windows.cpp index d30f3e5c..b4070a80 100644 --- a/examples/common/entry_windows.cpp +++ b/examples/common/entry_windows.cpp @@ -328,9 +328,16 @@ namespace entry case WM_SIZE: { - m_width = GET_X_LPARAM(_lparam); - m_height = GET_Y_LPARAM(_lparam); - m_eventQueue.postSizeEvent(m_width, m_height); + uint32_t width = GET_X_LPARAM(_lparam); + uint32_t height = GET_Y_LPARAM(_lparam); + + if (m_width != width + || m_height != height) + { + m_width = width; + m_height = height; + m_eventQueue.postSizeEvent(m_width, m_height); + } } break; diff --git a/examples/common/processevents.h b/examples/common/processevents.h index ec8f4aab..9dc96b63 100644 --- a/examples/common/processevents.h +++ b/examples/common/processevents.h @@ -10,6 +10,8 @@ inline bool processEvents(uint32_t& _width, uint32_t& _height, uint32_t& _debug) { using namespace entry; + bool resize = false; + const Event* ev; do { @@ -68,9 +70,9 @@ inline bool processEvents(uint32_t& _width, uint32_t& _height, uint32_t& _debug) case Event::Size: { const SizeEvent* size = static_cast(ev); - bgfx::reset(size->m_width, size->m_height); _width = size->m_width; _height = size->m_height; + resize = true; } break; @@ -80,6 +82,11 @@ inline bool processEvents(uint32_t& _width, uint32_t& _height, uint32_t& _debug) } } while (NULL != ev); + if (resize) + { + bgfx::reset(_width, _height); + } + return false; }