mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
Fixed resize event spamming.
This commit is contained in:
parent
21bb4e2073
commit
a664aef521
2 changed files with 18 additions and 4 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<const SizeEvent*>(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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue