v3.2.3: initial overhaul to inset functionality for edge-to-edge

This commit is contained in:
Evan Debenham
2025-08-29 14:36:24 -04:00
parent 0630d65cc6
commit 09f5948aa2
23 changed files with 376 additions and 175 deletions

View File

@@ -58,15 +58,6 @@ public class DeviceCompat {
Gdx.app.log( tag, message );
}
public static RectF getSafeInsets(){
RectF result = new RectF();
result.left = Gdx.graphics.getSafeInsetLeft();
result.top = Gdx.graphics.getSafeInsetTop();
result.right = Gdx.graphics.getSafeInsetRight();
result.bottom = Gdx.graphics.getSafeInsetBottom();
return result;
}
//some devices (macOS mainly) report virtual pixels to Shattered, but sometimes we want real pixel precision
//this returns the number of real pixels per virtual pixel in the X dimension...
public static float getRealPixelScaleX(){

View File

@@ -39,6 +39,24 @@ public abstract class PlatformSupport {
public boolean supportsFullScreen(){
return true; //default
}
public static final int INSET_ALL = 3; //All insets, from hole punches to nav bars
public static final int INSET_LRG = 2; //Only big insets, full size notches and nav bars
public static final int INSET_BLK = 1; //only complete blocker assets like navbars
public RectF getSafeInsets( int level ){
return new RectF(
Gdx.graphics.getSafeInsetLeft(),
Gdx.graphics.getSafeInsetTop(),
Gdx.graphics.getSafeInsetRight(),
Gdx.graphics.getSafeInsetBottom()
);
}
//returns a display cutout (if one is present) in device pixels, or null is none is present
public RectF getDisplayCutout(){
return null;
}
public abstract void updateSystemUI();