Renamed layout/Unit to UnitScl to prevent name conflicts

This commit is contained in:
Anuken 2019-08-06 11:04:58 -04:00
parent 8ef1d54a16
commit 5c6bcbf9cd
26 changed files with 66 additions and 63 deletions

View File

@ -16,7 +16,7 @@ import io.anuke.arc.backends.android.surfaceview.AndroidApplicationConfiguration
import io.anuke.arc.files.FileHandle;
import io.anuke.arc.function.Consumer;
import io.anuke.arc.function.Predicate;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.util.Strings;
import io.anuke.arc.util.serialization.Base64Coder;
import io.anuke.mindustry.core.Platform;
@ -106,7 +106,7 @@ public class AndroidLauncher extends AndroidApplication{
};
if(doubleScaleTablets && isTablet(this.getContext())){
Unit.dp.addition = 0.5f;
UnitScl.dp.addition = 0.5f;
}
config.hideStatusBar = true;

View File

@ -5,7 +5,7 @@ import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.input.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.util.*;
import io.anuke.mindustry.core.GameState.*;
import io.anuke.mindustry.entities.*;
@ -46,7 +46,7 @@ public class Control implements ApplicationListener{
music = new MusicControl();
data = new GlobalData();
Unit.dp.setProduct(settings.getInt("uiscale", 100) / 100f);
UnitScl.dp.setProduct(settings.getInt("uiscale", 100) / 100f);
Core.input.setCatch(KeyCode.BACK, true);

View File

@ -10,6 +10,7 @@ import io.anuke.arc.graphics.glutils.FrameBuffer;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.mindustry.content.Fx;
@ -37,7 +38,7 @@ public class Renderer implements ApplicationListener{
public FrameBuffer shieldBuffer = new FrameBuffer(2, 2);
private Bloom bloom;
private Color clearColor;
private float targetscale = io.anuke.arc.scene.ui.layout.Unit.dp.scl(4);
private float targetscale = UnitScl.dp.scl(4);
private float camerascale = targetscale;
private Rectangle rect = new Rectangle(), rect2 = new Rectangle();
private float shakeIntensity, shaketime;
@ -357,7 +358,7 @@ public class Renderer implements ApplicationListener{
}
public void clampScale(){
float s = io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f);
float s = UnitScl.dp.scl(1f);
targetscale = Mathf.clamp(targetscale, s * 1.5f, Math.round(s * 6));
}

View File

@ -131,7 +131,7 @@ public class UI implements ApplicationListener{
generator = new FreeTypeFontGenerator(Core.files.internal("fonts/font.ttf"));
FreeTypeFontParameter param = new FreeTypeFontParameter(){{
size = (int)(9 * 2 * Math.max(Unit.dp.scl(1f), 0.5f));
size = (int)(9 * 2 * Math.max(UnitScl.dp.scl(1f), 0.5f));
shadowColor = Color.DARK_GRAY;
shadowOffsetY = 2;
incremental = true;

View File

@ -216,7 +216,7 @@ public class MapGenerateDialog extends FloatingDialog{
}
void rebuildFilters(){
int cols = Math.max((int)(Math.max(filterTable.getParent().getWidth(), Core.graphics.getWidth()/2f * 0.9f) / Unit.dp.scl(290f)), 1);
int cols = Math.max((int)(Math.max(filterTable.getParent().getWidth(), Core.graphics.getWidth()/2f * 0.9f) / UnitScl.dp.scl(290f)), 1);
filterTable.clearChildren();
filterTable.top().left();
int i = 0;

View File

@ -11,7 +11,7 @@ import io.anuke.arc.math.geom.*;
import io.anuke.arc.scene.Element;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.ui.TextField;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.util.*;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.input.Binding;
@ -258,7 +258,7 @@ public class MapView extends Element implements GestureListener{
float scaling = zoom * Math.min(width, height) / editor.width();
Draw.color(Pal.accent);
Lines.stroke(Unit.dp.scl(2f));
Lines.stroke(UnitScl.dp.scl(2f));
if((!editor.drawBlock.isMultiblock() || tool == EditorTool.eraser) && tool != EditorTool.fill){
if(tool == EditorTool.line && drawing){
@ -294,7 +294,7 @@ public class MapView extends Element implements GestureListener{
}
Draw.color(Pal.accent);
Lines.stroke(Unit.dp.scl(3f));
Lines.stroke(UnitScl.dp.scl(3f));
Lines.rect(x, y, width, height);
Draw.reset();
@ -320,7 +320,7 @@ public class MapView extends Element implements GestureListener{
public boolean zoom(float initialDistance, float distance){
if(!active()) return false;
float nzoom = distance - initialDistance;
zoom += nzoom / 10000f / Unit.dp.scl(1f) * zoom;
zoom += nzoom / 10000f / UnitScl.dp.scl(1f) * zoom;
clampZoom();
return false;
}

View File

@ -9,6 +9,7 @@ import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.mindustry.Vars;
@ -379,7 +380,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
boolean ints = font.usesIntegerPositions();
font.setUseIntegerPositions(false);
font.getData().setScale(0.25f / io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f));
font.getData().setScale(0.25f / UnitScl.dp.scl(1f));
layout.setText(font, name);
Draw.color(0f, 0f, 0f, 0.3f);
Fill.rect(x, y + nameHeight - layout.height / 2, layout.width + 2, layout.height + 3);

View File

@ -8,7 +8,7 @@ import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.graphics.glutils.FrameBuffer;
import io.anuke.arc.math.*;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.util.*;
import io.anuke.arc.util.noise.RidgedPerlin;
import io.anuke.arc.util.noise.Simplex;
@ -220,7 +220,7 @@ public class MenuRenderer implements Disposable{
public void render(){
time += Time.delta();
float scaling = Math.max(Unit.dp.scl(4f), Math.max(Core.graphics.getWidth() / ((width - 1f) * tilesize), Core.graphics.getHeight() / ((height - 1f) * tilesize)));
float scaling = Math.max(UnitScl.dp.scl(4f), Math.max(Core.graphics.getWidth() / ((width - 1f) * tilesize), Core.graphics.getHeight() / ((height - 1f) * tilesize)));
camera.position.set(width * tilesize / 2f, height * tilesize / 2f);
camera.resize(Core.graphics.getWidth() / scaling,
Core.graphics.getHeight() / scaling);

View File

@ -7,6 +7,7 @@ import io.anuke.arc.graphics.Pixmap.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.*;
import io.anuke.arc.math.geom.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.entities.*;
import io.anuke.mindustry.entities.type.*;
@ -77,7 +78,7 @@ public class MinimapRenderer implements Disposable{
for(Unit unit : units){
float rx = (unit.x - rect.x) / rect.width * w, ry = (unit.y - rect.y) / rect.width * h;
Draw.color(unit.getTeam().color);
Fill.rect(x + rx, y + ry, io.anuke.arc.scene.ui.layout.Unit.dp.scl(baseSize / 2f), io.anuke.arc.scene.ui.layout.Unit.dp.scl(baseSize / 2f));
Fill.rect(x + rx, y + ry, UnitScl.dp.scl(baseSize / 2f), UnitScl.dp.scl(baseSize / 2f));
}
Draw.color();

View File

@ -4,7 +4,7 @@ import io.anuke.arc.Core;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.graphics.glutils.Shader;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.util.Time;
public class Shaders{
@ -41,7 +41,7 @@ public class Shaders{
setUniformf("u_resolution", Core.graphics.getWidth(), Core.graphics.getHeight());
setUniformi("u_time", (int)(time += Core.graphics.getDeltaTime() * 60f));
setUniformf("u_uv", Core.atlas.white().getU(), Core.atlas.white().getV());
setUniformf("u_scl", Unit.dp.scl(1f));
setUniformf("u_scl", UnitScl.dp.scl(1f));
setUniformf("u_uv2", Core.atlas.white().getU2(), Core.atlas.white().getV2());
}
}
@ -117,8 +117,8 @@ public class Shaders{
@Override
public void apply(){
setUniformf("u_dp", Unit.dp.scl(1f));
setUniformf("u_time", Time.time() / Unit.dp.scl(1f));
setUniformf("u_dp", UnitScl.dp.scl(1f));
setUniformf("u_time", Time.time() / UnitScl.dp.scl(1f));
setUniformf("u_offset",
Core.camera.position.x - Core.camera.width / 2,
Core.camera.position.y - Core.camera.height / 2);

View File

@ -13,7 +13,7 @@ import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.*;
import io.anuke.arc.scene.actions.Actions;
import io.anuke.arc.scene.event.Touchable;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Fx;
@ -38,7 +38,7 @@ public class MobileInput extends InputHandler implements GestureListener{
private static final float maxPanSpeed = 1.3f;
private static Rectangle r1 = new Rectangle(), r2 = new Rectangle();
/** Distance to edge of screen to start panning. */
private final float edgePan = io.anuke.arc.scene.ui.layout.Unit.dp.scl(60f);
private final float edgePan = UnitScl.dp.scl(60f);
//gesture data
private Vector2 vector = new Vector2();
@ -765,7 +765,7 @@ public class MobileInput extends InputHandler implements GestureListener{
if(lastDistance == -1) lastDistance = initialDistance;
float amount = (Mathf.sign(distance > lastDistance) * 0.04f) * Time.delta();
renderer.scaleCamera(io.anuke.arc.scene.ui.layout.Unit.dp.scl(amount));
renderer.scaleCamera(UnitScl.dp.scl(amount));
lastDistance = distance;
return true;
}

View File

@ -57,7 +57,7 @@ public class MirrorFilter extends GenerateFilter{
clamper.accept(Tmp.v1.trns(angle - 90, size).add(image.getWidth()/2f + image.getX(), image.getHeight()/2f + image.getY()));
clamper.accept(Tmp.v2.set(Tmp.v1).sub(image.getWidth()/2f + image.getX(), image.getHeight()/2f + image.getY()).rotate(180f).add(image.getWidth()/2f + image.getX(), image.getHeight()/2f + image.getY()));
Lines.stroke(Unit.dp.scl(3f), Pal.accent);
Lines.stroke(UnitScl.dp.scl(3f), Pal.accent);
Lines.line(Tmp.v1.x, Tmp.v1.y, Tmp.v2.x, Tmp.v2.y);
Draw.reset();
}

View File

@ -3,7 +3,7 @@ package io.anuke.mindustry.ui;
import io.anuke.arc.graphics.Texture;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.scene.ui.Image;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.mindustry.graphics.Pal;
public class BorderImage extends Image{
@ -36,7 +36,7 @@ public class BorderImage extends Image{
Draw.color(Pal.gray);
Draw.alpha(parentAlpha);
Lines.stroke(Unit.dp.scl(thickness));
Lines.stroke(UnitScl.dp.scl(thickness));
Lines.rect(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
Draw.reset();
}

View File

@ -18,12 +18,12 @@ public class Minimap extends Table{
add(new Element(){
{
setSize(Unit.dp.scl(140f));
setSize(UnitScl.dp.scl(140f));
}
@Override
public void act(float delta){
setPosition(Unit.dp.scl(margin), Unit.dp.scl(margin));
setPosition(UnitScl.dp.scl(margin), UnitScl.dp.scl(margin));
super.act(delta);
}
@ -52,7 +52,7 @@ public class Minimap extends Table{
addListener(new ClickListener(){
{
tapSquareSize = Unit.dp.scl(11f);
tapSquareSize = UnitScl.dp.scl(11f);
}
@Override

View File

@ -5,7 +5,7 @@ import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.scene.Element;
import io.anuke.arc.scene.ui.Image;
import io.anuke.arc.scene.ui.layout.Stack;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.mindustry.graphics.Pal;
public class ReqImage extends Stack{
@ -21,7 +21,7 @@ public class ReqImage extends Stack{
@Override
public void draw(){
Lines.stroke(Unit.dp.scl(2f), Pal.removeBack);
Lines.stroke(UnitScl.dp.scl(2f), Pal.removeBack);
Lines.line(x, y - 2f + height, x + width, y - 2f);
Draw.color(Pal.remove);
Lines.line(x, y + height, x + width, y);

View File

@ -37,7 +37,7 @@ public class CustomGameDialog extends FloatingDialog{
ScrollPane pane = new ScrollPane(maps);
pane.setFadeScrollBars(false);
int maxwidth = Mathf.clamp((int)(Core.graphics.getWidth() / Unit.dp.scl(200)), 1, 8);
int maxwidth = Mathf.clamp((int)(Core.graphics.getWidth() / UnitScl.dp.scl(200)), 1, 8);
float images = 146f;
int i = 0;

View File

@ -26,7 +26,7 @@ import io.anuke.mindustry.ui.TreeLayout.*;
import static io.anuke.mindustry.Vars.*;
public class DeployDialog extends FloatingDialog{
private final float nodeSize = Unit.dp.scl(230f);
private final float nodeSize = UnitScl.dp.scl(230f);
private ObjectSet<ZoneNode> nodes = new ObjectSet<>();
private ZoneInfoDialog info = new ZoneInfoDialog();
private Rectangle bounds = new Rectangle();
@ -37,8 +37,8 @@ public class DeployDialog extends FloatingDialog{
ZoneNode root = new ZoneNode(Zones.groundZero, null);
TreeLayout layout = new TreeLayout();
layout.gapBetweenLevels = layout.gapBetweenNodes = Unit.dp.scl(60f);
layout.gapBetweenNodes = Unit.dp.scl(120f);
layout.gapBetweenLevels = layout.gapBetweenNodes = UnitScl.dp.scl(60f);
layout.gapBetweenNodes = UnitScl.dp.scl(120f);
layout.layout(root);
bounds.set(layout.getBounds());
bounds.y += nodeSize*0.4f;
@ -234,7 +234,7 @@ public class DeployDialog extends FloatingDialog{
for(ZoneNode node : nodes){
for(ZoneNode child : node.allChildren){
Lines.stroke(Unit.dp.scl(4f), node.zone.locked() || child.zone.locked() ? Pal.gray : Pal.gray);
Lines.stroke(UnitScl.dp.scl(4f), node.zone.locked() || child.zone.locked() ? Pal.gray : Pal.gray);
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
}
}

View File

@ -9,7 +9,7 @@ import io.anuke.arc.graphics.g2d.GlyphLayout;
import io.anuke.arc.scene.event.Touchable;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.util.*;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.mindustry.core.Platform;
@ -151,7 +151,7 @@ public class FileChooser extends FloatingDialog{
content.add(icontable).expandX().fillX();
content.row();
content.center().add(pane).width(Core.graphics.isPortrait() ? Core.graphics.getWidth() / Unit.dp.scl(1) : Core.graphics.getWidth() / Unit.dp.scl(2)).colspan(3).grow();
content.center().add(pane).width(Core.graphics.isPortrait() ? Core.graphics.getWidth() / UnitScl.dp.scl(1) : Core.graphics.getWidth() / UnitScl.dp.scl(2)).colspan(3).grow();
content.row();
if(!open){

View File

@ -117,7 +117,7 @@ public class MapsDialog extends FloatingDialog{
ScrollPane pane = new ScrollPane(maps);
pane.setFadeScrollBars(false);
int maxwidth = Mathf.clamp((int)(Core.graphics.getWidth() / Unit.dp.scl(230)), 1, 8);
int maxwidth = Mathf.clamp((int)(Core.graphics.getWidth() / UnitScl.dp.scl(230)), 1, 8);
float mapsize = 200f;
int i = 0;

View File

@ -6,7 +6,7 @@ import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.input.KeyCode;
import io.anuke.arc.scene.event.InputEvent;
import io.anuke.arc.scene.event.InputListener;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import static io.anuke.mindustry.Vars.*;
@ -24,7 +24,7 @@ public class MinimapDialog extends FloatingDialog{
void setup(){
cont.clear();
float size = Math.min(Core.graphics.getWidth(), Core.graphics.getHeight()) / Unit.dp.scl(1f) / 1.3f;
float size = Math.min(Core.graphics.getWidth(), Core.graphics.getHeight()) / UnitScl.dp.scl(1f) / 1.3f;
cont.table("pane", t -> {
t.addRect((x, y, width, height) -> {

View File

@ -24,7 +24,7 @@ import io.anuke.mindustry.world.Block.*;
import static io.anuke.mindustry.Vars.*;
public class TechTreeDialog extends FloatingDialog{
private final float nodeSize = Unit.dp.scl(60f);
private final float nodeSize = UnitScl.dp.scl(60f);
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
private TechTreeNode root = new TechTreeNode(TechTree.root, null);
private Rectangle bounds = new Rectangle();
@ -59,8 +59,8 @@ public class TechTreeDialog extends FloatingDialog{
void treeLayout(){
TreeLayout layout = new TreeLayout();
layout.gapBetweenLevels = Unit.dp.scl(60f);
layout.gapBetweenNodes = Unit.dp.scl(40f);
layout.gapBetweenLevels = UnitScl.dp.scl(60f);
layout.gapBetweenNodes = UnitScl.dp.scl(40f);
LayoutNode node = new LayoutNode(root, null);
layout.layout(node);
bounds.set(layout.getBounds());
@ -318,7 +318,7 @@ public class TechTreeDialog extends FloatingDialog{
for(TechTreeNode child : node.children){
if(!child.visible) continue;
Lines.stroke(Unit.dp.scl(4f), locked(node.node) || locked(child.node) ? Pal.gray : Pal.accent);
Lines.stroke(UnitScl.dp.scl(4f), locked(node.node) || locked(child.node) ? Pal.gray : Pal.accent);
Draw.alpha(parentAlpha);
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
}

View File

@ -11,7 +11,7 @@ import io.anuke.arc.scene.ui.Label;
import io.anuke.arc.scene.ui.Label.LabelStyle;
import io.anuke.arc.scene.ui.TextField;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.util.Align;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.Vars;
@ -33,9 +33,9 @@ public class ChatFragment extends Table{
private Label fieldlabel = new Label(">");
private BitmapFont font;
private GlyphLayout layout = new GlyphLayout();
private float offsetx = Unit.dp.scl(4), offsety = Unit.dp.scl(4), fontoffsetx = Unit.dp.scl(2), chatspace = Unit.dp.scl(50);
private float offsetx = UnitScl.dp.scl(4), offsety = UnitScl.dp.scl(4), fontoffsetx = UnitScl.dp.scl(2), chatspace = UnitScl.dp.scl(50);
private Color shadowColor = new Color(0, 0, 0, 0.4f);
private float textspacing = Unit.dp.scl(10);
private float textspacing = UnitScl.dp.scl(10);
private Array<String> history = new Array<>();
private int historyPos = 0;
private int scrollPos = 0;
@ -123,7 +123,7 @@ public class ChatFragment extends Table{
@Override
public void draw(){
float opacity = Core.settings.getInt("chatopacity") / 100f;
float textWidth = Math.min(Core.graphics.getWidth()/1.5f, Unit.dp.scl(700f));
float textWidth = Math.min(Core.graphics.getWidth()/1.5f, UnitScl.dp.scl(700f));
Draw.color(shadowColor);
@ -158,7 +158,7 @@ public class ChatFragment extends Table{
font.getCache().setAlphas(opacity);
}
Fill.crect(offsetx, theight - layout.height - 2, textWidth + Unit.dp.scl(4f), layout.height + textspacing);
Fill.crect(offsetx, theight - layout.height - 2, textWidth + UnitScl.dp.scl(4f), layout.height + textspacing);
Draw.color(shadowColor);
Draw.alpha(opacity * shadowColor.a);

View File

@ -13,7 +13,7 @@ import io.anuke.arc.scene.actions.*;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.style.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.core.GameState.*;
@ -102,7 +102,7 @@ public class HudFragment extends Fragment{
select.addImage("whiteui").color(Pal.gray).width(4f).fillY();
float size = Unit.dp.scl(dsize);
float size = UnitScl.dp.scl(dsize);
Array<Element> children = new Array<>(select.getChildren());
//now, you may be wondering, why is this necessary? the answer is, I don't know, but it fixes layout issues somehow
@ -114,7 +114,7 @@ public class HudFragment extends Fragment{
if(fi < 4){
elem.setSize(size);
}else{
elem.setSize(Unit.dp.scl(4f), size);
elem.setSize(UnitScl.dp.scl(4f), size);
}
elem.setPosition(fi * size, Core.graphics.getHeight(), Align.topLeft);
return true;
@ -238,7 +238,7 @@ public class HudFragment extends Fragment{
//fps display
cont.table(info -> {
info.top().left().margin(4).visible(() -> Core.settings.getBool("fps"));
info.update(() -> info.setTranslation(state.rules.waves || state.isEditor() ? 0f : -Unit.dp.scl(dsize * 4 + 3), 0));
info.update(() -> info.setTranslation(state.rules.waves || state.isEditor() ? 0f : -UnitScl.dp.scl(dsize * 4 + 3), 0));
IntFormat fps = new IntFormat("fps");
IntFormat ping = new IntFormat("ping");

View File

@ -73,12 +73,12 @@ public class MenuFragment extends Fragment{
String versionText = "[#ffffffba]" + ((Version.build == -1) ? "[#fc8140aa]custom build" : Version.modifier + " build " + Version.build);
parent.fill((x, y, w, h) -> {
float logoscl = (int)Unit.dp.scl(1);
float logow = Math.min(logo.getWidth() * logoscl, Core.graphics.getWidth() - Unit.dp.scl(20));
float logoscl = (int)UnitScl.dp.scl(1);
float logow = Math.min(logo.getWidth() * logoscl, Core.graphics.getWidth() - UnitScl.dp.scl(20));
float logoh = logow * (float)logo.getHeight() / logo.getWidth();
float fx = (int)(Core.graphics.getWidth() / 2f);
float fy = (int)(Core.graphics.getHeight() - 6 - logoh) + logoh / 2 - (Core.graphics.isPortrait() ? Unit.dp.scl(30f) : 0f);
float fy = (int)(Core.graphics.getHeight() - 6 - logoh) + logoh / 2 - (Core.graphics.isPortrait() ? UnitScl.dp.scl(30f) : 0f);
Draw.color();
Draw.rect(Draw.wrap(logo), fx, fy, logow, logoh);
@ -210,7 +210,7 @@ public class MenuFragment extends Fragment{
submenu.clearChildren();
fadeInMenu();
//correctly offset the button
submenu.add().height((Core.graphics.getHeight() - out[0].getY(Align.topLeft)) / Unit.dp.scl(1f));
submenu.add().height((Core.graphics.getHeight() - out[0].getY(Align.topLeft)) / UnitScl.dp.scl(1f));
submenu.row();
buttons(submenu, b.submenu);
}else{

View File

@ -7,7 +7,7 @@ import io.anuke.arc.scene.Group;
import io.anuke.arc.scene.event.Touchable;
import io.anuke.arc.scene.ui.Image;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.util.Interval;
import io.anuke.arc.util.Scaling;
import io.anuke.mindustry.core.GameState.State;
@ -84,7 +84,7 @@ public class PlayerListFragment extends Fragment{
super.draw();
Draw.color(Pal.gray);
Draw.alpha(parentAlpha);
Lines.stroke(Unit.dp.scl(4f));
Lines.stroke(UnitScl.dp.scl(4f));
Lines.rect(x, y, width, height);
Draw.reset();
}

View File

@ -4,7 +4,7 @@ import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
import io.anuke.arc.Core;
import io.anuke.arc.files.FileHandle;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.util.Strings;
import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.game.Saves.SaveSlot;
@ -31,9 +31,9 @@ public class IOSLauncher extends IOSApplication.Delegate{
Net.setServerProvider(new ArcNetServer());
if(UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad){
Unit.dp.addition = 0.5f;
UnitScl.dp.addition = 0.5f;
}else{
Unit.dp.addition = -0.5f;
UnitScl.dp.addition = -0.5f;
}
Platform.instance = new Platform(){