From 07178937725d60e0f02050a3b39fc85e44c76b2d Mon Sep 17 00:00:00 2001 From: Mario Schlack Date: Wed, 20 Jul 2016 14:54:48 +0200 Subject: Implement get_screen_dpi() on Android --- platform/android/java_glue.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'platform/android/java_glue.cpp') 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]; -- cgit v1.2.3