v3.2.3: implemented mostly complete new iOS inset support

This commit is contained in:
Evan Debenham
2025-08-30 17:32:57 -04:00
committed by Evan Debenham
parent 0a6a93ec47
commit 452f944678
7 changed files with 64 additions and 24 deletions

View File

@@ -50,9 +50,6 @@ public class Game implements ApplicationListener {
public static int width;
public static int height;
//number of pixels from bottom of view before rendering starts
public static int bottomInset;
// Density: mdpi=1, hdpi=1.5, xhdpi=2...
public static float density = 1;
@@ -136,7 +133,6 @@ public class Game implements ApplicationListener {
Vertexbuffer.reload();
}
height -= bottomInset;
if (height != Game.height || width != Game.width) {
Game.width = width;

View File

@@ -172,7 +172,7 @@ public class NoosaScript extends Script {
Gdx.gl20.glScissor(
Math.round(camera.x * xScale),
Math.round((Game.height - camera.screenHeight - camera.y) * yScale) + Game.bottomInset,
Math.round((Game.height - camera.screenHeight - camera.y) * yScale),
Math.round(camera.screenWidth * xScale),
Math.round(camera.screenHeight * yScale));
} else {

View File

@@ -64,7 +64,7 @@ public class TextInput extends Component {
//use a custom viewport here to ensure stage camera matches game camera
Viewport viewport = new Viewport() {};
viewport.setWorldSize(Game.width, Game.height);
viewport.setScreenBounds(0, Game.bottomInset, Game.width, Game.height);
viewport.setScreenBounds(0, 0, Game.width, Game.height);
viewport.setCamera(new OrthographicCamera());
//TODO this is needed for the moment as Spritebatch switched to using VAOs in libGDX v1.13.1
// This results in HARD crashes atm, whereas old vertex arrays work fine

View File

@@ -66,7 +66,7 @@ public class DeviceCompat {
//...and in the Y dimension
public static float getRealPixelScaleY(){
return ((Gdx.graphics.getBackBufferHeight()-Game.bottomInset) / (float)Game.height );
return (Gdx.graphics.getBackBufferHeight() / (float)Game.height );
}
}