Compiling and running on android, but the window is black when run (bug)

This commit is contained in:
Tulioh
2014-12-30 23:36:42 -02:00
parent 389c7f2a60
commit 15b3d439d6
18 changed files with 246 additions and 80 deletions

View File

@@ -177,6 +177,8 @@ std::string Application::getOs()
return "mac";
#elif __linux
return "linux";
#elif defined ANDROID
return "android";
#else
return "unknown";
#endif

View File

@@ -32,6 +32,10 @@
#include <framework/luaengine/luainterface.h>
#endif
#ifdef ANDROID
#include <android/log.h>
#endif // ANDROID
Logger g_logger;
void Logger::log(Fw::LogLevel level, const std::string& message)
@@ -66,6 +70,9 @@ void Logger::log(Fw::LogLevel level, const std::string& message)
outmsg = tmp.str();
#endif
*/
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "OTClientMobile", outmsg.c_str());
#endif // ANDROID
std::cout << outmsg << std::endl;

View File

@@ -48,7 +48,8 @@ bool ResourceManager::discoverWorkDir(const std::string& existentFile)
std::string possiblePaths[] = { g_platform.getCurrentDir(),
g_resources.getBaseDir(),
g_resources.getBaseDir() + "../",
g_resources.getBaseDir() + "../share/" + g_app.getCompactName() + "/" };
g_resources.getBaseDir() + "../share/" + g_app.getCompactName() + "/",
"/sdcard/OTClient/" };
bool found = false;
for(const std::string& dir : possiblePaths) {
@@ -71,12 +72,20 @@ bool ResourceManager::setupUserWriteDir(const std::string& appWriteDirName)
{
std::string userDir = getUserDir();
std::string dirName;
#ifndef WIN32
dirName = stdext::format(".%s", appWriteDirName);
#else
dirName = appWriteDirName;
#endif
std::string writeDir = userDir + dirName;
std::string writeDir;
#ifdef ANDROID
writeDir = getWorkDir();
#else
writeDir = userDir + dirName;
#endif
if(!PHYSFS_setWriteDir(writeDir.c_str())) {
if(!PHYSFS_setWriteDir(userDir.c_str()) || !PHYSFS_mkdir(dirName.c_str())) {