forked from mirror/openmw-tes3mp
fixed all code for building on all platforms inlcudng ANDROID
This commit is contained in:
parent
57a8b9cdb5
commit
8a8b91dfe1
6 changed files with 62 additions and 24 deletions
|
@ -58,6 +58,15 @@ if (ANDROID)
|
||||||
set(CMAKE_FIND_ROOT_PATH ${OPENMW_DEPENDENCIES_DIR} "${CMAKE_FIND_ROOT_PATH}")
|
set(CMAKE_FIND_ROOT_PATH ${OPENMW_DEPENDENCIES_DIR} "${CMAKE_FIND_ROOT_PATH}")
|
||||||
endif (ANDROID)
|
endif (ANDROID)
|
||||||
|
|
||||||
|
if (NOT ANDROID)
|
||||||
|
ADD_DEFINITIONS(-DNOT_ANDROID)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
ADD_DEFINITIONS(-DBUILD_ANDROID)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# doxygen main page
|
# doxygen main page
|
||||||
|
|
||||||
configure_file ("${OpenMW_SOURCE_DIR}/docs/mainpage.hpp.cmake" "${OpenMW_SOURCE_DIR}/docs/mainpage.hpp")
|
configure_file ("${OpenMW_SOURCE_DIR}/docs/mainpage.hpp.cmake" "${OpenMW_SOURCE_DIR}/docs/mainpage.hpp")
|
||||||
|
|
|
@ -19,6 +19,14 @@ endif ()
|
||||||
if(NOT WIN32 AND NOT ANDROID)
|
if(NOT WIN32 AND NOT ANDROID)
|
||||||
set(GAME ${GAME} crashcatcher.cpp)
|
set(GAME ${GAME} crashcatcher.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
if (NOT ANDROID)
|
||||||
|
ADD_DEFINITIONS(-DNOT_ANDROID)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
ADD_DEFINITIONS(-DBUILD_ANDROID)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
set(GAME_HEADER
|
set(GAME_HEADER
|
||||||
engine.hpp
|
engine.hpp
|
||||||
|
|
|
@ -58,39 +58,51 @@ LinuxPath::LinuxPath(const std::string& application_name)
|
||||||
|
|
||||||
boost::filesystem::path LinuxPath::getUserConfigPath() const
|
boost::filesystem::path LinuxPath::getUserConfigPath() const
|
||||||
{
|
{
|
||||||
//if (flag==false)
|
#ifdef NOT_ANDROID
|
||||||
// return getEnv("XDG_CONFIG_HOME", getUserHome() / ".config") / mName;
|
return getEnv("XDG_CONFIG_HOME", getUserHome() / ".config") / mName;
|
||||||
|
#endif
|
||||||
//else
|
//else
|
||||||
return getEnv("XDG_CONFIG_HOME", "/sdcard/morrowind/config") / mName;
|
#ifdef BUILD_ANDROID
|
||||||
|
return getEnv("XDG_CONFIG_HOME", "/sdcard/morrowind/config") / mName;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path LinuxPath::getUserDataPath() const
|
boost::filesystem::path LinuxPath::getUserDataPath() const
|
||||||
{
|
{
|
||||||
//if (flag==false)
|
//if (flag==false)
|
||||||
// return getEnv("XDG_DATA_HOME", getUserHome() / ".local/share") / mName;
|
#ifdef NOT_ANDROID
|
||||||
|
|
||||||
|
return getEnv("XDG_DATA_HOME", getUserHome() / ".local/share") / mName;
|
||||||
|
#endif
|
||||||
//else
|
//else
|
||||||
|
#ifdef BUILD_ANDROID
|
||||||
return getEnv("XDG_DATA_HOME", "/sdcard/morrowind/share") / mName;
|
return getEnv("XDG_DATA_HOME", "/sdcard/morrowind/share") / mName;
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path LinuxPath::getCachePath() const
|
boost::filesystem::path LinuxPath::getCachePath() const
|
||||||
{
|
{
|
||||||
//if (flag==false)
|
//if (flag==false)
|
||||||
// return getEnv("XDG_CACHE_HOME", getUserHome() / ".cache") / mName;
|
#ifdef NOT_ANDROID
|
||||||
|
return getEnv("XDG_CACHE_HOME", getUserHome() / ".cache") / mName;
|
||||||
|
#endif
|
||||||
//else
|
//else
|
||||||
|
#ifdef BUILD_ANDROID
|
||||||
return getEnv("XDG_CACHE_HOME", "/sdcard/morrowind/cache") / mName;
|
return getEnv("XDG_CACHE_HOME", "/sdcard/morrowind/cache") / mName;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path LinuxPath::getGlobalConfigPath() const
|
boost::filesystem::path LinuxPath::getGlobalConfigPath() const
|
||||||
{
|
{
|
||||||
//if (flag==false)
|
//if (flag==false)
|
||||||
// boost::filesystem::path globalPath("/etc/");
|
#ifdef NOT_ANDROID
|
||||||
|
boost::filesystem::path globalPath("/etc/");
|
||||||
|
#endif
|
||||||
//else
|
//else
|
||||||
|
#ifdef BUILD_ANDROID
|
||||||
boost::filesystem::path globalPath("/sdcard/morrowind/");
|
boost::filesystem::path globalPath("/sdcard/morrowind/");
|
||||||
|
#endif
|
||||||
return globalPath / mName;
|
return globalPath / mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,10 +114,14 @@ boost::filesystem::path LinuxPath::getLocalPath() const
|
||||||
boost::filesystem::path LinuxPath::getGlobalDataPath() const
|
boost::filesystem::path LinuxPath::getGlobalDataPath() const
|
||||||
{
|
{
|
||||||
//if (flag==false)
|
//if (flag==false)
|
||||||
// boost::filesystem::path globalDataPath("/usr/share/games/");
|
#ifdef NOT_ANDROID
|
||||||
|
|
||||||
|
boost::filesystem::path globalDataPath("/usr/share/games/");
|
||||||
|
#endif
|
||||||
//else
|
//else
|
||||||
|
#ifdef BUILD_ANDROID
|
||||||
boost::filesystem::path globalDataPath("/sdcard/morrowind/data");
|
boost::filesystem::path globalDataPath("/sdcard/morrowind/data");
|
||||||
|
#endif
|
||||||
return globalDataPath / mName;
|
return globalDataPath / mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,9 @@ namespace OgreInit
|
||||||
|
|
||||||
Ogre::Root* OgreInit::init(const std::string &logPath)
|
Ogre::Root* OgreInit::init(const std::string &logPath)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (flag1==false)
|
#ifdef NOT_ANDROID
|
||||||
{
|
|
||||||
// Set up logging first
|
// Set up logging first
|
||||||
new Ogre::LogManager;
|
new Ogre::LogManager;
|
||||||
Ogre::Log *log = Ogre::LogManager::getSingleton().createLog(logPath);
|
Ogre::Log *log = Ogre::LogManager::getSingleton().createLog(logPath);
|
||||||
|
@ -108,7 +108,7 @@ namespace OgreInit
|
||||||
|
|
||||||
// Disable logging to cout/cerr
|
// Disable logging to cout/cerr
|
||||||
log->setDebugOutputEnabled(false);
|
log->setDebugOutputEnabled(false);
|
||||||
}*/
|
#endif
|
||||||
mRoot = new Ogre::Root("", "", "");
|
mRoot = new Ogre::Root("", "", "");
|
||||||
|
|
||||||
#if defined(ENABLE_PLUGIN_GL) || (ENABLE_PLUGIN_GLES2) || defined(ENABLE_PLUGIN_Direct3D9) || defined(ENABLE_PLUGIN_CgProgramManager) || defined(ENABLE_PLUGIN_OctreeSceneManager) || defined(ENABLE_PLUGIN_ParticleFX)
|
#if defined(ENABLE_PLUGIN_GL) || (ENABLE_PLUGIN_GLES2) || defined(ENABLE_PLUGIN_Direct3D9) || defined(ENABLE_PLUGIN_CgProgramManager) || defined(ENABLE_PLUGIN_OctreeSceneManager) || defined(ENABLE_PLUGIN_ParticleFX)
|
||||||
|
|
17
extern/sdl4ogre/sdlwindowhelper.cpp
vendored
17
extern/sdl4ogre/sdlwindowhelper.cpp
vendored
|
@ -44,18 +44,21 @@ SDLWindowHelper::SDLWindowHelper (SDL_Window* window, int w, int h,
|
||||||
|
|
||||||
winHandle = Ogre::StringConverter::toString(WindowContentViewHandle(wmInfo));
|
winHandle = Ogre::StringConverter::toString(WindowContentViewHandle(wmInfo));
|
||||||
break;
|
break;
|
||||||
#else
|
|
||||||
|
#elif BUILD_ANDROID
|
||||||
case SDL_SYSWM_ANDROID:
|
case SDL_SYSWM_ANDROID:
|
||||||
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.android.window);
|
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.android.window);
|
||||||
winHandleSurface = Ogre::StringConverter::toString((unsigned long)wmInfo.info.android.surface);
|
winHandleSurface = Ogre::StringConverter::toString((unsigned long)wmInfo.info.android.surface);
|
||||||
flag1=true;
|
flag1=true;
|
||||||
break;
|
break;
|
||||||
if (flag1==false)
|
|
||||||
{
|
#elif NOT_ANDROID
|
||||||
//case SDL_SYSWM_X11:
|
|
||||||
// winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window);
|
case SDL_SYSWM_X11:
|
||||||
// break;
|
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window);
|
||||||
}
|
break;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -653,7 +653,9 @@ void MyGUIManager::updateWindow (Ogre::RenderWindow *wnd)
|
||||||
|
|
||||||
void MyGUIManager::windowResized()
|
void MyGUIManager::windowResized()
|
||||||
{
|
{
|
||||||
// mRenderManager->setActiveViewport(0);
|
#ifdef NOT_ANDROID
|
||||||
|
mRenderManager->setActiveViewport(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyGUIManager::shutdown()
|
void MyGUIManager::shutdown()
|
||||||
|
|
Loading…
Reference in a new issue