mirror of
https://github.com/love2d/love-android.git
synced 2026-08-20 20:51:22 +02:00
properly detect whether we are in "fullscreen" (i.e. immersive) on Android
This commit is contained in:
@@ -49,6 +49,24 @@ void setImmersive (bool immersive_active) {
|
||||
env->DeleteLocalRef (clazz);
|
||||
}
|
||||
|
||||
bool getImmersive () {
|
||||
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
|
||||
|
||||
jobject activity = (jobject) SDL_AndroidGetActivity();
|
||||
|
||||
jclass clazz (env->GetObjectClass(activity));
|
||||
jmethodID method_id = env->GetMethodID (clazz, "getImmersiveMode", "()Z");
|
||||
|
||||
jboolean immersive_active = env->CallBooleanMethod (activity, method_id);
|
||||
|
||||
env->DeleteLocalRef (activity);
|
||||
env->DeleteLocalRef (clazz);
|
||||
|
||||
if (immersive_active)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
double getScreenScale()
|
||||
{
|
||||
static double result = -1.;
|
||||
|
||||
@@ -32,7 +32,11 @@ namespace love
|
||||
namespace android
|
||||
{
|
||||
|
||||
/**
|
||||
* Enables or disables immersive mode where the navigation bar is hidden.
|
||||
**/
|
||||
void setImmersive (bool immersive_active);
|
||||
bool getImmersive ();
|
||||
|
||||
/**
|
||||
* Gets the scale factor of the window's screen, e.g. on Retina displays this
|
||||
|
||||
Reference in New Issue
Block a user