mirror of
https://github.com/love2d/love-android.git
synced 2026-08-18 03:34:18 +02:00
Allowing enabling and disabling of immersive mode via borderless setting and love.window.setMode()
This commit is contained in:
@@ -35,6 +35,20 @@ namespace love
|
||||
namespace android
|
||||
{
|
||||
|
||||
void setBorderless (bool borderless_active) {
|
||||
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
|
||||
|
||||
jobject activity = (jobject) SDL_AndroidGetActivity();
|
||||
|
||||
jclass clazz (env->GetObjectClass(activity));
|
||||
jmethodID method_id = env->GetMethodID (clazz, "setImmersiveMode", "(Z)V");
|
||||
|
||||
env->CallVoidMethod (activity, method_id, borderless_active);
|
||||
|
||||
env->DeleteLocalRef (activity);
|
||||
env->DeleteLocalRef (clazz);
|
||||
}
|
||||
|
||||
double getScreenScale()
|
||||
{
|
||||
static double result = -1.;
|
||||
|
||||
@@ -32,6 +32,8 @@ namespace love
|
||||
namespace android
|
||||
{
|
||||
|
||||
void setBorderless (bool borderless_active);
|
||||
|
||||
/**
|
||||
* Gets the scale factor of the window's screen, e.g. on Retina displays this
|
||||
* will return 2.0.
|
||||
|
||||
@@ -244,6 +244,10 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
||||
|
||||
if (!gfx->setMode(width, height, curMode.settings.sRGB))
|
||||
showMessageBox("Could not set graphics mode", "Unsupported OpenGL version?", MESSAGEBOX_ERROR, true);
|
||||
|
||||
#ifdef LOVE_ANDROID
|
||||
love::android::setBorderless(f.borderless);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Make sure the mouse keeps its previous grab setting.
|
||||
|
||||
Reference in New Issue
Block a user