Fixed resize event spamming.

This commit is contained in:
bkaradzic 2013-01-19 12:11:24 -08:00
parent 21bb4e2073
commit a664aef521
2 changed files with 18 additions and 4 deletions

View file

@ -328,10 +328,17 @@ namespace entry
case WM_SIZE:
{
m_width = GET_X_LPARAM(_lparam);
m_height = GET_Y_LPARAM(_lparam);
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;
case WM_SYSCOMMAND:

View file

@ -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;
}