Add love.window.getSafeArea (resolves issue #1437). Returns a rectangle (x, y, w, h) inside the window which is known to be unobstructed by a system title bar, the iPhone X notch, etc. Useful for making sure UI elements can be seen by the user.

Currently it only has a proper implementation on iOS and will return the window's full size otherwise.
This commit is contained in:
Alex Szpakowski
2018-12-26 00:34:14 -04:00
parent 1c853cbcc3
commit d41aca836e
6 changed files with 81 additions and 3 deletions
+10
View File
@@ -25,8 +25,12 @@
#ifdef LOVE_IOS
#include "common/math.h"
#include <string>
struct SDL_Window;
namespace love
{
namespace ios
@@ -74,6 +78,12 @@ void setAudioMixWithOthers(bool mixEnabled);
**/
bool hasBackgroundMusic();
/**
* Gets the area in the window that is safe for UI to render to (not covered by
* the status bar, notch, etc.)
**/
Rect getSafeArea(SDL_Window *window);
} // ios
} // love