From dfd7387641c28f2a80f7647f26c981911d4a8cfe Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Sat, 12 Apr 2008 21:18:58 +0000 Subject: [PATCH] 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. --- source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h | 2 +- source/gameengine/GamePlayer/ghost/GPG_Application.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h index da3dc2398dd..c5c900d276a 100644 --- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h +++ b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h @@ -58,9 +58,9 @@ protected: * System dependent keyboard codes are stored as ints. */ std::map m_reverseKeyTranslateTable; - bool m_hookesc; public: + bool m_hookesc; GPC_KeyboardDevice() : m_hookesc(false) { diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 5ef20514390..dcc70db9eed 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -845,11 +845,12 @@ bool GPG_Application::handleKey(GHOST_IEvent* event, bool isDown) { GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(); GHOST_TEventKeyData* keyData = static_cast(eventData); - if (fSystem->getFullScreen()) { - if (keyData->key == GHOST_kKeyEsc) { + //no need for this test + //if (fSystem->getFullScreen()) { + if (keyData->key == GHOST_kKeyEsc && !m_keyboard->m_hookesc) { m_exitRequested = KX_EXIT_REQUEST_OUTSIDE; } - } + //} m_keyboard->ConvertEvent(keyData->key, isDown); handled = true; }