From 45fc7dfe871e25c913deb56063ca930dafe8b9ae Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 21 Sep 2013 21:46:17 +0300 Subject: fix compilation and partial running with SDL2 on Android. --- src/client.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/client.cpp') 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 #endif +#endif #include @@ -138,6 +140,8 @@ #include "mumblemanager.h" +#include + #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) @@ -1004,6 +1013,7 @@ int Client::gameExec() case SDL_ACCELEROMETER: break; +#endif #endif default: @@ -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,9 +3026,11 @@ 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); -- cgit v1.2.3-60-g2f50