Renamed layout/Unit to UnitScl to prevent name conflicts
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) -> {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user