mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-10 07:07:03 +07:00
Possible fix for notched insets
This commit is contained in:
parent
c26a9bd123
commit
9c616fd03b
@ -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();
|
||||
|
@ -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.<Planet>getByName(ContentType.planet, split[0]).sectors.get(Integer.parseInt(split[1]));
|
||||
String name = jsonData.asString();
|
||||
int idx = name.lastIndexOf('-');
|
||||
return Vars.content.<Planet>getByName(ContentType.planet, name.substring(0, idx)).sectors.get(Integer.parseInt(name.substring(idx + 1)));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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){
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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{
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=e13f9a192be0bad00766ff15a6bf7d2897ba00d1
|
||||
archash=585978a8258bc1db3d844670dabb305ed7881b14
|
||||
|
Loading…
Reference in New Issue
Block a user