Allowing enabling and disabling of immersive mode via borderless setting and love.window.setMode()

This commit is contained in:
fysx
2015-01-20 16:01:43 +01:00
parent 36216c16be
commit 42f6beaa7e
4 changed files with 64 additions and 7 deletions
+14
View File
@@ -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.;
+2
View File
@@ -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.