fix BGE bug #8880: blenderplayer closing when esc is pressed
ESC now quits the game by default in all modes unless a keyboard sensor is set on ESC. In this case, the game designer must arrange for an alternative way to quit the game.
This commit is contained in:
@@ -58,9 +58,9 @@ protected:
|
|||||||
* System dependent keyboard codes are stored as ints.
|
* System dependent keyboard codes are stored as ints.
|
||||||
*/
|
*/
|
||||||
std::map<int, KX_EnumInputs> m_reverseKeyTranslateTable;
|
std::map<int, KX_EnumInputs> m_reverseKeyTranslateTable;
|
||||||
bool m_hookesc;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
bool m_hookesc;
|
||||||
GPC_KeyboardDevice()
|
GPC_KeyboardDevice()
|
||||||
: m_hookesc(false)
|
: m_hookesc(false)
|
||||||
{
|
{
|
||||||
|
@@ -845,11 +845,12 @@ bool GPG_Application::handleKey(GHOST_IEvent* event, bool isDown)
|
|||||||
{
|
{
|
||||||
GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData();
|
GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData();
|
||||||
GHOST_TEventKeyData* keyData = static_cast<GHOST_TEventKeyData*>(eventData);
|
GHOST_TEventKeyData* keyData = static_cast<GHOST_TEventKeyData*>(eventData);
|
||||||
if (fSystem->getFullScreen()) {
|
//no need for this test
|
||||||
if (keyData->key == GHOST_kKeyEsc) {
|
//if (fSystem->getFullScreen()) {
|
||||||
|
if (keyData->key == GHOST_kKeyEsc && !m_keyboard->m_hookesc) {
|
||||||
m_exitRequested = KX_EXIT_REQUEST_OUTSIDE;
|
m_exitRequested = KX_EXIT_REQUEST_OUTSIDE;
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
m_keyboard->ConvertEvent(keyData->key, isDown);
|
m_keyboard->ConvertEvent(keyData->key, isDown);
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user