summaryrefslogtreecommitdiff
path: root/platform/android/java_glue.cpp
diff options
context:
space:
mode:
authorMario Schlack <m4r10.5ch14ck@gmail.com>2016-07-20 14:54:48 +0200
committerMario Schlack <m4r10.5ch14ck@gmail.com>2016-07-20 14:54:48 +0200
commit07178937725d60e0f02050a3b39fc85e44c76b2d (patch)
treea80dc046e478807108665258ad3ccbed1f057d31 /platform/android/java_glue.cpp
parent87d0515d0935d0af929feeef15fb704773cc4a12 (diff)
Implement get_screen_dpi() on Android
Diffstat (limited to 'platform/android/java_glue.cpp')
-rw-r--r--platform/android/java_glue.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index b9d178280c..96e6b85230 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -668,6 +668,7 @@ static jmethodID _openURI=0;
static jmethodID _getDataDir=0;
static jmethodID _getLocale=0;
static jmethodID _getModel=0;
+static jmethodID _getScreenDPI=0;
static jmethodID _showKeyboard=0;
static jmethodID _hideKeyboard=0;
static jmethodID _setScreenOrientation=0;
@@ -712,6 +713,12 @@ static String _get_model() {
return String(env->GetStringUTFChars( s, NULL ));
}
+static int _get_screen_dpi() {
+
+ JNIEnv *env = ThreadAndroid::get_env();
+ return env->CallIntMethod(godot_io,_getScreenDPI);
+}
+
static String _get_unique_id() {
JNIEnv *env = ThreadAndroid::get_env();
@@ -821,6 +828,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e
_getDataDir = env->GetMethodID(c,"getDataDir","()Ljava/lang/String;");
_getLocale = env->GetMethodID(c,"getLocale","()Ljava/lang/String;");
_getModel = env->GetMethodID(c,"getModel","()Ljava/lang/String;");
+ _getScreenDPI = env->GetMethodID(c, "getScreenDPI","()I");
_getUniqueID = env->GetMethodID(c,"getUniqueID","()Ljava/lang/String;");
_showKeyboard = env->GetMethodID(c,"showKeyboard","(Ljava/lang/String;)V");
_hideKeyboard = env->GetMethodID(c,"hideKeyboard","()V");
@@ -875,7 +883,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e
__android_log_print(ANDROID_LOG_INFO,"godot","CMDLINE LEN %i - APK EXPANSION %I\n",cmdlen,int(use_apk_expansion));
- os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model,_show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _get_system_dir, _play_video,_is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, use_apk_expansion);
+ os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _get_system_dir, _play_video,_is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, use_apk_expansion);
os_android->set_need_reload_hooks(p_need_reload_hook);
char wd[500];