diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index 3b7504be6d..1eddb7b8fc 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -92,6 +92,12 @@ public class UI implements ApplicationListener, Loadable{ Core.scene = new Scene(); Core.input.addProcessor(Core.scene); + int[] insets = Core.graphics.getSafeInsets(); + Core.scene.marginLeft = insets[0]; + Core.scene.marginRight = insets[1]; + Core.scene.marginTop = insets[2]; + Core.scene.marginBottom = insets[3]; + Tex.load(); Icon.load(); Styles.load(); diff --git a/core/src/mindustry/io/JsonIO.java b/core/src/mindustry/io/JsonIO.java index eb3815ba76..aa395a425b 100644 --- a/core/src/mindustry/io/JsonIO.java +++ b/core/src/mindustry/io/JsonIO.java @@ -83,8 +83,9 @@ public class JsonIO{ @Override public Sector read(Json json, JsonValue jsonData, Class type){ - String[] split = jsonData.asString().split("-"); - return Vars.content.getByName(ContentType.planet, split[0]).sectors.get(Integer.parseInt(split[1])); + String name = jsonData.asString(); + int idx = name.lastIndexOf('-'); + return Vars.content.getByName(ContentType.planet, name.substring(0, idx)).sectors.get(Integer.parseInt(name.substring(idx + 1))); } }); diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 6b62f216d3..e9d857f79c 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -490,7 +490,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ hoverLabel.touchable = Touchable.disabled; Vec3 pos = planets.cam.project(Tmp.v31.set(hovered.tile.v).setLength(PlanetRenderer.outlineRad).rotate(Vec3.Y, -planets.planet.getRotation()).add(planets.planet.position)); - hoverLabel.setPosition(pos.x, pos.y, Align.center); + hoverLabel.setPosition(pos.x, pos.y - Core.scene.marginBottom, Align.center); hoverLabel.getText().setLength(0); if(hovered != null){ diff --git a/core/src/mindustry/ui/fragments/ChatFragment.java b/core/src/mindustry/ui/fragments/ChatFragment.java index 1020a74af9..2cef92009b 100644 --- a/core/src/mindustry/ui/fragments/ChatFragment.java +++ b/core/src/mindustry/ui/fragments/ChatFragment.java @@ -124,7 +124,7 @@ public class ChatFragment extends Table{ Draw.color(shadowColor); if(shown){ - Fill.crect(offsetx, chatfield.y, chatfield.getWidth() + 15f, chatfield.getHeight() - 1); + Fill.crect(offsetx, chatfield.y + scene.marginBottom, chatfield.getWidth() + 15f, chatfield.getHeight() - 1); } super.draw(); @@ -137,7 +137,7 @@ public class ChatFragment extends Table{ Draw.color(shadowColor); Draw.alpha(shadowColor.a * opacity); - float theight = offsety + spacing + getMarginBottom(); + float theight = offsety + spacing + getMarginBottom() + scene.marginBottom; for(int i = scrollPos; i < messages.size && i < messagesShown + scrollPos && (i < fadetime || shown); i++){ layout.setText(font, messages.get(i).formattedMessage, Color.white, textWidth, Align.bottomLeft, true); diff --git a/core/src/mindustry/ui/fragments/LoadingFragment.java b/core/src/mindustry/ui/fragments/LoadingFragment.java index 3914f48a71..17d07f502f 100644 --- a/core/src/mindustry/ui/fragments/LoadingFragment.java +++ b/core/src/mindustry/ui/fragments/LoadingFragment.java @@ -1,5 +1,6 @@ package mindustry.ui.fragments; +import arc.*; import arc.func.*; import arc.graphics.*; import arc.scene.*; @@ -18,7 +19,11 @@ public class LoadingFragment extends Fragment{ @Override public void build(Group parent){ - parent.fill(Styles.black8, t -> { + parent.fill(t -> { + //rect must fill screen completely. + t.rect((x, y, w, h) -> { + Styles.black8.draw(0, 0, Core.graphics.getWidth(), Core.graphics.getHeight()); + }); t.visible = false; t.touchable = Touchable.enabled; t.add().height(133f).row(); diff --git a/core/src/mindustry/ui/fragments/MenuFragment.java b/core/src/mindustry/ui/fragments/MenuFragment.java index 181bd90b40..d536ae1c00 100644 --- a/core/src/mindustry/ui/fragments/MenuFragment.java +++ b/core/src/mindustry/ui/fragments/MenuFragment.java @@ -77,12 +77,13 @@ public class MenuFragment extends Fragment{ String versionText = ((Version.build == -1) ? "[#fc8140aa]" : "[#ffffffba]") + Version.combined(); parent.fill((x, y, w, h) -> { TextureRegion logo = Core.atlas.find("logo"); + float width = Core.graphics.getWidth(), height = Core.graphics.getHeight() - Core.scene.marginTop; float logoscl = Scl.scl(1); float logow = Math.min(logo.width * logoscl, Core.graphics.getWidth() - Scl.scl(20)); float logoh = logow * (float)logo.height / logo.width; - float fx = (int)(Core.graphics.getWidth() / 2f); - float fy = (int)(Core.graphics.getHeight() - 6 - logoh) + logoh / 2 - (Core.graphics.isPortrait() ? Scl.scl(30f) : 0f); + float fx = (int)(width / 2f); + float fy = (int)(height - 6 - logoh) + logoh / 2 - (Core.graphics.isPortrait() ? Scl.scl(30f) : 0f); Draw.color(); Draw.rect(logo, fx, fy, logow, logoh); @@ -230,7 +231,7 @@ public class MenuFragment extends Fragment{ submenu.clearChildren(); fadeInMenu(); //correctly offset the button - submenu.add().height((Core.graphics.getHeight() - out[0].getY(Align.topLeft)) / Scl.scl(1f)); + submenu.add().height((Core.graphics.getHeight() - Core.scene.marginTop - Core.scene.marginBottom - out[0].getY(Align.topLeft)) / Scl.scl(1f)); submenu.row(); buttons(submenu, b.submenu); }else{ diff --git a/core/src/mindustry/ui/fragments/MinimapFragment.java b/core/src/mindustry/ui/fragments/MinimapFragment.java index 0bb3632a61..aee9f09793 100644 --- a/core/src/mindustry/ui/fragments/MinimapFragment.java +++ b/core/src/mindustry/ui/fragments/MinimapFragment.java @@ -28,7 +28,7 @@ public class MinimapFragment extends Fragment{ float size = baseSize * zoom * world.width(); Draw.color(Color.black); - Fill.crect(x, y, w, h); + Fill.crect(0, 0, w, h); if(renderer.minimap.getTexture() != null){ Draw.color(); diff --git a/core/src/mindustry/ui/fragments/ScriptConsoleFragment.java b/core/src/mindustry/ui/fragments/ScriptConsoleFragment.java index 3f33dd1b4b..71704dc5e7 100644 --- a/core/src/mindustry/ui/fragments/ScriptConsoleFragment.java +++ b/core/src/mindustry/ui/fragments/ScriptConsoleFragment.java @@ -112,7 +112,7 @@ public class ScriptConsoleFragment extends Table{ Draw.color(shadowColor); if(open){ - Fill.crect(offsetx, chatfield.y, chatfield.getWidth() + 15f, chatfield.getHeight() - 1); + Fill.crect(offsetx, chatfield.y + scene.marginBottom, chatfield.getWidth() + 15f, chatfield.getHeight() - 1); } super.draw(); @@ -125,7 +125,7 @@ public class ScriptConsoleFragment extends Table{ Draw.color(shadowColor); Draw.alpha(shadowColor.a * opacity); - float theight = offsety + spacing + getMarginBottom(); + float theight = offsety + spacing + getMarginBottom() + scene.marginBottom; for(int i = scrollPos; i < messages.size && i < messagesShown + scrollPos; i++){ layout.setText(font, messages.get(i), Color.white, textWidth, Align.bottomLeft, true); diff --git a/gradle.properties b/gradle.properties index 190a2e6b2e..a0137eb65e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=e13f9a192be0bad00766ff15a6bf7d2897ba00d1 +archash=585978a8258bc1db3d844670dabb305ed7881b14