summaryrefslogtreecommitdiff
path: root/src/porting_android.h
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-04-21 14:10:59 +0200
committersapier <Sapier at GMX dot net>2014-06-29 18:17:56 +0200
commit1cc40c0a7c260f0562572bc99f39a666a12f1b09 (patch)
treec5af6b9787f4c69faa634e82f6484ca4540a7f88 /src/porting_android.h
parentff36071d93266c1dd18708f8924d80aa1af5b33e (diff)
downloadminetest-1cc40c0a7c260f0562572bc99f39a666a12f1b09.tar.gz
minetest-1cc40c0a7c260f0562572bc99f39a666a12f1b09.tar.bz2
minetest-1cc40c0a7c260f0562572bc99f39a666a12f1b09.zip
Add support for Android 2.3+
There have been plenty of ppl involved in creating this version. I don't wanna mention names as I'm sure I'd forget someone so I just tell where help has been done: - The partial android versions done by various ppl - Testing on different android devices - reviewing code (especially the in core changes) - testing controls - reviewing texts A big thank you to everyone helping this to be completed!
Diffstat (limited to 'src/porting_android.h')
-rw-r--r--src/porting_android.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/porting_android.h b/src/porting_android.h
new file mode 100644
index 000000000..bfdadfbff
--- /dev/null
+++ b/src/porting_android.h
@@ -0,0 +1,81 @@
+/*
+Minetest
+Copyright (C) 2014 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#ifndef __PORTING_ANDROID_H__
+#define __PORTING_ANDROID_H__
+
+#ifndef __ANDROID__
+#error this include has to be included on android port only!
+#endif
+
+#include <jni.h>
+#include <android_native_app_glue.h>
+#include <android/log.h>
+
+#include <string>
+
+namespace porting {
+/** java app **/
+extern android_app *app_global;
+
+/** java <-> c++ interaction interface **/
+extern JNIEnv *jnienv;
+
+/**
+ * do initialization required on android only
+ */
+void initAndroid();
+void cleanupAndroid();
+
+/**
+ * set storage dir on external sdcard#
+ * @param lJNIEnv environment from android
+ */
+void setExternalStorageDir(JNIEnv* lJNIEnv);
+
+/**
+ * use java function to copy media from assets to external storage
+ */
+void copyAssets();
+
+/**
+ * show text input dialog in java
+ * @param acceptButton text to display on accept button
+ * @param hint hint to show
+ * @param current initial value to display
+ * @param editType type of texfield
+ * (1==multiline text input; 2==single line text input; 3=password field)
+ */
+void showInputDialog(const std::string& acceptButton,
+ const std::string& hint, const std::string& current, int editType);
+
+/**
+ * WORKAROUND for not working callbacks from java -> c++
+ * get current state of input dialog
+ */
+int getInputDialogState();
+
+/**
+ * WORKAROUND for not working callbacks from java -> c++
+ * get text in current input dialog
+ */
+std::string getInputDialogValue();
+
+}
+
+#endif