summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/entry/entry.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/common/entry/entry.cpp')
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/3rdparty/bgfx/examples/common/entry/entry.cpp b/3rdparty/bgfx/examples/common/entry/entry.cpp
index 89409f000f2..852abe91623 100644
--- a/3rdparty/bgfx/examples/common/entry/entry.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2021 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
@@ -189,7 +189,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
const char* getName(Key::Enum _key)
{
- BX_CHECK(_key < Key::Count, "Invalid key %d.", _key);
+ BX_ASSERT(_key < Key::Count, "Invalid key %d.", _key);
return s_keyName[_key];
}
@@ -656,6 +656,8 @@ restart:
bool processEvents(uint32_t& _width, uint32_t& _height, uint32_t& _debug, uint32_t& _reset, MouseState* _mouse)
{
+ bool needReset = s_reset != _reset;
+
s_debug = _debug;
s_reset = _reset;
@@ -742,7 +744,8 @@ restart:
handle = size->m_handle;
_width = size->m_width;
_height = size->m_height;
- _reset = !s_reset; // force reset
+
+ needReset = true;
}
break;
@@ -768,8 +771,10 @@ restart:
} while (NULL != ev);
+ needReset |= _reset != s_reset;
+
if (handle.idx == 0
- && _reset != s_reset)
+ && needReset)
{
_reset = s_reset;
bgfx::reset(_width, _height, _reset);
@@ -786,6 +791,8 @@ restart:
bool processWindowEvents(WindowState& _state, uint32_t& _debug, uint32_t& _reset)
{
+ bool needReset = s_reset != _reset;
+
s_debug = _debug;
s_reset = _reset;
@@ -894,10 +901,8 @@ restart:
win.m_handle = size->m_handle;
win.m_width = size->m_width;
win.m_height = size->m_height;
- _reset = win.m_handle.idx == 0
- ? !s_reset
- : _reset
- ; // force reset
+
+ needReset = win.m_handle.idx == 0 ? true : needReset;
}
break;
@@ -946,7 +951,9 @@ restart:
}
}
- if (_reset != s_reset)
+ needReset |= _reset != s_reset;
+
+ if (needReset)
{
_reset = s_reset;
bgfx::reset(s_window[0].m_width, s_window[0].m_height, _reset);