Some minor modifications that make merging with master easier

This commit is contained in:
Deve 2016-12-04 15:11:48 +01:00
parent 2c8b31379b
commit 419e9e5351
4 changed files with 41 additions and 7 deletions

View File

@ -90,6 +90,10 @@ using namespace irr;
#include <X11/Xutil.h> #include <X11/Xutil.h>
#endif #endif
#ifdef ANDROID
struct android_app* global_android_app;
#endif
/** singleton */ /** singleton */
IrrDriver *irr_driver = NULL; IrrDriver *irr_driver = NULL;
@ -112,13 +116,21 @@ IrrDriver::IrrDriver()
{ {
m_resolution_changing = RES_CHANGE_NONE; m_resolution_changing = RES_CHANGE_NONE;
m_phase = SOLID_NORMAL_AND_DEPTH_PASS; m_phase = SOLID_NORMAL_AND_DEPTH_PASS;
m_device = createDevice(video::EDT_NULL,
irr::core::dimension2d<u32>(640, 480), struct irr::SIrrlichtCreationParameters p;
/*bits*/16U, /**fullscreen*/ false, p.DriverType = video::EDT_NULL;
/*stencilBuffer*/ false, p.WindowSize = core::dimension2d<u32>(640,480);
/*vsync*/false, p.Bits = 16U;
/*event receiver*/ NULL, p.Fullscreen = false;
file_manager->getFileSystem()); p.Vsync = false;
p.EventReceiver = NULL;
p.FileSystem = file_manager->getFileSystem();
#ifdef ANDROID
p.PrivateData = (void*)global_android_app;
#endif
m_device = createDeviceEx(p);
m_request_screenshot = false; m_request_screenshot = false;
m_renderer = NULL; m_renderer = NULL;
m_wind = new Wind(); m_wind = new Wind();
@ -428,6 +440,9 @@ void IrrDriver::initDevice()
params.DriverType = video::EDT_OGLES2; params.DriverType = video::EDT_OGLES2;
#else #else
params.DriverType = video::EDT_OPENGL; params.DriverType = video::EDT_OPENGL;
#endif
#if defined(ANDROID)
params.PrivateData = (void*)global_android_app;
#endif #endif
params.Stencilbuffer = false; params.Stencilbuffer = false;
params.Bits = bits; params.Bits = bits;

View File

@ -45,6 +45,12 @@
#include <string> #include <string>
#include <vector> #include <vector>
#ifdef ANDROID
#include <android_native_app_glue.h>
extern struct android_app* global_android_app;
#endif
namespace irr namespace irr
{ {

View File

@ -29,6 +29,10 @@
#include "utils/log.hpp" #include "utils/log.hpp"
#include "utils/string_utils.hpp" #include "utils/string_utils.hpp"
#ifdef ANDROID
#include "io/assets_android.hpp"
#endif
#include <irrlicht.h> #include <irrlicht.h>
#include <stdio.h> #include <stdio.h>
@ -145,6 +149,11 @@ FileManager::FileManager()
m_file_system = irr::io::createFileSystem(); m_file_system = irr::io::createFileSystem();
#ifdef ANDROID
AssetsAndroid android_assets(this);
android_assets.init();
#endif
std::string exe_path; std::string exe_path;
// Search for the root directory // Search for the root directory

View File

@ -407,7 +407,11 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
} }
else if (selection == "quit") else if (selection == "quit")
{ {
#ifdef ANDROID
ANativeActivity_finish(global_android_app->activity);
#else
StateManager::get()->popMenu(); StateManager::get()->popMenu();
#endif
return; return;
} }
else if (selection == "about") else if (selection == "about")