v3.2.3: improved inset handling in game scene (except for top insets)

This commit is contained in:
Evan Debenham
2025-08-31 15:26:25 -04:00
parent b9133439bd
commit ded892c54e
@@ -232,7 +232,7 @@ public class GameScene extends PixelScene {
case 1: Camera.main.setFollowDeadzone(0.9f); break; case 1: Camera.main.setFollowDeadzone(0.9f); break;
} }
RectF insets = Game.platform.getSafeInsets(PlatformSupport.INSET_ALL).scale(1f/defaultZoom); RectF insets = getCommonInsets();
scene = this; scene = this;
@@ -377,9 +377,9 @@ public class GameScene extends PixelScene {
add(status); add(status);
if (uiSize < 2 && insets.top > 0) { if (uiSize < 2 && insets.top > 0) {
SkinnedBlock blackBar = new SkinnedBlock(uiCamera.width, insets.top, TextureCache.createSolid(0xFF000000)); SkinnedBlock bar = new SkinnedBlock(uiCamera.width, insets.top, TextureCache.createSolid(0xFF000000));
blackBar.camera = uiCamera; bar.camera = uiCamera;
add(blackBar); add(bar);
} }
boss = new BossHealthBar(); boss = new BossHealthBar();
@@ -427,12 +427,11 @@ public class GameScene extends PixelScene {
toolbar.setRect( insets.left, uiCamera.height - toolbar.height() - insets.bottom, uiCamera.width - insets.right, toolbar.height() ); toolbar.setRect( insets.left, uiCamera.height - toolbar.height() - insets.bottom, uiCamera.width - insets.right, toolbar.height() );
} }
//TODO this is pretty barebones, could be minimized or avoided perhaps?
if (insets.bottom > 0){ if (insets.bottom > 0){
SkinnedBlock blackBar = new SkinnedBlock(uiCamera.width, insets.bottom, TextureCache.createSolid(0xFF000000)); SkinnedBlock bar = new SkinnedBlock(uiCamera.width, insets.bottom, TextureCache.createSolid(0x88000000));
blackBar.camera = uiCamera; bar.camera = uiCamera;
blackBar.y = uiCamera.height - insets.bottom; bar.y = uiCamera.height - insets.bottom;
add(blackBar); add(bar);
} }
layoutTags(); layoutTags();
@@ -857,8 +856,8 @@ public class GameScene extends PixelScene {
} }
//Camera.main.panTo(Dungeon.hero.sprite.center(), 5f); //Camera.main.panTo(Dungeon.hero.sprite.center(), 5f);
//primarily for phones displays with notches //adjust spacing for elements based on display cutouts
//TODO Android never draws into notch atm, perhaps allow it for center notches? // We use ALL here as some elements can be a fair but up the side of the screen
RectF insets = Game.platform.getSafeInsets( PlatformSupport.INSET_ALL ); RectF insets = Game.platform.getSafeInsets( PlatformSupport.INSET_ALL );
insets = insets.scale(1f / uiCamera.zoom); insets = insets.scale(1f / uiCamera.zoom);