1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Android support (#299)

* AI libs registering shenanigans on android;
* Fixed resolution aspect + mouse event scaling;
* Proper server init/deinit (through android IPC);
Enabled threaded init in CMT;
* Prevented a deadlock in logger on some devices;
* Fixed frozen intro frame after interrupting the video;
Added android progressbar displaying during initial data loading;
* Hacky fix for choppy animations during heroes movement (should look better now, but it's definitely not a good solution);
* Changes/fixes for new android launcher building process;
* Fixed app hang after getting SDL_QUIT when activity was destroyed;
* Functioanal, configurable advmap swiping support;
* VCMI changes cleanup;
Added few missing VCMI_ANDROID guards on swipe mechanics;
* Removed unneeded sleep in server startup code for android;
* Removed android ioapi hack (fixed in newest ndk);
* Removed unused android's library loading logic;
* Added android's swipe option to settings schema;
* Moved NO_STD_TOSTRING to be defined in global.h instead of build files;
This commit is contained in:
Fay
2017-05-25 19:57:20 +02:00
committed by Alexander Shishkin
parent f370cdf1c7
commit b5daa24982
25 changed files with 643 additions and 189 deletions

41
lib/CAndroidVMHelper.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* CAndroidVMHelper.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include <jni.h>
#include <string>
/// helper class that allows access to java vm to communicate with java code from native
class CAndroidVMHelper
{
JNIEnv * envPtr;
bool detachInDestructor;
jclass findClass(const std::string & name, bool classloaded);
public:
CAndroidVMHelper();
~CAndroidVMHelper();
JNIEnv * get();
jclass findClassloadedClass(const std::string & name);
void callStaticVoidMethod(const std::string & cls, const std::string & method, bool classloaded = false);
std::string callStaticStringMethod(const std::string & cls, const std::string & method, bool classloaded = false);
static void cacheVM(JNIEnv * env);
static void cacheVM(JavaVM * vm);
static constexpr const char * NATIVE_METHODS_DEFAULT_CLASS = "eu/vcmi/vcmi/NativeMethods";
};