summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-11-07 15:44:26 +0300
committerAndrei Karas <akaras@inbox.ru>2012-11-07 15:45:50 +0300
commit2541754f6c607acfd1304af38280b534f7a8e0d7 (patch)
treecf30b8ca962e550003f0ff46fb131ad08e782f14 /src/client.cpp
parentd812d9fac7bae4eff66a5ce8275be19d0ca77a32 (diff)
downloadplus-2541754f6c607acfd1304af38280b534f7a8e0d7.tar.gz
plus-2541754f6c607acfd1304af38280b534f7a8e0d7.tar.bz2
plus-2541754f6c607acfd1304af38280b534f7a8e0d7.tar.xz
plus-2541754f6c607acfd1304af38280b534f7a8e0d7.zip
Fix termination on Android by using "home" key.
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp
index a73dc6806..fe5ec8e16 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -883,6 +883,7 @@ int Client::gameExec()
{
case SDL_QUIT:
mState = STATE_EXIT;
+ logger->log("force exit");
break;
case SDL_KEYDOWN:
@@ -907,7 +908,21 @@ int Client::gameExec()
inputManager.handleAssignKey(event, INPUT_JOYSTICK);
break;
+#ifdef ANDROID
+ case SDL_ACTIVEEVENT:
+ if ((event.active.state & SDL_APPACTIVE)
+ && !event.active.gain)
+ {
+ mState = STATE_EXIT;
+ logger->log("exit on lost focus");
+ }
+ break;
+#endif
+ case SDL_MOUSEMOTION:
+ break;
+
default:
+// logger->log("unknown event: %d", event.type);
break;
case SDL_VIDEORESIZE:
@@ -924,6 +939,8 @@ int Client::gameExec()
}
#endif
}
+ if (mState == STATE_EXIT)
+ continue;
BLOCK_END("Client::gameExec 2")
}