mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Merge remote-tracking branch 'sandstranger/android'
This commit is contained in:
commit
f4ddf2a7b9
12 changed files with 316 additions and 33 deletions
|
@ -54,6 +54,10 @@ endif(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
||||||
# Macros
|
# Macros
|
||||||
include(OpenMWMacros)
|
include(OpenMWMacros)
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH ${OPENMW_DEPENDENCIES_DIR} "${CMAKE_FIND_ROOT_PATH}")
|
||||||
|
endif (ANDROID)
|
||||||
|
|
||||||
# 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")
|
||||||
|
@ -232,7 +236,12 @@ if(OGRE_STATIC)
|
||||||
list(APPEND OGRE_STATIC_PLUGINS ${Cg_LIBRARIES})
|
list(APPEND OGRE_STATIC_PLUGINS ${Cg_LIBRARIES})
|
||||||
endif(Cg_FOUND)
|
endif(Cg_FOUND)
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
add_static_ogre_plugin(RenderSystem_GLES2)
|
||||||
|
else ()
|
||||||
add_static_ogre_plugin(RenderSystem_GL)
|
add_static_ogre_plugin(RenderSystem_GL)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_static_ogre_plugin(RenderSystem_Direct3D9)
|
add_static_ogre_plugin(RenderSystem_Direct3D9)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
# local files
|
# local files
|
||||||
set(GAME
|
if (NOT ANDROID)
|
||||||
|
set(GAME
|
||||||
main.cpp
|
main.cpp
|
||||||
engine.cpp
|
engine.cpp
|
||||||
)
|
)
|
||||||
if(NOT WIN32)
|
else()
|
||||||
|
set(GAME
|
||||||
|
main.cpp
|
||||||
|
android_main.c
|
||||||
|
engine.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if(NOT WIN32 AND NOT ANDROID)
|
||||||
set(GAME ${GAME} crashcatcher.cpp)
|
set(GAME ${GAME} crashcatcher.cpp)
|
||||||
endif()
|
endif()
|
||||||
set(GAME_HEADER
|
set(GAME_HEADER
|
||||||
|
@ -82,19 +90,33 @@ add_openmw_dir (mwbase
|
||||||
)
|
)
|
||||||
|
|
||||||
# Main executable
|
# Main executable
|
||||||
set(BOOST_COMPONENTS system filesystem program_options thread wave)
|
if (ANDROID)
|
||||||
|
set(BOOST_COMPONENTS system filesystem program_options thread wave atomic)
|
||||||
|
else ()
|
||||||
|
set(BOOST_COMPONENTS system filesystem program_options thread wave)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
|
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
|
|
||||||
add_executable(openmw
|
if (NOT ANDROID)
|
||||||
|
add_executable(openmw
|
||||||
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
|
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
|
||||||
${OPENMW_FILES}
|
${OPENMW_FILES}
|
||||||
${GAME} ${GAME_HEADER}
|
${GAME} ${GAME_HEADER}
|
||||||
${APPLE_BUNDLE_RESOURCES}
|
${APPLE_BUNDLE_RESOURCES}
|
||||||
)
|
)
|
||||||
|
else ()
|
||||||
|
add_library(openmw
|
||||||
|
SHARED
|
||||||
|
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
|
||||||
|
${OPENMW_FILES}
|
||||||
|
${GAME} ${GAME_HEADER}
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING
|
# Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING
|
||||||
# when we change the backend.
|
# when we change the backend.
|
||||||
|
@ -116,6 +138,23 @@ target_link_libraries(openmw
|
||||||
components
|
components
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
target_link_libraries(openmw
|
||||||
|
${OGRE_STATIC_PLUGINS}
|
||||||
|
EGL
|
||||||
|
android
|
||||||
|
log
|
||||||
|
dl
|
||||||
|
MyGUI.OgrePlatform
|
||||||
|
MyGUIEngineStatic
|
||||||
|
Plugin_StrangeButtonStatic
|
||||||
|
cpufeatures
|
||||||
|
BulletCollision
|
||||||
|
BulletDynamics
|
||||||
|
LinearMath
|
||||||
|
)
|
||||||
|
endif (ANDROID)
|
||||||
|
|
||||||
if (USE_SYSTEM_TINYXML)
|
if (USE_SYSTEM_TINYXML)
|
||||||
target_link_libraries(openmw ${TINYXML_LIBRARIES})
|
target_link_libraries(openmw ${TINYXML_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
43
apps/openmw/android_main.c
Normal file
43
apps/openmw/android_main.c
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
#include "SDL_main.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
Functions called by JNI
|
||||||
|
*******************************************************************************/
|
||||||
|
#include <jni.h>
|
||||||
|
|
||||||
|
/* Called before to initialize JNI bindings */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
|
||||||
|
|
||||||
|
|
||||||
|
int Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
|
||||||
|
{
|
||||||
|
|
||||||
|
SDL_Android_Init(env, cls);
|
||||||
|
|
||||||
|
SDL_SetMainReady();
|
||||||
|
|
||||||
|
|
||||||
|
/* Run the application code! */
|
||||||
|
|
||||||
|
int status;
|
||||||
|
char *argv[2];
|
||||||
|
argv[0] = SDL_strdup("openmw");
|
||||||
|
argv[1] = NULL;
|
||||||
|
status = main(1, argv);
|
||||||
|
|
||||||
|
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
|
||||||
|
/* exit(status); */
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __ANDROID__ */
|
||||||
|
|
|
@ -127,7 +127,7 @@ endif ()
|
||||||
set(OGRE_COMPONENTS Paging Terrain
|
set(OGRE_COMPONENTS Paging Terrain
|
||||||
Plugin_BSPSceneManager Plugin_CgProgramManager Plugin_OctreeSceneManager
|
Plugin_BSPSceneManager Plugin_CgProgramManager Plugin_OctreeSceneManager
|
||||||
Plugin_OctreeZone Plugin_PCZSceneManager Plugin_ParticleFX
|
Plugin_OctreeZone Plugin_PCZSceneManager Plugin_ParticleFX
|
||||||
RenderSystem_Direct3D10 RenderSystem_Direct3D9 RenderSystem_GL RenderSystem_GLES)
|
RenderSystem_Direct3D10 RenderSystem_Direct3D9 RenderSystem_GL RenderSystem_GLES2)
|
||||||
set(OGRE_RESET_VARS
|
set(OGRE_RESET_VARS
|
||||||
OGRE_CONFIG_INCLUDE_DIR OGRE_INCLUDE_DIR
|
OGRE_CONFIG_INCLUDE_DIR OGRE_INCLUDE_DIR
|
||||||
OGRE_LIBRARY_FWK OGRE_LIBRARY_REL OGRE_LIBRARY_DBG
|
OGRE_LIBRARY_FWK OGRE_LIBRARY_REL OGRE_LIBRARY_DBG
|
||||||
|
@ -234,10 +234,10 @@ if (OGRE_STATIC)
|
||||||
find_package(FreeImage QUIET)
|
find_package(FreeImage QUIET)
|
||||||
find_package(Freetype QUIET)
|
find_package(Freetype QUIET)
|
||||||
find_package(OpenGL QUIET)
|
find_package(OpenGL QUIET)
|
||||||
find_package(OpenGLES QUIET)
|
find_package(OpenGLES2 QUIET)
|
||||||
find_package(ZLIB QUIET)
|
find_package(ZLIB QUIET)
|
||||||
find_package(ZZip QUIET)
|
find_package(ZZip QUIET)
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE OR NOT ANDROID)
|
||||||
find_package(X11 QUIET)
|
find_package(X11 QUIET)
|
||||||
find_library(XAW_LIBRARY NAMES Xaw Xaw7 PATHS ${DEP_LIB_SEARCH_DIR} ${X11_LIB_SEARCH_PATH})
|
find_library(XAW_LIBRARY NAMES Xaw Xaw7 PATHS ${DEP_LIB_SEARCH_DIR} ${X11_LIB_SEARCH_PATH})
|
||||||
if (NOT XAW_LIBRARY OR NOT X11_Xt_FOUND)
|
if (NOT XAW_LIBRARY OR NOT X11_Xt_FOUND)
|
||||||
|
@ -258,10 +258,16 @@ if (OGRE_STATIC)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_LIBRARY_FWK} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES}
|
||||||
|
${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES}
|
||||||
|
${Cocoa_LIBRARIES} ${Carbon_LIBRARIES})
|
||||||
|
else ()
|
||||||
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_LIBRARY_FWK} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES}
|
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_LIBRARY_FWK} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES}
|
||||||
${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES}
|
${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES}
|
||||||
${X11_LIBRARIES} ${X11_Xt_LIBRARIES} ${XAW_LIBRARY} ${X11_Xrandr_LIB}
|
${X11_LIBRARIES} ${X11_Xt_LIBRARIES} ${XAW_LIBRARY} ${X11_Xrandr_LIB}
|
||||||
${Cocoa_LIBRARIES} ${Carbon_LIBRARIES})
|
${Cocoa_LIBRARIES} ${Carbon_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT ZLIB_FOUND OR NOT ZZip_FOUND)
|
if (NOT ZLIB_FOUND OR NOT ZZip_FOUND)
|
||||||
set(OGRE_DEPS_FOUND FALSE)
|
set(OGRE_DEPS_FOUND FALSE)
|
||||||
|
@ -272,7 +278,7 @@ if (OGRE_STATIC)
|
||||||
if (NOT FREETYPE_FOUND)
|
if (NOT FREETYPE_FOUND)
|
||||||
set(OGRE_DEPS_FOUND FALSE)
|
set(OGRE_DEPS_FOUND FALSE)
|
||||||
endif ()
|
endif ()
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE AND NOT ANDROID)
|
||||||
if (NOT X11_FOUND)
|
if (NOT X11_FOUND)
|
||||||
set(OGRE_DEPS_FOUND FALSE)
|
set(OGRE_DEPS_FOUND FALSE)
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -486,7 +492,7 @@ ogre_find_plugin(Plugin_CgProgramManager OgreCgProgram.h PlugIns/CgProgramManage
|
||||||
ogre_find_plugin(Plugin_OctreeSceneManager OgreOctreeSceneManager.h PlugIns/OctreeSceneManager/include)
|
ogre_find_plugin(Plugin_OctreeSceneManager OgreOctreeSceneManager.h PlugIns/OctreeSceneManager/include)
|
||||||
ogre_find_plugin(Plugin_ParticleFX OgreParticleFXPrerequisites.h PlugIns/ParticleFX/include)
|
ogre_find_plugin(Plugin_ParticleFX OgreParticleFXPrerequisites.h PlugIns/ParticleFX/include)
|
||||||
ogre_find_plugin(RenderSystem_GL OgreGLRenderSystem.h RenderSystems/GL/include)
|
ogre_find_plugin(RenderSystem_GL OgreGLRenderSystem.h RenderSystems/GL/include)
|
||||||
ogre_find_plugin(RenderSystem_GLES OgreGLESRenderSystem.h RenderSystems/GLES/include)
|
ogre_find_plugin(RenderSystem_GLES2 OgreGLES2RenderSystem.h RenderSystems/GLES2/include)
|
||||||
ogre_find_plugin(RenderSystem_Direct3D9 OgreD3D9RenderSystem.h RenderSystems/Direct3D9/include)
|
ogre_find_plugin(RenderSystem_Direct3D9 OgreD3D9RenderSystem.h RenderSystems/Direct3D9/include)
|
||||||
ogre_find_plugin(RenderSystem_Direct3D10 OgreD3D10RenderSystem.h RenderSystems/Direct3D10/include)
|
ogre_find_plugin(RenderSystem_Direct3D10 OgreD3D10RenderSystem.h RenderSystems/Direct3D10/include)
|
||||||
ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11/include)
|
ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11/include)
|
||||||
|
@ -528,8 +534,8 @@ if (OGRE_STATIC)
|
||||||
set(OGRE_RenderSystem_GL_LIBRARIES ${OGRE_RenderSystem_GL_LIBRARIES}
|
set(OGRE_RenderSystem_GL_LIBRARIES ${OGRE_RenderSystem_GL_LIBRARIES}
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
)
|
)
|
||||||
set(OGRE_RenderSystem_GLES_LIBRARIES ${OGRE_RenderSystem_GLES_LIBRARIES}
|
set(OGRE_RenderSystem_GLES2_LIBRARIES ${OGRE_RenderSystem_GLES2_LIBRARIES}
|
||||||
${OPENGLES_LIBRARIES}
|
${OPENGLES2_LIBRARIES}
|
||||||
)
|
)
|
||||||
set(OGRE_Plugin_CgProgramManager_LIBRARIES ${OGRE_Plugin_CgProgramManager_LIBRARIES}
|
set(OGRE_Plugin_CgProgramManager_LIBRARIES ${OGRE_Plugin_CgProgramManager_LIBRARIES}
|
||||||
${Cg_LIBRARIES}
|
${Cg_LIBRARIES}
|
||||||
|
|
|
@ -50,7 +50,7 @@ add_component_dir (misc
|
||||||
)
|
)
|
||||||
|
|
||||||
add_component_dir (files
|
add_component_dir (files
|
||||||
linuxpath windowspath macospath fixedpath multidircollection collections configurationmanager
|
linuxpath androidpath windowspath macospath fixedpath multidircollection collections configurationmanager
|
||||||
constrainedfiledatastream lowlevelfile
|
constrainedfiledatastream lowlevelfile
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
94
components/files/androidpath.cpp
Normal file
94
components/files/androidpath.cpp
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
#include "androidpath.hpp"
|
||||||
|
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <pwd.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
boost::filesystem::path getUserHome()
|
||||||
|
{
|
||||||
|
const char* dir = getenv("HOME");
|
||||||
|
if (dir == NULL)
|
||||||
|
{
|
||||||
|
struct passwd* pwd = getpwuid(getuid());
|
||||||
|
if (pwd != NULL)
|
||||||
|
{
|
||||||
|
dir = pwd->pw_dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dir == NULL)
|
||||||
|
return boost::filesystem::path();
|
||||||
|
else
|
||||||
|
return boost::filesystem::path(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::filesystem::path getEnv(const std::string& envVariable, const boost::filesystem::path& fallback)
|
||||||
|
{
|
||||||
|
const char* result = getenv(envVariable.c_str());
|
||||||
|
if (!result)
|
||||||
|
return fallback;
|
||||||
|
boost::filesystem::path dir(result);
|
||||||
|
if (dir.empty())
|
||||||
|
return fallback;
|
||||||
|
else
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \namespace Files
|
||||||
|
*/
|
||||||
|
namespace Files
|
||||||
|
{
|
||||||
|
|
||||||
|
AndroidPath::AndroidPath(const std::string& application_name)
|
||||||
|
: mName(application_name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::filesystem::path AndroidPath::getUserConfigPath() const
|
||||||
|
{
|
||||||
|
return getEnv("XDG_CONFIG_HOME", "/sdcard/morrowind/config") / mName;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::filesystem::path AndroidPath::getUserDataPath() const
|
||||||
|
{
|
||||||
|
return getEnv("XDG_DATA_HOME", "/sdcard/morrowind/share") / mName;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::filesystem::path AndroidPath::getCachePath() const
|
||||||
|
{
|
||||||
|
return getEnv("XDG_CACHE_HOME", "/sdcard/morrowind/cache") / mName;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::filesystem::path AndroidPath::getGlobalConfigPath() const
|
||||||
|
{
|
||||||
|
boost::filesystem::path globalPath("/sdcard/morrowind/");
|
||||||
|
return globalPath / mName;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::filesystem::path AndroidPath::getLocalPath() const
|
||||||
|
{
|
||||||
|
return boost::filesystem::path("./");
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::filesystem::path AndroidPath::getGlobalDataPath() const
|
||||||
|
{
|
||||||
|
boost::filesystem::path globalDataPath("/sdcard/morrowind/data");
|
||||||
|
return globalDataPath / mName;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::filesystem::path AndroidPath::getInstallPath() const
|
||||||
|
{
|
||||||
|
return boost::filesystem::path();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} /* namespace Files */
|
||||||
|
|
||||||
|
#endif /* defined(__Android__) */
|
54
components/files/androidpath.hpp
Normal file
54
components/files/androidpath.hpp
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
#ifndef COMPONENTS_FILES_ANDROIDPATH_H
|
||||||
|
#define COMPONENTS_FILES_ANDROIDPATH_H
|
||||||
|
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
/**
|
||||||
|
* \namespace Files
|
||||||
|
*/
|
||||||
|
namespace Files
|
||||||
|
{
|
||||||
|
|
||||||
|
struct AndroidPath
|
||||||
|
{
|
||||||
|
AndroidPath(const std::string& application_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Return path to the user directory.
|
||||||
|
*/
|
||||||
|
boost::filesystem::path getUserConfigPath() const;
|
||||||
|
|
||||||
|
boost::filesystem::path getUserDataPath() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Return path to the global (system) directory where config files can be placed.
|
||||||
|
*/
|
||||||
|
boost::filesystem::path getGlobalConfigPath() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Return path to the runtime configuration directory which is the
|
||||||
|
* place where an application was started.
|
||||||
|
*/
|
||||||
|
boost::filesystem::path getLocalPath() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Return path to the global (system) directory where game files can be placed.
|
||||||
|
*/
|
||||||
|
boost::filesystem::path getGlobalDataPath() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
boost::filesystem::path getCachePath() const;
|
||||||
|
|
||||||
|
boost::filesystem::path getInstallPath() const;
|
||||||
|
|
||||||
|
std::string mName;
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace Files */
|
||||||
|
|
||||||
|
#endif /* defined(__Android__) */
|
||||||
|
|
||||||
|
#endif /* COMPONENTS_FILES_ANDROIDPATH_H */
|
|
@ -5,9 +5,13 @@
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__)
|
#if defined(__linux__) || defined(__FreeBSD__)
|
||||||
|
#ifndef ANDROID
|
||||||
#include <components/files/linuxpath.hpp>
|
#include <components/files/linuxpath.hpp>
|
||||||
namespace Files { typedef LinuxPath TargetPathType; }
|
namespace Files { typedef LinuxPath TargetPathType; }
|
||||||
|
#else
|
||||||
|
#include <components/files/androidpath.hpp>
|
||||||
|
namespace Files { typedef AndroidPath TargetPathType; }
|
||||||
|
#endif
|
||||||
#elif defined(__WIN32) || defined(__WINDOWS__) || defined(_WIN32)
|
#elif defined(__WIN32) || defined(__WINDOWS__) || defined(_WIN32)
|
||||||
#include <components/files/windowspath.hpp>
|
#include <components/files/windowspath.hpp>
|
||||||
namespace Files { typedef WindowsPath TargetPathType; }
|
namespace Files { typedef WindowsPath TargetPathType; }
|
||||||
|
@ -87,6 +91,7 @@ struct FixedPath
|
||||||
return mLocalPath;
|
return mLocalPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const boost::filesystem::path& getInstallPath() const
|
const boost::filesystem::path& getInstallPath() const
|
||||||
{
|
{
|
||||||
return mInstallPath;
|
return mInstallPath;
|
||||||
|
|
|
@ -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,8 @@ namespace OgreInit
|
||||||
|
|
||||||
Ogre::Root* OgreInit::init(const std::string &logPath)
|
Ogre::Root* OgreInit::init(const std::string &logPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifndef 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);
|
||||||
|
@ -100,10 +107,10 @@ 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) || 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 +140,10 @@ 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 +168,10 @@ 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,10 @@
|
||||||
#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
|
||||||
|
@ -52,7 +56,6 @@ namespace OgreInit
|
||||||
void loadPlugins();
|
void loadPlugins();
|
||||||
void loadParticleFactories();
|
void loadParticleFactories();
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_PLUGIN_CgProgramManager
|
#ifdef ENABLE_PLUGIN_CgProgramManager
|
||||||
Ogre::CgPlugin* mCgPlugin;
|
Ogre::CgPlugin* mCgPlugin;
|
||||||
#endif
|
#endif
|
||||||
|
@ -65,6 +68,9 @@ 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
|
||||||
|
|
14
extern/sdl4ogre/sdlwindowhelper.cpp
vendored
14
extern/sdl4ogre/sdlwindowhelper.cpp
vendored
|
@ -26,6 +26,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)
|
||||||
{
|
{
|
||||||
|
@ -39,10 +40,15 @@ SDLWindowHelper::SDLWindowHelper (SDL_Window* window, int w, int h,
|
||||||
//required to make OGRE play nice with our window
|
//required to make OGRE play nice with our window
|
||||||
params.insert(std::make_pair("macAPI", "cocoa"));
|
params.insert(std::make_pair("macAPI", "cocoa"));
|
||||||
params.insert(std::make_pair("macAPICocoaUseNSView", "true"));
|
params.insert(std::make_pair("macAPICocoaUseNSView", "true"));
|
||||||
|
|
||||||
winHandle = Ogre::StringConverter::toString(WindowContentViewHandle(wmInfo));
|
winHandle = Ogre::StringConverter::toString(WindowContentViewHandle(wmInfo));
|
||||||
break;
|
break;
|
||||||
#else
|
#elif ANDROID
|
||||||
|
case SDL_SYSWM_ANDROID:
|
||||||
|
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.android.window);
|
||||||
|
winHandleSurface = Ogre::StringConverter::toString((unsigned long)wmInfo.info.android.surface);
|
||||||
|
|
||||||
|
break;
|
||||||
|
#else
|
||||||
case SDL_SYSWM_X11:
|
case SDL_SYSWM_X11:
|
||||||
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window);
|
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window);
|
||||||
break;
|
break;
|
||||||
|
@ -54,6 +60,10 @@ 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.
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
params.insert(std::make_pair("externalSurface", winHandleSurface));
|
||||||
|
#endif
|
||||||
params.insert(std::make_pair("externalWindowHandle", winHandle));
|
params.insert(std::make_pair("externalWindowHandle", winHandle));
|
||||||
|
|
||||||
mWindow = Ogre::Root::getSingleton().createRenderWindow(title, w, h, fullscreen, ¶ms);
|
mWindow = Ogre::Root::getSingleton().createRenderWindow(title, w, h, fullscreen, ¶ms);
|
||||||
|
|
|
@ -653,7 +653,9 @@ void MyGUIManager::updateWindow (Ogre::RenderWindow *wnd)
|
||||||
|
|
||||||
void MyGUIManager::windowResized()
|
void MyGUIManager::windowResized()
|
||||||
{
|
{
|
||||||
|
#ifndef ANDROID
|
||||||
mRenderManager->setActiveViewport(0);
|
mRenderManager->setActiveViewport(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyGUIManager::shutdown()
|
void MyGUIManager::shutdown()
|
||||||
|
|
Loading…
Reference in a new issue