android-build

deque
root 11 years ago
parent 16aafc26bc
commit 7cd2d4809c

@ -7,7 +7,11 @@
#include <pwd.h> #include <pwd.h>
#include <unistd.h> #include <unistd.h>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
/*bool flag=false;
#ifdef ENABLE_PLUGIN_GLES2
flag=true;
#endif
*/
namespace namespace
{ {
@ -54,22 +58,39 @@ LinuxPath::LinuxPath(const std::string& application_name)
boost::filesystem::path LinuxPath::getUserConfigPath() const boost::filesystem::path LinuxPath::getUserConfigPath() const
{ {
return getEnv("XDG_CONFIG_HOME", getUserHome() / ".config") / mName; //if (flag==false)
// return getEnv("XDG_CONFIG_HOME", getUserHome() / ".config") / mName;
//else
return getEnv("XDG_CONFIG_HOME", "/sdcard/morrowind/config") / mName;
} }
boost::filesystem::path LinuxPath::getUserDataPath() const boost::filesystem::path LinuxPath::getUserDataPath() const
{ {
return getEnv("XDG_DATA_HOME", getUserHome() / ".local/share") / mName; //if (flag==false)
// return getEnv("XDG_DATA_HOME", getUserHome() / ".local/share") / mName;
//else
return getEnv("XDG_DATA_HOME", "/sdcard/morrowind/share") / mName;
} }
boost::filesystem::path LinuxPath::getCachePath() const boost::filesystem::path LinuxPath::getCachePath() const
{ {
return getEnv("XDG_CACHE_HOME", getUserHome() / ".cache") / mName; //if (flag==false)
// return getEnv("XDG_CACHE_HOME", getUserHome() / ".cache") / mName;
//else
return getEnv("XDG_CACHE_HOME", "/sdcard/morrowind/cache") / mName;
} }
boost::filesystem::path LinuxPath::getGlobalConfigPath() const boost::filesystem::path LinuxPath::getGlobalConfigPath() const
{ {
boost::filesystem::path globalPath("/etc/"); //if (flag==false)
// boost::filesystem::path globalPath("/etc/");
//else
boost::filesystem::path globalPath("/sdcard/morrowind/");
return globalPath / mName; return globalPath / mName;
} }
@ -80,7 +101,11 @@ boost::filesystem::path LinuxPath::getLocalPath() const
boost::filesystem::path LinuxPath::getGlobalDataPath() const boost::filesystem::path LinuxPath::getGlobalDataPath() const
{ {
boost::filesystem::path globalDataPath("/usr/share/games/"); //if (flag==false)
// boost::filesystem::path globalDataPath("/usr/share/games/");
//else
boost::filesystem::path globalDataPath("/sdcard/morrowind/data");
return globalDataPath / mName; return globalDataPath / mName;
} }

@ -4,7 +4,6 @@
#if defined(__linux__) || defined(__FreeBSD__) #if defined(__linux__) || defined(__FreeBSD__)
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
/** /**
* \namespace Files * \namespace Files
*/ */

@ -22,6 +22,7 @@
#include "ogreplugin.hpp" #include "ogreplugin.hpp"
namespace bfs = boost::filesystem; namespace bfs = boost::filesystem;
namespace namespace
@ -82,6 +83,10 @@ namespace OgreInit
#ifdef ENABLE_PLUGIN_GL #ifdef ENABLE_PLUGIN_GL
, mGLPlugin(NULL) , mGLPlugin(NULL)
#endif #endif
#ifdef ENABLE_PLUGIN_GLES2
, mGLES2Plugin(NULL)
#endif
#ifdef ENABLE_PLUGIN_Direct3D9 #ifdef ENABLE_PLUGIN_Direct3D9
, mD3D9Plugin(NULL) , mD3D9Plugin(NULL)
#endif #endif
@ -89,6 +94,9 @@ namespace OgreInit
Ogre::Root* OgreInit::init(const std::string &logPath) Ogre::Root* OgreInit::init(const std::string &logPath)
{ {
/*
if (flag1==false)
{
// 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);
@ -100,10 +108,10 @@ namespace OgreInit
// Disable logging to cout/cerr // Disable logging to cout/cerr
log->setDebugOutputEnabled(false); log->setDebugOutputEnabled(false);
}*/
mRoot = new Ogre::Root("", "", ""); mRoot = new Ogre::Root("", "", "");
#if defined(ENABLE_PLUGIN_GL) || 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)
loadStaticPlugins(); loadStaticPlugins();
#else #else
loadPlugins(); loadPlugins();
@ -133,6 +141,11 @@ namespace OgreInit
delete mGLPlugin; delete mGLPlugin;
mGLPlugin = NULL; mGLPlugin = NULL;
#endif #endif
#ifdef ENABLE_PLUGIN_GLES2
delete mGLES2Plugin;
mGLES2Plugin = NULL;
#endif
#ifdef ENABLE_PLUGIN_Direct3D9 #ifdef ENABLE_PLUGIN_Direct3D9
delete mD3D9Plugin; delete mD3D9Plugin;
mD3D9Plugin = NULL; mD3D9Plugin = NULL;
@ -157,6 +170,11 @@ namespace OgreInit
mGLPlugin = new Ogre::GLPlugin(); mGLPlugin = new Ogre::GLPlugin();
mRoot->installPlugin(mGLPlugin); mRoot->installPlugin(mGLPlugin);
#endif #endif
#ifdef ENABLE_PLUGIN_GLES2
mGLES2Plugin = new Ogre::GLES2Plugin();
mRoot->installPlugin(mGLES2Plugin);
#endif
#ifdef ENABLE_PLUGIN_Direct3D9 #ifdef ENABLE_PLUGIN_Direct3D9
mD3D9Plugin = new Ogre::D3D9Plugin(); mD3D9Plugin = new Ogre::D3D9Plugin();
mRoot->installPlugin(mD3D9Plugin); mRoot->installPlugin(mD3D9Plugin);

@ -17,6 +17,11 @@
#ifdef ENABLE_PLUGIN_GL #ifdef ENABLE_PLUGIN_GL
# include "OgreGLPlugin.h" # include "OgreGLPlugin.h"
#endif #endif
#ifdef ENABLE_PLUGIN_GLES2
# include "OgreGLES2Plugin.h"
#endif
#ifdef ENABLE_PLUGIN_Direct3D9 #ifdef ENABLE_PLUGIN_Direct3D9
# include "OgreD3D9Plugin.h" # include "OgreD3D9Plugin.h"
#endif #endif
@ -51,6 +56,8 @@ namespace OgreInit
void loadStaticPlugins(); void loadStaticPlugins();
void loadPlugins(); void loadPlugins();
void loadParticleFactories(); void loadParticleFactories();
//bool flag1=false;
#ifdef ENABLE_PLUGIN_CgProgramManager #ifdef ENABLE_PLUGIN_CgProgramManager
@ -65,6 +72,10 @@ namespace OgreInit
#ifdef ENABLE_PLUGIN_GL #ifdef ENABLE_PLUGIN_GL
Ogre::GLPlugin* mGLPlugin; Ogre::GLPlugin* mGLPlugin;
#endif #endif
#ifdef ENABLE_PLUGIN_GLES2
Ogre::GLES2Plugin* mGLES2Plugin;
#endif
#ifdef ENABLE_PLUGIN_Direct3D9 #ifdef ENABLE_PLUGIN_Direct3D9
Ogre::D3D9Plugin* mD3D9Plugin; Ogre::D3D9Plugin* mD3D9Plugin;
#endif #endif

@ -10,6 +10,7 @@
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
#include "osx_utils.h" #include "osx_utils.h"
#endif #endif
bool flag1=false;
namespace SFO namespace SFO
{ {
@ -26,6 +27,7 @@ SDLWindowHelper::SDLWindowHelper (SDL_Window* window, int w, int h,
throw std::runtime_error("Couldn't get WM Info!"); throw std::runtime_error("Couldn't get WM Info!");
Ogre::String winHandle; Ogre::String winHandle;
Ogre::String winHandleSurface;
switch (wmInfo.subsystem) switch (wmInfo.subsystem)
{ {
@ -43,10 +45,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 #else
case SDL_SYSWM_X11: case SDL_SYSWM_ANDROID:
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window); winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.android.window);
winHandleSurface = Ogre::StringConverter::toString((unsigned long)wmInfo.info.android.surface);
flag1=true;
break; break;
if (flag1==false)
{
//case SDL_SYSWM_X11:
// winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window);
// break;
}
#endif #endif
default: default:
throw std::runtime_error("Unexpected WM!"); throw std::runtime_error("Unexpected WM!");
break; break;
@ -54,8 +67,14 @@ SDLWindowHelper::SDLWindowHelper (SDL_Window* window, int w, int h,
/// \todo externalWindowHandle is deprecated according to the source code. Figure out a way to get parentWindowHandle /// \todo externalWindowHandle is deprecated according to the source code. Figure out a way to get parentWindowHandle
/// to work properly. On Linux/X11 it causes an occasional GLXBadDrawable error. /// to work properly. On Linux/X11 it causes an occasional GLXBadDrawable error.
if (flag1==false)
params.insert(std::make_pair("externalWindowHandle", winHandle));
else
{
params.insert(std::make_pair("externalWindowHandle", winHandle)); params.insert(std::make_pair("externalWindowHandle", winHandle));
params.insert(std::make_pair("externalSurface", winHandleSurface));
}
mWindow = Ogre::Root::getSingleton().createRenderWindow(title, w, h, fullscreen, &params); mWindow = Ogre::Root::getSingleton().createRenderWindow(title, w, h, fullscreen, &params);
} }

@ -653,7 +653,7 @@ void MyGUIManager::updateWindow (Ogre::RenderWindow *wnd)
void MyGUIManager::windowResized() void MyGUIManager::windowResized()
{ {
mRenderManager->setActiveViewport(0); // mRenderManager->setActiveViewport(0);
} }
void MyGUIManager::shutdown() void MyGUIManager::shutdown()

Loading…
Cancel
Save