diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-21 21:46:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-22 02:56:50 +0300 |
commit | 45fc7dfe871e25c913deb56063ca930dafe8b9ae (patch) | |
tree | 0ef15c4d3d36b02e41f8bfa765f5fadee779af24 /src/client.cpp | |
parent | 6e6d42af899c7dcc05b20b07130d0b1a5932f9bf (diff) | |
download | mv-45fc7dfe871e25c913deb56063ca930dafe8b9ae.tar.gz mv-45fc7dfe871e25c913deb56063ca930dafe8b9ae.tar.bz2 mv-45fc7dfe871e25c913deb56063ca930dafe8b9ae.tar.xz mv-45fc7dfe871e25c913deb56063ca930dafe8b9ae.zip |
fix compilation and partial running with SDL2 on Android.
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/client.cpp b/src/client.cpp index fcfb6db7f..aad9f0561 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -128,8 +128,10 @@ #endif #ifdef ANDROID +#ifndef USE_SDL2 #include <SDL_screenkeyboard.h> #endif +#endif #include <sys/stat.h> @@ -138,6 +140,8 @@ #include "mumblemanager.h" +#include <android/log.h> + #include "debug.h" /** @@ -701,8 +705,10 @@ void Client::gameInit() PlayerInfo::init(); #ifdef ANDROID +#ifndef USE_SDL2 updateScreenKeyboard(SDL_GetScreenKeyboardHeight(nullptr)); #endif +#endif } Client::~Client() @@ -989,6 +995,9 @@ int Client::gameExec() break; #ifdef ANDROID +#ifdef USE_SDL2 + // +++ need add support +#else case SDL_ACTIVEEVENT: if ((event.active.state & SDL_APPACTIVE) && !event.active.gain) @@ -1005,6 +1014,7 @@ int Client::gameExec() case SDL_ACCELEROMETER: break; #endif +#endif default: // logger->log("unknown event: %d", event.type); @@ -1972,7 +1982,7 @@ void Client::initLocalDataDir() mLocalDataDir = std::string(PhysFs::getUserDir()); mLocalDataDir.append("/Mana"); #elif defined __ANDROID__ - mLocalDataDir = getenv("DATADIR2") + branding.getValue( + mLocalDataDir = getSdStoragePath() + branding.getValue( "appShort", "ManaPlus") + "/local"; #else mLocalDataDir = std::string(PhysFs::getUserDir()) + @@ -2029,7 +2039,7 @@ void Client::initConfigDir() "appShort", "mana")); } #elif defined __ANDROID__ - mConfigDir = getenv("DATADIR2") + branding.getValue( + mConfigDir = getSdStoragePath() + branding.getValue( "appShort", "ManaPlus").append("/config"); #else mConfigDir = std::string(PhysFs::getUserDir()).append( @@ -2275,7 +2285,7 @@ void Client::initScreenshotDir() else if (mScreenshotDir.empty()) { #ifdef __ANDROID__ - mScreenshotDir = getenv("DATADIR2") + std::string("/images"); + mScreenshotDir = getSdStoragePath() + std::string("/images"); if (mkdir_r(mScreenshotDir.c_str())) { @@ -2886,8 +2896,7 @@ void Client::logVars() { #ifdef ANDROID logger->log("APPDIR: %s", getenv("APPDIR")); - logger->log("DATADIR: %s", getenv("DATADIR")); - logger->log("DATADIR2: %s", getenv("DATADIR2")); + logger->log("DATADIR2: %s", getSdStoragePath().c_str()); #endif } @@ -3017,10 +3026,12 @@ void Client::logEvent(const SDL_Event &event) logger->log("event: SDL_USEREVENT"); break; #ifdef ANDROID +#ifndef USE_SDL2 case SDL_ACCELEROMETER: logger->log("event: SDL_ACCELEROMETER"); break; #endif +#endif default: logger->log("event: other: %d", event.type); break; |