Change scaling
This commit is contained in:
@@ -80,7 +80,7 @@ project(":core") {
|
|||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.github.anuken:ucore:4cb594bc68'
|
compile 'com.github.anuken:ucore:7938cb4bf9'
|
||||||
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
|
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import io.anuke.ucore.scene.builders.table;
|
|||||||
import io.anuke.ucore.scene.ui.ImageButton;
|
import io.anuke.ucore.scene.ui.ImageButton;
|
||||||
import io.anuke.ucore.scene.ui.Label;
|
import io.anuke.ucore.scene.ui.Label;
|
||||||
import io.anuke.ucore.scene.ui.TextButton;
|
import io.anuke.ucore.scene.ui.TextButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Tmp;
|
import io.anuke.ucore.util.Tmp;
|
||||||
|
|
||||||
@@ -62,8 +61,8 @@ public class Tutorial{
|
|||||||
|
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
prev.pad(Unit.dp.scl(16));
|
prev.pad(16);
|
||||||
next.pad(Unit.dp.scl(16));
|
next.pad(16);
|
||||||
|
|
||||||
prev.setDisabled(()->!canMove(false) || !stage.canBack);
|
prev.setDisabled(()->!canMove(false) || !stage.canBack);
|
||||||
next.setDisabled(()->!stage.canForward);
|
next.setDisabled(()->!stage.canForward);
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public class UI extends SceneModule{
|
|||||||
//gameerror.setFillParent(true);
|
//gameerror.setFillParent(true);
|
||||||
|
|
||||||
discord = new Dialog("Discord", "dialog");
|
discord = new Dialog("Discord", "dialog");
|
||||||
discord.content().pad(Unit.dp.scl(12f));
|
discord.content().pad(12f);
|
||||||
discord.content().add("Join the mindustry discord!\n[orange]" + Vars.discordURL);
|
discord.content().add("Join the mindustry discord!\n[orange]" + Vars.discordURL);
|
||||||
discord.buttons().defaults().size(200f, 50);
|
discord.buttons().defaults().size(200f, 50);
|
||||||
discord.buttons().addButton("Open link", () -> Mindustry.platforms.openLink(Vars.discordURL));
|
discord.buttons().addButton("Open link", () -> Mindustry.platforms.openLink(Vars.discordURL));
|
||||||
@@ -367,7 +367,7 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
public void showError(String text){
|
public void showError(String text){
|
||||||
new Dialog("[crimson]An error has occured", "dialog"){{
|
new Dialog("[crimson]An error has occured", "dialog"){{
|
||||||
content().pad(Unit.dp.scl(15));
|
content().pad(15);
|
||||||
content().add(text);
|
content().add(text);
|
||||||
getButtonTable().addButton("OK", ()->{
|
getButtonTable().addButton("OK", ()->{
|
||||||
hide();
|
hide();
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import io.anuke.ucore.graphics.Pixmaps;
|
|||||||
import io.anuke.ucore.scene.builders.*;
|
import io.anuke.ucore.scene.builders.*;
|
||||||
import io.anuke.ucore.scene.ui.*;
|
import io.anuke.ucore.scene.ui.*;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class MapEditorDialog extends Dialog{
|
public class MapEditorDialog extends Dialog{
|
||||||
private MapEditor editor;
|
private MapEditor editor;
|
||||||
@@ -152,7 +151,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
public void build(){
|
public void build(){
|
||||||
|
|
||||||
new table(){{
|
new table(){{
|
||||||
float isize = Unit.dp.scl(16*2f);
|
float isize = 16*2f;
|
||||||
aleft();
|
aleft();
|
||||||
|
|
||||||
new table(){{
|
new table(){{
|
||||||
@@ -220,7 +219,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
for(EditorTool tool : EditorTool.values()){
|
for(EditorTool tool : EditorTool.values()){
|
||||||
ImageButton button = new ImageButton("icon-" + tool.name(), "toggle");
|
ImageButton button = new ImageButton("icon-" + tool.name(), "toggle");
|
||||||
button.clicked(() -> view.setTool(tool));
|
button.clicked(() -> view.setTool(tool));
|
||||||
button.resizeImage(Unit.dp.scl(16*2f));
|
button.resizeImage(16*2f);
|
||||||
group.add(button);
|
group.add(button);
|
||||||
|
|
||||||
tools.add(button).size(80f, 85f).padBottom(-6f);
|
tools.add(button).size(80f, 85f).padBottom(-6f);
|
||||||
@@ -312,7 +311,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
|
|
||||||
ImageButton button = new ImageButton(Draw.hasRegion(block.name) ? Draw.region(block.name) : Draw.region(block.name + "1"), "toggle");
|
ImageButton button = new ImageButton(Draw.hasRegion(block.name) ? Draw.region(block.name) : Draw.region(block.name + "1"), "toggle");
|
||||||
button.clicked(() -> editor.setDrawBlock(block));
|
button.clicked(() -> editor.setDrawBlock(block));
|
||||||
button.resizeImage(Unit.dp.scl(8*4f));
|
button.resizeImage(8*4f);
|
||||||
group.add(button);
|
group.add(button);
|
||||||
content.add(button).pad(4f).size(53f, 58f);
|
content.add(button).pad(4f).size(53f, 58f);
|
||||||
|
|
||||||
@@ -321,7 +320,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content.padLeft(Unit.dp.scl(-5f));
|
content.padLeft(-5f);
|
||||||
|
|
||||||
group.getButtons().get(2).setChecked(true);
|
group.getButtons().get(2).setChecked(true);
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import io.anuke.ucore.scene.ui.Image;
|
|||||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||||
import io.anuke.ucore.scene.ui.layout.Stack;
|
import io.anuke.ucore.scene.ui.layout.Stack;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class MapGenerateDialog extends FloatingDialog{
|
public class MapGenerateDialog extends FloatingDialog{
|
||||||
private MapEditor editor;
|
private MapEditor editor;
|
||||||
@@ -46,7 +45,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||||||
image.setScaling(Scaling.fit);
|
image.setScaling(Scaling.fit);
|
||||||
Table preft = new Table();
|
Table preft = new Table();
|
||||||
preft.left();
|
preft.left();
|
||||||
preft.pad(Unit.dp.scl(4f)).padRight(Unit.dp.scl(25f));
|
preft.pad(4f).padRight(25f);
|
||||||
|
|
||||||
for(GenPref pref : editor.getFilter().getPrefs().values()){
|
for(GenPref pref : editor.getFilter().getPrefs().values()){
|
||||||
CheckBox box = new CheckBox(pref.name);
|
CheckBox box = new CheckBox(pref.name);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import io.anuke.ucore.scene.ui.ButtonGroup;
|
|||||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||||
import io.anuke.ucore.scene.ui.TextButton;
|
import io.anuke.ucore.scene.ui.TextButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class MapLoadDialog extends FloatingDialog{
|
public class MapLoadDialog extends FloatingDialog{
|
||||||
Map selected = Vars.world.maps().getMap(0);
|
Map selected = Vars.world.maps().getMap(0);
|
||||||
@@ -24,7 +23,7 @@ public class MapLoadDialog extends FloatingDialog{
|
|||||||
|
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.defaults().size(200f, 90f).pad(4f);
|
table.defaults().size(200f, 90f).pad(4f);
|
||||||
table.pad(Unit.dp.scl(10f));
|
table.pad(10f);
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(table, "horizontal");
|
ScrollPane pane = new ScrollPane(table, "horizontal");
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
@@ -33,7 +32,7 @@ public class MapLoadDialog extends FloatingDialog{
|
|||||||
if(!map.visible) continue;
|
if(!map.visible) continue;
|
||||||
|
|
||||||
TextButton button = new TextButton(map.name, "toggle");
|
TextButton button = new TextButton(map.name, "toggle");
|
||||||
button.add(new BorderImage(map.texture, 2f)).size(Unit.dp.scl(16*4f));
|
button.add(new BorderImage(map.texture, 2f)).size(16*4f);
|
||||||
button.getCells().reverse();
|
button.getCells().reverse();
|
||||||
button.clicked(() -> selected = map);
|
button.clicked(() -> selected = map);
|
||||||
button.getLabelCell().grow().left().padLeft(5f);
|
button.getLabelCell().grow().left().padLeft(5f);
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
if(pop) ScissorStack.popScissors();
|
if(pop) ScissorStack.popScissors();
|
||||||
|
|
||||||
Draw.color(Colors.get("accent"));
|
Draw.color(Colors.get("accent"));
|
||||||
Draw.thick(Unit.dp.scl(3f));
|
Draw.thick(3f);
|
||||||
Draw.linerect(x + width/2 - size/2, y + height/2 - size/2, size, size);
|
Draw.linerect(x + width/2 - size/2, y + height/2 - size/2, size, size);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public class FileChooser extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupWidgets(){
|
private void setupWidgets(){
|
||||||
getCell(content()).maxWidth(Gdx.graphics.getWidth()/2);
|
getCell(content()).width(Gdx.graphics.getWidth() / Unit.dp.scl(2f));
|
||||||
content().pad(-Unit.dp.scl(10));
|
content().pad(-10);
|
||||||
|
|
||||||
Table content = new Table();
|
Table content = new Table();
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
|
|
||||||
Table icontable = new Table();
|
Table icontable = new Table();
|
||||||
|
|
||||||
float isize = Unit.dp.scl(14*2);
|
float isize = 14*2;
|
||||||
|
|
||||||
ImageButton up = new ImageButton("icon-folder-parent");
|
ImageButton up = new ImageButton("icon-folder-parent");
|
||||||
up.resizeImage(isize);
|
up.resizeImage(isize);
|
||||||
@@ -135,7 +135,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
//content.add(navigation).colspan(3).left().padBottom(10f).expandX().fillX().height(40f);
|
//content.add(navigation).colspan(3).left().padBottom(10f).expandX().fillX().height(40f);
|
||||||
//content.row();
|
//content.row();
|
||||||
|
|
||||||
content.center().add(pane).width(Gdx.graphics.getWidth()/2).colspan(3).units(Unit.px).grow();
|
content.center().add(pane).width(Gdx.graphics.getWidth()/2).colspan(3).grow();
|
||||||
content.row();
|
content.row();
|
||||||
|
|
||||||
if(!open){
|
if(!open){
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.badlogic.gdx.graphics.Colors;
|
|||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
|
|
||||||
import io.anuke.ucore.scene.ui.Dialog;
|
import io.anuke.ucore.scene.ui.Dialog;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class FloatingDialog extends Dialog{
|
public class FloatingDialog extends Dialog{
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ public class FloatingDialog extends Dialog{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("Back", "icon-arrow-left", Unit.dp.scl(30f), ()->{
|
buttons().addImageTextButton("Back", "icon-arrow-left", 30f, ()->{
|
||||||
hide();
|
hide();
|
||||||
}).size(230f, 64f);
|
}).size(230f, 64f);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import io.anuke.ucore.core.Timers;
|
|||||||
import io.anuke.ucore.scene.ui.*;
|
import io.anuke.ucore.scene.ui.*;
|
||||||
import io.anuke.ucore.scene.ui.layout.Stack;
|
import io.anuke.ucore.scene.ui.layout.Stack;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
import io.anuke.ucore.scene.utils.Elements;
|
import io.anuke.ucore.scene.utils.Elements;
|
||||||
|
|
||||||
public class LevelDialog extends FloatingDialog{
|
public class LevelDialog extends FloatingDialog{
|
||||||
@@ -106,7 +105,7 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
|
|
||||||
maps.add(stack).width(170).top().pad(4f);
|
maps.add(stack).width(170).top().pad(4f);
|
||||||
|
|
||||||
maps.padRight(Unit.dp.scl(26));
|
maps.padRight(26);
|
||||||
|
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import io.anuke.ucore.scene.ui.Label;
|
|||||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||||
import io.anuke.ucore.scene.ui.TextButton;
|
import io.anuke.ucore.scene.ui.TextButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
//TODO unified save/load dialogs
|
//TODO unified save/load dialogs
|
||||||
public class LoadDialog extends FloatingDialog{
|
public class LoadDialog extends FloatingDialog{
|
||||||
@@ -44,13 +43,13 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
pane = new ScrollPane(slots);
|
pane = new ScrollPane(slots);
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
|
|
||||||
slots.padRight(Unit.dp.scl(24));
|
slots.padRight(24);
|
||||||
|
|
||||||
for(int i = 0; i < Vars.saveSlots; i++){
|
for(int i = 0; i < Vars.saveSlots; i++){
|
||||||
final int slot = i;
|
final int slot = i;
|
||||||
|
|
||||||
TextButton button = new TextButton("[accent]Slot " + (i + 1));
|
TextButton button = new TextButton("[accent]Slot " + (i + 1));
|
||||||
button.pad(Unit.dp.scl(12));
|
button.pad(12);
|
||||||
button.getLabelCell().top().left().growX();
|
button.getLabelCell().top().left().growX();
|
||||||
|
|
||||||
button.row();
|
button.row();
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import io.anuke.ucore.scene.builders.imagebutton;
|
|||||||
import io.anuke.ucore.scene.ui.ConfirmDialog;
|
import io.anuke.ucore.scene.ui.ConfirmDialog;
|
||||||
import io.anuke.ucore.scene.ui.ImageButton;
|
import io.anuke.ucore.scene.ui.ImageButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Cell;
|
import io.anuke.ucore.scene.ui.layout.Cell;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class MenuDialog extends FloatingDialog{
|
public class MenuDialog extends FloatingDialog{
|
||||||
private SaveDialog save = new SaveDialog();
|
private SaveDialog save = new SaveDialog();
|
||||||
@@ -74,7 +73,7 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
PressGroup group = new PressGroup();
|
PressGroup group = new PressGroup();
|
||||||
|
|
||||||
content().defaults().size(120f).pad(5);
|
content().defaults().size(120f).pad(5);
|
||||||
float isize = Unit.dp.scl(14f*4);
|
float isize = 14f*4;
|
||||||
|
|
||||||
new imagebutton("icon-play-2", isize, () -> {
|
new imagebutton("icon-play-2", isize, () -> {
|
||||||
hide();
|
hide();
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.badlogic.gdx.utils.Align;
|
|||||||
|
|
||||||
import io.anuke.ucore.scene.ui.Image;
|
import io.anuke.ucore.scene.ui.Image;
|
||||||
import io.anuke.ucore.scene.ui.KeybindDialog;
|
import io.anuke.ucore.scene.ui.KeybindDialog;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class MindustryKeybindDialog extends KeybindDialog{
|
public class MindustryKeybindDialog extends KeybindDialog{
|
||||||
|
|
||||||
@@ -22,7 +21,7 @@ public class MindustryKeybindDialog extends KeybindDialog{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("Back", "icon-arrow-left", Unit.dp.scl(30f), ()->{
|
buttons().addImageTextButton("Back", "icon-arrow-left", 30f, ()->{
|
||||||
hide();
|
hide();
|
||||||
}).size(230f, 64f);
|
}).size(230f, 64f);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.badlogic.gdx.utils.Align;
|
|||||||
import io.anuke.ucore.scene.ui.Image;
|
import io.anuke.ucore.scene.ui.Image;
|
||||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||||
import io.anuke.ucore.scene.ui.SettingsDialog;
|
import io.anuke.ucore.scene.ui.SettingsDialog;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class MindustrySettingsDialog extends SettingsDialog{
|
public class MindustrySettingsDialog extends SettingsDialog{
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ public class MindustrySettingsDialog extends SettingsDialog{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("Back", "icon-arrow-left", Unit.dp.scl(30f), ()->{
|
buttons().addImageTextButton("Back", "icon-arrow-left", 30f, ()->{
|
||||||
hide();
|
hide();
|
||||||
}).size(230f, 64f);
|
}).size(230f, 64f);
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import io.anuke.ucore.scene.event.Touchable;
|
|||||||
import io.anuke.ucore.scene.ui.*;
|
import io.anuke.ucore.scene.ui.*;
|
||||||
import io.anuke.ucore.scene.ui.layout.Stack;
|
import io.anuke.ucore.scene.ui.layout.Stack;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class BlocksFragment implements Fragment{
|
public class BlocksFragment implements Fragment{
|
||||||
@@ -143,7 +142,7 @@ public class BlocksFragment implements Fragment{
|
|||||||
|
|
||||||
desctable.defaults().left();
|
desctable.defaults().left();
|
||||||
desctable.left();
|
desctable.left();
|
||||||
desctable.pad(Unit.dp.scl(12));
|
desctable.pad(12);
|
||||||
|
|
||||||
Table header = new Table();
|
Table header = new Table();
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import io.anuke.ucore.scene.ui.Image;
|
|||||||
import io.anuke.ucore.scene.ui.Label;
|
import io.anuke.ucore.scene.ui.Label;
|
||||||
import io.anuke.ucore.scene.ui.layout.Cell;
|
import io.anuke.ucore.scene.ui.layout.Cell;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class HudFragment implements Fragment{
|
public class HudFragment implements Fragment{
|
||||||
private Table itemtable, respawntable;
|
private Table itemtable, respawntable;
|
||||||
@@ -38,7 +37,7 @@ public class HudFragment implements Fragment{
|
|||||||
new table(){{
|
new table(){{
|
||||||
left();
|
left();
|
||||||
defaults().size(68).left();
|
defaults().size(68).left();
|
||||||
float isize = Unit.dp.scl(40);
|
float isize = 40;
|
||||||
|
|
||||||
new imagebutton("icon-menu", isize, ()->{
|
new imagebutton("icon-menu", isize, ()->{
|
||||||
ui.showMenu();
|
ui.showMenu();
|
||||||
@@ -92,7 +91,7 @@ public class HudFragment implements Fragment{
|
|||||||
atop();
|
atop();
|
||||||
|
|
||||||
new table("pane"){{
|
new table("pane"){{
|
||||||
new label("[orange]< paused >").scale(Unit.dp.scl(0.75f)).pad(6);
|
new label("[orange]< paused >").scale(0.75f).pad(6);
|
||||||
}}.end();
|
}}.end();
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
@@ -181,7 +180,7 @@ public class HudFragment implements Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void playButton(float uheight){
|
private void playButton(float uheight){
|
||||||
new imagebutton("icon-play", Unit.dp.scl(30f), ()->{
|
new imagebutton("icon-play", 30f, ()->{
|
||||||
Vars.control.runWave();
|
Vars.control.runWave();
|
||||||
}).height(uheight).fillX().right().padTop(-8f).padBottom(-12f).padRight(-36)
|
}).height(uheight).fillX().right().padTop(-8f).padBottom(-12f).padRight(-36)
|
||||||
.padLeft(-10f).width(40f).update(l->{
|
.padLeft(-10f).width(40f).update(l->{
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import io.anuke.mindustry.ui.MenuButton;
|
|||||||
import io.anuke.mindustry.ui.PressGroup;
|
import io.anuke.mindustry.ui.PressGroup;
|
||||||
import io.anuke.ucore.scene.builders.imagebutton;
|
import io.anuke.ucore.scene.builders.imagebutton;
|
||||||
import io.anuke.ucore.scene.builders.table;
|
import io.anuke.ucore.scene.builders.table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class MenuFragment implements Fragment{
|
public class MenuFragment implements Fragment{
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ public class MenuFragment implements Fragment{
|
|||||||
if(!gwt){
|
if(!gwt){
|
||||||
add(new MenuButton("text-exit", group, Gdx.app::exit));
|
add(new MenuButton("text-exit", group, Gdx.app::exit));
|
||||||
}
|
}
|
||||||
get().pad(Unit.dp.scl(16));
|
get().pad(16);
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
visible(()->GameState.is(State.menu));
|
visible(()->GameState.is(State.menu));
|
||||||
@@ -55,7 +54,7 @@ public class MenuFragment implements Fragment{
|
|||||||
new table(){{
|
new table(){{
|
||||||
new table(){{
|
new table(){{
|
||||||
defaults().size(120f).pad(5);
|
defaults().size(120f).pad(5);
|
||||||
float isize = Unit.dp.scl(14f*4);
|
float isize = 14f*4;
|
||||||
|
|
||||||
new imagebutton("icon-play-2", isize, () -> ui.showLevels()).text("Play").padTop(4f);
|
new imagebutton("icon-play-2", isize, () -> ui.showLevels()).text("Play").padTop(4f);
|
||||||
|
|
||||||
@@ -84,11 +83,11 @@ public class MenuFragment implements Fragment{
|
|||||||
new table(){{
|
new table(){{
|
||||||
atop().aright();
|
atop().aright();
|
||||||
if(Mindustry.hasDiscord){
|
if(Mindustry.hasDiscord){
|
||||||
new imagebutton("icon-discord", Unit.dp.scl(30f), ()->{
|
new imagebutton("icon-discord", 30f, ()->{
|
||||||
ui.showDiscord();
|
ui.showDiscord();
|
||||||
}).margin(14);
|
}).margin(14);
|
||||||
}
|
}
|
||||||
new imagebutton("icon-info", Unit.dp.scl(30f), ()->{
|
new imagebutton("icon-info", 30f, ()->{
|
||||||
ui.showAbout();
|
ui.showAbout();
|
||||||
}).margin(14);
|
}).margin(14);
|
||||||
}}.end().visible(()->GameState.is(State.menu));
|
}}.end().visible(()->GameState.is(State.menu));
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import io.anuke.ucore.scene.builders.*;
|
|||||||
import io.anuke.ucore.scene.event.Touchable;
|
import io.anuke.ucore.scene.event.Touchable;
|
||||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||||
import io.anuke.ucore.scene.ui.ImageButton;
|
import io.anuke.ucore.scene.ui.ImageButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class PlacementFragment implements Fragment{
|
public class PlacementFragment implements Fragment{
|
||||||
@@ -57,7 +56,7 @@ public class PlacementFragment implements Fragment{
|
|||||||
|
|
||||||
defaults().padBottom(-5.5f);
|
defaults().padBottom(-5.5f);
|
||||||
|
|
||||||
new imagebutton("icon-" + mode.name(), "toggle", Unit.dp.scl(10*3), ()->{
|
new imagebutton("icon-" + mode.name(), "toggle", 10*3, ()->{
|
||||||
control.getInput().resetCursor();
|
control.getInput().resetCursor();
|
||||||
player.placeMode = mode;
|
player.placeMode = mode;
|
||||||
}).group(group);
|
}).group(group);
|
||||||
@@ -67,14 +66,14 @@ public class PlacementFragment implements Fragment{
|
|||||||
|
|
||||||
Color color = Color.GRAY;//Colors.get("accent"); //Color.valueOf("4d4d4d")
|
Color color = Color.GRAY;//Colors.get("accent"); //Color.valueOf("4d4d4d")
|
||||||
|
|
||||||
new imagebutton("icon-cancel", Unit.dp.scl(14*3), ()->{
|
new imagebutton("icon-cancel", 14*3, ()->{
|
||||||
player.recipe = null;
|
player.recipe = null;
|
||||||
}).imageColor(color)
|
}).imageColor(color)
|
||||||
.visible(()->player.recipe != null);
|
.visible(()->player.recipe != null);
|
||||||
|
|
||||||
new button("", ()->{}).get().setTouchable(Touchable.disabled);;
|
new button("", ()->{}).get().setTouchable(Touchable.disabled);;
|
||||||
|
|
||||||
new imagebutton("icon-arrow", Unit.dp.scl(14*3), ()->{
|
new imagebutton("icon-arrow", 14*3, ()->{
|
||||||
player.rotation = Mathf.mod(player.rotation + 1, 4);
|
player.rotation = Mathf.mod(player.rotation + 1, 4);
|
||||||
}).imageColor(color).visible(() -> player.recipe != null).update(image ->{
|
}).imageColor(color).visible(() -> player.recipe != null).update(image ->{
|
||||||
image.getImage().setRotation(player.rotation*90);
|
image.getImage().setRotation(player.rotation*90);
|
||||||
@@ -108,7 +107,7 @@ public class PlacementFragment implements Fragment{
|
|||||||
|
|
||||||
defaults().padBottom(d < 2 ? -5.5f : 0);
|
defaults().padBottom(d < 2 ? -5.5f : 0);
|
||||||
|
|
||||||
new imagebutton("icon-" + mode.name(), "toggle", Unit.dp.scl(10*3), ()->{
|
new imagebutton("icon-" + mode.name(), "toggle", 10*3, ()->{
|
||||||
control.getInput().resetCursor();
|
control.getInput().resetCursor();
|
||||||
player.breakMode = mode;
|
player.breakMode = mode;
|
||||||
}){{
|
}){{
|
||||||
|
|||||||
@@ -10,23 +10,25 @@ import io.anuke.mindustry.core.GameState.State;
|
|||||||
import io.anuke.mindustry.input.PlaceMode;
|
import io.anuke.mindustry.input.PlaceMode;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class ToolFragment implements Fragment{
|
public class ToolFragment implements Fragment{
|
||||||
private Table tools;
|
private Table tools;
|
||||||
|
|
||||||
public void build(){
|
public void build(){
|
||||||
|
float isize = 14*3;
|
||||||
|
|
||||||
tools = new Table();
|
tools = new Table();
|
||||||
tools.addIButton("icon-cancel", Unit.dp.scl(42), ()->{
|
|
||||||
|
tools.addIButton("icon-cancel", isize, ()->{
|
||||||
player.recipe = null;
|
player.recipe = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
tools.addIButton("icon-rotate", Unit.dp.scl(42), ()->{
|
tools.addIButton("icon-rotate", isize, ()->{
|
||||||
player.rotation ++;
|
player.rotation ++;
|
||||||
player.rotation %= 4;
|
player.rotation %= 4;
|
||||||
});
|
});
|
||||||
|
|
||||||
tools.addIButton("icon-check", Unit.dp.scl(42), ()->{
|
tools.addIButton("icon-check", isize, ()->{
|
||||||
player.placeMode.tapped(control.getInput().getBlockX(), control.getInput().getBlockY());
|
player.placeMode.tapped(control.getInput().getBlockX(), control.getInput().getBlockY());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import io.anuke.mindustry.world.blocks.types.Configurable;
|
|||||||
import io.anuke.ucore.core.Draw;
|
import io.anuke.ucore.core.Draw;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Tmp;
|
import io.anuke.ucore.util.Tmp;
|
||||||
|
|
||||||
@@ -93,7 +92,7 @@ public class Sorter extends Junction implements Configurable{
|
|||||||
public void buildTable(Tile tile, Table table){
|
public void buildTable(Tile tile, Table table){
|
||||||
SorterEntity entity = tile.entity();
|
SorterEntity entity = tile.entity();
|
||||||
|
|
||||||
table.addIButton("icon-arrow-left", Unit.dp.scl(10*3), ()->{
|
table.addIButton("icon-arrow-left", 10*3, ()->{
|
||||||
int color = entity.sortItem.ordinal();
|
int color = entity.sortItem.ordinal();
|
||||||
|
|
||||||
color --;
|
color --;
|
||||||
@@ -105,7 +104,7 @@ public class Sorter extends Junction implements Configurable{
|
|||||||
|
|
||||||
table.add().size(40f);
|
table.add().size(40f);
|
||||||
|
|
||||||
table.addIButton("icon-arrow-right", Unit.dp.scl(10*3), ()->{
|
table.addIButton("icon-arrow-right", 10*3, ()->{
|
||||||
int color = entity.sortItem.ordinal();
|
int color = entity.sortItem.ordinal();
|
||||||
|
|
||||||
color ++;
|
color ++;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import io.anuke.mindustry.world.blocks.types.Configurable;
|
|||||||
import io.anuke.ucore.core.Draw;
|
import io.anuke.ucore.core.Draw;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class Teleporter extends Block implements Configurable{
|
public class Teleporter extends Block implements Configurable{
|
||||||
@@ -69,13 +68,13 @@ public class Teleporter extends Block implements Configurable{
|
|||||||
public void buildTable(Tile tile, Table table){
|
public void buildTable(Tile tile, Table table){
|
||||||
TeleporterEntity entity = tile.entity();
|
TeleporterEntity entity = tile.entity();
|
||||||
|
|
||||||
table.addIButton("icon-arrow-left", Unit.dp.scl(10*3), ()->{
|
table.addIButton("icon-arrow-left", 10*3, ()->{
|
||||||
entity.color = (byte)Mathf.mod(entity.color - 1, colors);
|
entity.color = (byte)Mathf.mod(entity.color - 1, colors);
|
||||||
});
|
});
|
||||||
|
|
||||||
table.add().size(40f);
|
table.add().size(40f);
|
||||||
|
|
||||||
table.addIButton("icon-arrow-right", Unit.dp.scl(10*3), ()->{
|
table.addIButton("icon-arrow-right", 10*3, ()->{
|
||||||
entity.color = (byte)Mathf.mod(entity.color + 1, colors);
|
entity.color = (byte)Mathf.mod(entity.color + 1, colors);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package io.anuke.mindustry.desktop;
|
package io.anuke.mindustry.desktop;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||||
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
@@ -7,18 +11,18 @@ import java.text.NumberFormat;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
|
||||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
|
||||||
|
|
||||||
import io.anuke.mindustry.Mindustry;
|
import io.anuke.mindustry.Mindustry;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.io.PlatformFunction;
|
import io.anuke.mindustry.io.PlatformFunction;
|
||||||
import io.anuke.ucore.scene.ui.TextField;
|
import io.anuke.ucore.scene.ui.TextField;
|
||||||
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
|
|
||||||
public class DesktopLauncher {
|
public class DesktopLauncher {
|
||||||
|
|
||||||
public static void main (String[] arg) {
|
public static void main (String[] arg) {
|
||||||
|
|
||||||
|
Unit.dp.addition = 2f;
|
||||||
|
|
||||||
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
||||||
config.setTitle("Mindustry");
|
config.setTitle("Mindustry");
|
||||||
config.setMaximized(true);
|
config.setMaximized(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user