Death to unit.dp
This commit is contained in:
@@ -14,7 +14,7 @@ dependencies {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
buildToolsVersion '26.0.2'
|
buildToolsVersion '26.0.2'
|
||||||
compileSdkVersion 25
|
compileSdkVersion 26
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
manifest.srcFile 'AndroidManifest.xml'
|
manifest.srcFile 'AndroidManifest.xml'
|
||||||
@@ -34,7 +34,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "io.anuke.mindustry"
|
applicationId "io.anuke.mindustry"
|
||||||
minSdkVersion 9
|
minSdkVersion 9
|
||||||
targetSdkVersion 25
|
targetSdkVersion 26
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<string name="app_name">Mindustry</string>
|
<string name="app_name">Mindustry</string>
|
||||||
<string-array name="donation_google_catalog_values">
|
<string-array name="donation_google_catalog_values">
|
||||||
<item>1 Dollar</item>
|
<item>1 Dollar</item>
|
||||||
|
<item>2 Dollars</item>
|
||||||
<item>5 Dollars</item>
|
<item>5 Dollars</item>
|
||||||
<item>10 Dollars</item>
|
<item>10 Dollars</item>
|
||||||
<item>15 Dollars</item>
|
<item>15 Dollars</item>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="GdxTheme" parent="android:Theme.Holo">
|
<style name="GdxTheme" parent="android:Theme">
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||||
<item name="android:windowAnimationStyle">@android:style/Animation</item>
|
<item name="android:windowAnimationStyle">@android:style/Animation</item>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class DonationsActivity extends FragmentActivity {
|
|||||||
*/
|
*/
|
||||||
private static final String GOOGLE_PUBKEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzG93KhpfBPKTo2jF0yxbWkkmMKwsPNM4SsMj1aDq7vv6n3R+mqJVfprOJxFfJh7JchXTflLIgiaKXFAiU70gJbMTniEWnEaFSxAeF09a7U0RjOwN+7rFwjCG91c2CpYxPanBTQP4zasc1ODPVzq4q6/4ByjhenN71V4WmR08NFIAodcfFPrOkDPil7i8y7cgcd1Ky53U0TS+LLYJttAK3XdTK4s7VE3I5IKoeNa4uwCmIM59R67q2k3cXjLk/nP6MP+y++EzHN/PTiR1sVg4dMP8K31RPw/1QNLPQwJz6Wc872oWwb7xo5gkoXbDc5WPPydsi8F3SyKNaYwzN6CDFQIDAQAB";
|
private static final String GOOGLE_PUBKEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzG93KhpfBPKTo2jF0yxbWkkmMKwsPNM4SsMj1aDq7vv6n3R+mqJVfprOJxFfJh7JchXTflLIgiaKXFAiU70gJbMTniEWnEaFSxAeF09a7U0RjOwN+7rFwjCG91c2CpYxPanBTQP4zasc1ODPVzq4q6/4ByjhenN71V4WmR08NFIAodcfFPrOkDPil7i8y7cgcd1Ky53U0TS+LLYJttAK3XdTK4s7VE3I5IKoeNa4uwCmIM59R67q2k3cXjLk/nP6MP+y++EzHN/PTiR1sVg4dMP8K31RPw/1QNLPQwJz6Wc872oWwb7xo5gkoXbDc5WPPydsi8F3SyKNaYwzN6CDFQIDAQAB";
|
||||||
private static final String[] GOOGLE_CATALOG = new String[]{
|
private static final String[] GOOGLE_CATALOG = new String[]{
|
||||||
"mindustry.donation.1", "mindustry.donation.5",
|
"mindustry.donation.1", "mindustry.donation.2", "mindustry.donation.5",
|
||||||
"mindustry.donation.10", "mindustry.donation.15",
|
"mindustry.donation.10", "mindustry.donation.15",
|
||||||
"mindustry.donation.25", "mindustry.donation.50" };
|
"mindustry.donation.25", "mindustry.donation.50" };
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
google()
|
||||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
@@ -79,7 +80,7 @@ project(":core") {
|
|||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.github.anuken:ucore:a525ad2043'
|
compile 'com.github.anuken:ucore:4cb594bc68'
|
||||||
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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ public class Vars{
|
|||||||
//save file directory
|
//save file directory
|
||||||
public static final FileHandle saveDirectory = Gdx.files.local("mindustry-saves/");
|
public static final FileHandle saveDirectory = Gdx.files.local("mindustry-saves/");
|
||||||
//scale of the font
|
//scale of the font
|
||||||
public static float fontscale = Math.max(Unit.dp.inPixels(1f)/2f, 0.5f);
|
public static float fontscale = Math.max(Unit.dp.scl(1f)/2f, 0.5f);
|
||||||
//camera zoom displayed on startup
|
//camera zoom displayed on startup
|
||||||
public static final int baseCameraScale = Math.round(Unit.dp.inPixels(4));
|
public static final int baseCameraScale = Math.round(Unit.dp.scl(4));
|
||||||
//how much the zoom changes every zoom button press
|
//how much the zoom changes every zoom button press
|
||||||
public static final int zoomScale = Math.round(Unit.dp.inPixels(1));
|
public static final int zoomScale = Math.round(Unit.dp.scl(1));
|
||||||
//if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available
|
//if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available
|
||||||
public static boolean debug = false;
|
public static boolean debug = false;
|
||||||
//whether the player can clip through walls
|
//whether the player can clip through walls
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import io.anuke.mindustry.core.GameState.State;
|
|||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.effect.Shaders;
|
import io.anuke.mindustry.entities.effect.Shaders;
|
||||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||||
|
import io.anuke.mindustry.input.PlaceMode;
|
||||||
import io.anuke.mindustry.world.Layer;
|
import io.anuke.mindustry.world.Layer;
|
||||||
import io.anuke.mindustry.world.SpawnPoint;
|
import io.anuke.mindustry.world.SpawnPoint;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
@@ -257,7 +258,7 @@ public class Renderer extends RendererModule{
|
|||||||
}
|
}
|
||||||
|
|
||||||
float angle = Angles.angle(camera.position.x, camera.position.y, enemy.x, enemy.y);
|
float angle = Angles.angle(camera.position.x, camera.position.y, enemy.x, enemy.y);
|
||||||
Angles.translation(angle, Unit.dp.inPixels(20f));
|
Angles.translation(angle, Unit.dp.scl(20f));
|
||||||
Draw.rect("enemyarrow", camera.position.x + Angles.x(), camera.position.y + Angles.y(), angle);
|
Draw.rect("enemyarrow", camera.position.x + Angles.x(), camera.position.y + Angles.y(), angle);
|
||||||
}
|
}
|
||||||
Draw.color();
|
Draw.color();
|
||||||
@@ -546,6 +547,9 @@ public class Renderer extends RendererModule{
|
|||||||
Draw.dashCircle(spawn.start.worldx(), spawn.start.worldy(), enemyspawnspace);
|
Draw.dashCircle(spawn.start.worldx(), spawn.start.worldy(), enemyspawnspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(player.breakMode == PlaceMode.holdDelete)
|
||||||
|
player.breakMode.draw(tilex, tiley, 0, 0);
|
||||||
|
|
||||||
}else if(player.breakMode.delete && control.input.drawPlace() && player.recipe == null){ //TODO test!
|
}else if(player.breakMode.delete && control.input.drawPlace() && player.recipe == null){ //TODO test!
|
||||||
player.breakMode.draw(control.input.getBlockX(), control.input.getBlockY(),
|
player.breakMode.draw(control.input.getBlockX(), control.input.getBlockY(),
|
||||||
control.input.getBlockEndX(), control.input.getBlockEndY());
|
control.input.getBlockEndX(), control.input.getBlockEndY());
|
||||||
@@ -632,7 +636,7 @@ public class Renderer extends RendererModule{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clampScale(){
|
public void clampScale(){
|
||||||
targetscale = Mathf.clamp(targetscale, Math.round(Unit.dp.inPixels(2)), Math.round(Unit.dp.inPixels((5))));
|
targetscale = Mathf.clamp(targetscale, Math.round(Unit.dp.scl(2)), Math.round(Unit.dp.scl((5))));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class Tutorial{
|
|||||||
atop();
|
atop();
|
||||||
margin(12);
|
margin(12);
|
||||||
|
|
||||||
info = new label(()->stage.text).pad(10f).padBottom(5f).width(340f).units(Unit.dp).colspan(2).get();
|
info = new label(()->stage.text).pad(10f).padBottom(5f).width(340f).colspan(2).get();
|
||||||
info.setWrap(true);
|
info.setWrap(true);
|
||||||
|
|
||||||
row();
|
row();
|
||||||
@@ -62,8 +62,8 @@ public class Tutorial{
|
|||||||
|
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
prev.pad(Unit.dp.inPixels(16));
|
prev.pad(Unit.dp.scl(16));
|
||||||
next.pad(Unit.dp.inPixels(16));
|
next.pad(Unit.dp.scl(16));
|
||||||
|
|
||||||
prev.setDisabled(()->!canMove(false) || !stage.canBack);
|
prev.setDisabled(()->!canMove(false) || !stage.canBack);
|
||||||
next.setDisabled(()->!stage.canForward);
|
next.setDisabled(()->!stage.canForward);
|
||||||
|
|||||||
@@ -123,13 +123,13 @@ public class UI extends SceneModule{
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
TextureRegion back = Draw.region("background");
|
TextureRegion back = Draw.region("background");
|
||||||
float backscl = Unit.dp.inPixels(5f);
|
float backscl = Unit.dp.scl(5f);
|
||||||
|
|
||||||
Draw.alpha(0.7f);
|
Draw.alpha(0.7f);
|
||||||
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2 +240f, h/2 - back.getRegionHeight()*backscl/2 + 250f,
|
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2 +240f, h/2 - back.getRegionHeight()*backscl/2 + 250f,
|
||||||
back.getRegionWidth()*backscl, back.getRegionHeight()*backscl);
|
back.getRegionWidth()*backscl, back.getRegionHeight()*backscl);
|
||||||
|
|
||||||
float logoscl = (int)Unit.dp.inPixels(7);
|
float logoscl = (int)Unit.dp.scl(7);
|
||||||
TextureRegion logo = skin.getRegion("logotext");
|
TextureRegion logo = skin.getRegion("logotext");
|
||||||
float logow = logo.getRegionWidth()*logoscl;
|
float logow = logo.getRegionWidth()*logoscl;
|
||||||
float logoh = logo.getRegionHeight()*logoscl;
|
float logoh = logo.getRegionHeight()*logoscl;
|
||||||
@@ -177,14 +177,14 @@ public class UI extends SceneModule{
|
|||||||
+ "[]Please report the exact circumstances under which this error occured to the developer: "
|
+ "[]Please report the exact circumstances under which this error occured to the developer: "
|
||||||
+ "\n[ORANGE]anukendev@gmail.com[]"){{
|
+ "\n[ORANGE]anukendev@gmail.com[]"){{
|
||||||
setWrap(true);
|
setWrap(true);
|
||||||
}}).width(600f).units(Unit.dp).pad(10f);
|
}}).width(600f).pad(10f);
|
||||||
gameerror.buttons().addButton("OK", gameerror::hide).size(200f, 50).units(Unit.dp);
|
gameerror.buttons().addButton("OK", gameerror::hide).size(200f, 50);
|
||||||
//gameerror.setFillParent(true);
|
//gameerror.setFillParent(true);
|
||||||
|
|
||||||
discord = new Dialog("Discord", "dialog");
|
discord = new Dialog("Discord", "dialog");
|
||||||
discord.content().pad(Unit.dp.inPixels(12f));
|
discord.content().pad(Unit.dp.scl(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).units(Unit.dp);
|
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));
|
||||||
discord.buttons().addButton("Back", discord::hide);
|
discord.buttons().addButton("Back", discord::hide);
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ public class UI extends SceneModule{
|
|||||||
prefs.content().row();
|
prefs.content().row();
|
||||||
prefs.content().addButton("Controls", () -> {
|
prefs.content().addButton("Controls", () -> {
|
||||||
keys.show(scene);
|
keys.show(scene);
|
||||||
}).size(300f, 50f).pad(5f).units(Unit.dp);
|
}).size(300f, 50f).pad(5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
keys = new MindustryKeybindDialog();
|
keys = new MindustryKeybindDialog();
|
||||||
@@ -275,7 +275,7 @@ public class UI extends SceneModule{
|
|||||||
restart.content().add("[YELLOW]New highscore!").pad(6);
|
restart.content().add("[YELLOW]New highscore!").pad(6);
|
||||||
restart.content().row();
|
restart.content().row();
|
||||||
}
|
}
|
||||||
restart.content().add("You lasted until wave [GREEN]" + control.getWave() + "[].").pad(12).units(Unit.dp).get();
|
restart.content().add("You lasted until wave [GREEN]" + control.getWave() + "[].").pad(12).get();
|
||||||
restart.pack();
|
restart.pack();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ public class UI extends SceneModule{
|
|||||||
restart.hide();
|
restart.hide();
|
||||||
GameState.set(State.menu);
|
GameState.set(State.menu);
|
||||||
control.reset();
|
control.reset();
|
||||||
}).size(200, 50).pad(3).units(Unit.dp);
|
}).size(200, 50).pad(3);
|
||||||
|
|
||||||
build.begin(scene);
|
build.begin(scene);
|
||||||
|
|
||||||
@@ -300,14 +300,14 @@ public class UI extends SceneModule{
|
|||||||
loadingtable = new table("loadDim"){{
|
loadingtable = new table("loadDim"){{
|
||||||
get().setTouchable(Touchable.enabled);
|
get().setTouchable(Touchable.enabled);
|
||||||
get().addImage("white").growX()
|
get().addImage("white").growX()
|
||||||
.height(3f).pad(4f).growX().units(Unit.dp).get().setColor(Colors.get("accent"));
|
.height(3f).pad(4f).growX().get().setColor(Colors.get("accent"));
|
||||||
row();
|
row();
|
||||||
new label("[accent]Loading..."){{
|
new label("[accent]Loading..."){{
|
||||||
get().setName("namelabel");
|
get().setName("namelabel");
|
||||||
}}.pad(10).units(Unit.dp);
|
}}.pad(10);
|
||||||
row();
|
row();
|
||||||
get().addImage("white").growX()
|
get().addImage("white").growX()
|
||||||
.height(3f).pad(4f).growX().units(Unit.dp).get().setColor(Colors.get("accent"));
|
.height(3f).pad(4f).growX().get().setColor(Colors.get("accent"));
|
||||||
}}.end().get();
|
}}.end().get();
|
||||||
|
|
||||||
loadingtable.setVisible(false);
|
loadingtable.setVisible(false);
|
||||||
@@ -367,11 +367,11 @@ 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.inPixels(15));
|
content().pad(Unit.dp.scl(15));
|
||||||
content().add(text);
|
content().add(text);
|
||||||
getButtonTable().addButton("OK", ()->{
|
getButtonTable().addButton("OK", ()->{
|
||||||
hide();
|
hide();
|
||||||
}).size(90, 50).pad(4).units(Unit.dp);
|
}).size(90, 50).pad(4);
|
||||||
}}.show();
|
}}.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,8 +472,8 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
public void showConfirm(String title, String text, Listenable confirmed){
|
public void showConfirm(String title, String text, Listenable confirmed){
|
||||||
FloatingDialog dialog = new FloatingDialog(title);
|
FloatingDialog dialog = new FloatingDialog(title);
|
||||||
dialog.content().add(text).pad(4f).units(Unit.dp);
|
dialog.content().add(text).pad(4f);
|
||||||
dialog.buttons().defaults().size(200f, 54f).pad(2f).units(Unit.dp);
|
dialog.buttons().defaults().size(200f, 54f).pad(2f);
|
||||||
dialog.buttons().addButton("Cancel", dialog::hide);
|
dialog.buttons().addButton("Cancel", dialog::hide);
|
||||||
dialog.buttons().addButton("OK", () -> {
|
dialog.buttons().addButton("OK", () -> {
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public class AndroidInput extends InputHandler{
|
|||||||
public void update(){
|
public void update(){
|
||||||
enableHold = player.breakMode == PlaceMode.holdDelete;
|
enableHold = player.breakMode == PlaceMode.holdDelete;
|
||||||
|
|
||||||
if(enableHold && player.recipe != null && Gdx.input.isTouched(0) && Mathf.near2d(lmousex, lmousey, Gdx.input.getX(0), Gdx.input.getY(0), Unit.dp.inPixels(50))
|
if(enableHold && Gdx.input.isTouched(0) && Mathf.near2d(lmousex, lmousey, Gdx.input.getX(0), Gdx.input.getY(0), Unit.dp.scl(50))
|
||||||
&& !ui.hasMouse()){
|
&& !ui.hasMouse()){
|
||||||
warmup += Timers.delta();
|
warmup += Timers.delta();
|
||||||
|
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ public class GestureHandler extends GestureAdapter{
|
|||||||
initzoom = initialDistance;
|
initzoom = initialDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Math.abs(distance - initzoom) > Unit.dp.inPixels(100f) && !zoomed){
|
if(Math.abs(distance - initzoom) > Unit.dp.scl(100f) && !zoomed){
|
||||||
int amount = (distance > initzoom ? 1 : -1);
|
int amount = (distance > initzoom ? 1 : -1);
|
||||||
renderer.scaleCamera(Math.round(Unit.dp.inPixels(amount)));
|
renderer.scaleCamera(Math.round(Unit.dp.scl(amount)));
|
||||||
initzoom = distance;
|
initzoom = distance;
|
||||||
zoomed = true;
|
zoomed = true;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class MapEditor{
|
|||||||
public static final int[] validMapSizes = {128, 256, 512};
|
public static final int[] validMapSizes = {128, 256, 512};
|
||||||
public static final int[] brushSizes = {1, 2, 3, 4, 5, 9, 15};
|
public static final int[] brushSizes = {1, 2, 3, 4, 5, 9, 15};
|
||||||
public static final int maxSpawnpoints = 15;
|
public static final int maxSpawnpoints = 15;
|
||||||
|
public static final Format format = Format.RGBA8888;
|
||||||
|
|
||||||
private Pixmap[] brushPixmaps = new Pixmap[brushSizes.length];
|
private Pixmap[] brushPixmaps = new Pixmap[brushSizes.length];
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ public class MapEditor{
|
|||||||
public MapEditor(){
|
public MapEditor(){
|
||||||
for(int i = 0; i < brushSizes.length; i ++){
|
for(int i = 0; i < brushSizes.length; i ++){
|
||||||
int s = brushSizes[i];
|
int s = brushSizes[i];
|
||||||
brushPixmaps[i] = new Pixmap(s*2-1, s*2-1, Format.RGB888);
|
brushPixmaps[i] = new Pixmap(s*2-1, s*2-1, format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ public class MapEditor{
|
|||||||
this.map = map;
|
this.map = map;
|
||||||
this.brushSize = 1;
|
this.brushSize = 1;
|
||||||
if(map.pixmap == null){
|
if(map.pixmap == null){
|
||||||
pixmap = new Pixmap(256, 256, Format.RGB888);
|
pixmap = new Pixmap(256, 256, format);
|
||||||
pixmap.setColor(ColorMapper.getColor(drawBlock));
|
pixmap.setColor(ColorMapper.getColor(drawBlock));
|
||||||
pixmap.fill();
|
pixmap.fill();
|
||||||
texture = new Texture(pixmap);
|
texture = new Texture(pixmap);
|
||||||
|
|||||||
@@ -152,16 +152,16 @@ public class MapEditorDialog extends Dialog{
|
|||||||
public void build(){
|
public void build(){
|
||||||
|
|
||||||
new table(){{
|
new table(){{
|
||||||
float isize = Unit.dp.inPixels(16*2f);
|
float isize = Unit.dp.scl(16*2f);
|
||||||
aleft();
|
aleft();
|
||||||
|
|
||||||
new table(){{
|
new table(){{
|
||||||
|
|
||||||
defaults().growY().width(130f).units(Unit.dp).padBottom(-6);
|
defaults().growY().width(130f).padBottom(-6);
|
||||||
|
|
||||||
new imagebutton("icon-terrain", isize, () -> {
|
new imagebutton("icon-terrain", isize, () -> {
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}).text("generate").units(Unit.dp);
|
}).text("generate");
|
||||||
|
|
||||||
row();
|
row();
|
||||||
|
|
||||||
@@ -220,14 +220,14 @@ 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.inPixels(16*2f));
|
button.resizeImage(Unit.dp.scl(16*2f));
|
||||||
group.add(button);
|
group.add(button);
|
||||||
|
|
||||||
tools.add(button).size(80f, 85f).padBottom(-6f).units(Unit.dp);
|
tools.add(button).size(80f, 85f).padBottom(-6f);
|
||||||
if(i++ % 2 == 1) tools.row();
|
if(i++ % 2 == 1) tools.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
add(tools).units(Unit.dp).width(160f).padBottom(-6);
|
add(tools).width(160f).padBottom(-6);
|
||||||
|
|
||||||
row();
|
row();
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
});
|
});
|
||||||
new label(() -> "Brush size: " + MapEditor.brushSizes[(int)slider.getValue()]).left();
|
new label(() -> "Brush size: " + MapEditor.brushSizes[(int)slider.getValue()]).left();
|
||||||
row();
|
row();
|
||||||
add(slider).growX().padTop(4f).units(Unit.dp);
|
add(slider).growX().padTop(4f);
|
||||||
}}.growX().end();
|
}}.growX().end();
|
||||||
|
|
||||||
row();
|
row();
|
||||||
@@ -312,16 +312,16 @@ 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.inPixels(8*4f));
|
button.resizeImage(Unit.dp.scl(8*4f));
|
||||||
group.add(button);
|
group.add(button);
|
||||||
content.add(button).pad(4f).size(53f, 58f).units(Unit.dp);
|
content.add(button).pad(4f).size(53f, 58f);
|
||||||
|
|
||||||
if(i++ % 2 == 1){
|
if(i++ % 2 == 1){
|
||||||
content.row();
|
content.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content.padLeft(Unit.dp.inPixels(-5f));
|
content.padLeft(Unit.dp.scl(-5f));
|
||||||
|
|
||||||
group.getButtons().get(2).setChecked(true);
|
group.getButtons().get(2).setChecked(true);
|
||||||
|
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ 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.inPixels(4f)).padRight(Unit.dp.inPixels(25f));
|
preft.pad(Unit.dp.scl(4f)).padRight(Unit.dp.scl(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);
|
||||||
box.setChecked(pref.enabled);
|
box.setChecked(pref.enabled);
|
||||||
box.changed(() -> pref.enabled = box.isChecked());
|
box.changed(() -> pref.enabled = box.isChecked());
|
||||||
preft.add(box).pad(4f).units(Unit.dp).left();
|
preft.add(box).pad(4f).left();
|
||||||
preft.row();
|
preft.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||||||
|
|
||||||
content().add(pane).fillY();
|
content().add(pane).fillY();
|
||||||
|
|
||||||
buttons().defaults().size(170f, 50f).units(Unit.dp).pad(4f);
|
buttons().defaults().size(170f, 50f).pad(4f);
|
||||||
buttons().addButton("Back", () -> hide());
|
buttons().addButton("Back", () -> hide());
|
||||||
buttons().addButton("Randomize", () ->{
|
buttons().addButton("Randomize", () ->{
|
||||||
editor.getFilter().randomize();
|
editor.getFilter().randomize();
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ public class MapLoadDialog extends FloatingDialog{
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.defaults().size(200f, 90f).units(Unit.dp).pad(4f);
|
table.defaults().size(200f, 90f).pad(4f);
|
||||||
table.pad(Unit.dp.inPixels(10f));
|
table.pad(Unit.dp.scl(10f));
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(table, "horizontal");
|
ScrollPane pane = new ScrollPane(table, "horizontal");
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
@@ -33,10 +33,10 @@ 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.inPixels(16*4f));
|
button.add(new BorderImage(map.texture, 2f)).size(Unit.dp.scl(16*4f));
|
||||||
button.getCells().reverse();
|
button.getCells().reverse();
|
||||||
button.clicked(() -> selected = map);
|
button.clicked(() -> selected = map);
|
||||||
button.getLabelCell().grow().left().padLeft(5f).units(Unit.dp);
|
button.getLabelCell().grow().left().padLeft(5f);
|
||||||
group.add(button);
|
group.add(button);
|
||||||
table.add(button);
|
table.add(button);
|
||||||
if(++i % maxcol == 0) table.row();
|
if(++i % maxcol == 0) table.row();
|
||||||
@@ -55,7 +55,7 @@ public class MapLoadDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttons().defaults().size(200f, 50f).units(Unit.dp);
|
buttons().defaults().size(200f, 50f);
|
||||||
buttons().addButton("Cancel", this::hide);
|
buttons().addButton("Cancel", this::hide);
|
||||||
buttons().add(button);
|
buttons().add(button);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import io.anuke.ucore.function.BiConsumer;
|
|||||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||||
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 MapResizeDialog extends FloatingDialog{
|
public class MapResizeDialog extends FloatingDialog{
|
||||||
int width, height;
|
int width, height;
|
||||||
@@ -43,7 +42,7 @@ public class MapResizeDialog extends FloatingDialog{
|
|||||||
});
|
});
|
||||||
group.add(button);
|
group.add(button);
|
||||||
if(i == idx) button.setChecked(true);
|
if(i == idx) button.setChecked(true);
|
||||||
table.add(button).size(100f, 54f).pad(2f).units(Unit.dp);
|
table.add(button).size(100f, 54f).pad(2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
table.row();
|
table.row();
|
||||||
@@ -57,7 +56,7 @@ public class MapResizeDialog extends FloatingDialog{
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
buttons().defaults().size(200f, 50f).units(Unit.dp);
|
buttons().defaults().size(200f, 50f);
|
||||||
buttons().addButton("Cancel", this::hide);
|
buttons().addButton("Cancel", this::hide);
|
||||||
buttons().addButton("Resize", () -> {
|
buttons().addButton("Resize", () -> {
|
||||||
cons.accept(width, height);
|
cons.accept(width, height);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import io.anuke.mindustry.world.Map;
|
|||||||
import io.anuke.ucore.function.Consumer;
|
import io.anuke.ucore.function.Consumer;
|
||||||
import io.anuke.ucore.scene.ui.TextButton;
|
import io.anuke.ucore.scene.ui.TextButton;
|
||||||
import io.anuke.ucore.scene.ui.TextField;
|
import io.anuke.ucore.scene.ui.TextField;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
public class MapSaveDialog extends FloatingDialog{
|
public class MapSaveDialog extends FloatingDialog{
|
||||||
private TextField field;
|
private TextField field;
|
||||||
@@ -33,7 +32,7 @@ public class MapSaveDialog extends FloatingDialog{
|
|||||||
content().add(field).size(220f, 48f);
|
content().add(field).size(220f, 48f);
|
||||||
});
|
});
|
||||||
|
|
||||||
buttons().defaults().size(200f, 50f).pad(2f).units(Unit.dp);
|
buttons().defaults().size(200f, 50f).pad(2f);
|
||||||
buttons().addButton("Cancel", this::hide);
|
buttons().addButton("Cancel", this::hide);
|
||||||
|
|
||||||
TextButton button = new TextButton("Save");
|
TextButton button = new TextButton("Save");
|
||||||
|
|||||||
@@ -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.inPixels(3f));
|
Draw.thick(Unit.dp.scl(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();
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
public boolean zoom(float initialDistance, float distance){
|
public boolean zoom(float initialDistance, float distance){
|
||||||
if(!active()) return false;
|
if(!active()) return false;
|
||||||
float nzoom = distance - initialDistance;
|
float nzoom = distance - initialDistance;
|
||||||
zoom += nzoom / 2000f / Unit.dp.inPixels(1f) * zoom;
|
zoom += nzoom / 2000f / Unit.dp.scl(1f) * zoom;
|
||||||
clampZoom();
|
clampZoom();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class BorderImage extends Image{
|
|||||||
float scaleY = getScaleY();
|
float scaleY = getScaleY();
|
||||||
|
|
||||||
Draw.color(Colors.get("accent"));
|
Draw.color(Colors.get("accent"));
|
||||||
Draw.thick(Unit.dp.inPixels(thickness));
|
Draw.thick(Unit.dp.scl(thickness));
|
||||||
Draw.linerect(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
|
Draw.linerect(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package io.anuke.mindustry.ui;
|
package io.anuke.mindustry.ui;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileFilter;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
@@ -22,7 +19,6 @@ import io.anuke.ucore.scene.ui.layout.Table;
|
|||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
|
|
||||||
public class FileChooser extends FloatingDialog{
|
public class FileChooser extends FloatingDialog{
|
||||||
|
|
||||||
private Table files;
|
private Table files;
|
||||||
private FileHandle homeDirectory = Gdx.files.absolute(Gdx.files.getExternalStoragePath());
|
private FileHandle homeDirectory = Gdx.files.absolute(Gdx.files.getExternalStoragePath());
|
||||||
private FileHandle directory = homeDirectory;
|
private FileHandle directory = homeDirectory;
|
||||||
@@ -48,7 +44,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
|
|
||||||
private void setupWidgets(){
|
private void setupWidgets(){
|
||||||
getCell(content()).maxWidth(Gdx.graphics.getWidth()/2);
|
getCell(content()).maxWidth(Gdx.graphics.getWidth()/2);
|
||||||
content().pad(-Unit.dp.inPixels(10));
|
content().pad(-Unit.dp.scl(10));
|
||||||
|
|
||||||
Table content = new Table();
|
Table content = new Table();
|
||||||
|
|
||||||
@@ -91,7 +87,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
|
|
||||||
Table icontable = new Table();
|
Table icontable = new Table();
|
||||||
|
|
||||||
float isize = Unit.dp.inPixels(14*2);
|
float isize = Unit.dp.scl(14*2);
|
||||||
|
|
||||||
ImageButton up = new ImageButton("icon-folder-parent");
|
ImageButton up = new ImageButton("icon-folder-parent");
|
||||||
up.resizeImage(isize);
|
up.resizeImage(isize);
|
||||||
@@ -162,20 +158,12 @@ public class FileChooser extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private FileHandle[] getFileNames(){
|
private FileHandle[] getFileNames(){
|
||||||
FileHandle[] handles = directory.list(new FileFilter(){
|
FileHandle[] handles = directory.list(file -> !file.getName().startsWith("."));
|
||||||
@Override
|
|
||||||
public boolean accept(File file){
|
|
||||||
return !file.getName().startsWith(".");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Arrays.sort(handles, new Comparator<FileHandle>(){
|
Arrays.sort(handles, (a, b) ->{
|
||||||
@Override
|
if(a.isDirectory() && !b.isDirectory()) return -1;
|
||||||
public int compare(FileHandle a, FileHandle b){
|
if( !a.isDirectory() && b.isDirectory()) return 1;
|
||||||
if(a.isDirectory() && !b.isDirectory()) return -1;
|
return a.name().compareTo(b.name());
|
||||||
if( !a.isDirectory() && b.isDirectory()) return 1;
|
|
||||||
return a.name().compareTo(b.name());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return handles;
|
return handles;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ public class FloatingDialog extends Dialog{
|
|||||||
title().setAlignment(Align.center);
|
title().setAlignment(Align.center);
|
||||||
getTitleTable().row();
|
getTitleTable().row();
|
||||||
getTitleTable().addImage("white", Colors.get("accent"))
|
getTitleTable().addImage("white", Colors.get("accent"))
|
||||||
.growX().height(3f).pad(4f).units(Unit.dp);
|
.growX().height(3f).pad(4f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("Back", "icon-arrow-left", Unit.dp.inPixels(30f), ()->{
|
buttons().addImageTextButton("Back", "icon-arrow-left", Unit.dp.scl(30f), ()->{
|
||||||
hide();
|
hide();
|
||||||
}).size(230f, 64f).units(Unit.dp);
|
}).size(230f, 64f);
|
||||||
|
|
||||||
keyDown(key->{
|
keyDown(key->{
|
||||||
if(key == Keys.ESCAPE || key == Keys.BACK)
|
if(key == Keys.ESCAPE || key == Keys.BACK)
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
|
|
||||||
Table selmode = new Table();
|
Table selmode = new Table();
|
||||||
ButtonGroup<TextButton> group = new ButtonGroup<>();
|
ButtonGroup<TextButton> group = new ButtonGroup<>();
|
||||||
selmode.add("Gamemode: ").padRight(10f).units(Unit.dp);
|
selmode.add("Gamemode: ").padRight(10f);
|
||||||
|
|
||||||
for(GameMode mode : GameMode.values()){
|
for(GameMode mode : GameMode.values()){
|
||||||
TextButton b = Elements.newButton(mode.toString(), "toggle", ()->{
|
TextButton b = Elements.newButton(mode.toString(), "toggle", ()->{
|
||||||
Vars.control.setMode(mode);
|
Vars.control.setMode(mode);
|
||||||
});
|
});
|
||||||
group.add(b);
|
group.add(b);
|
||||||
selmode.add(b).size(130f, 54f).units(Unit.dp);
|
selmode.add(b).size(130f, 54f);
|
||||||
}
|
}
|
||||||
|
|
||||||
content().add(selmode);
|
content().add(selmode);
|
||||||
@@ -64,10 +64,10 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Table inset = new Table("pane-button");
|
Table inset = new Table("pane-button");
|
||||||
inset.add("[accent]"+map.name).pad(3f).units(Unit.dp);
|
inset.add("[accent]"+map.name).pad(3f);
|
||||||
inset.row();
|
inset.row();
|
||||||
inset.label((() -> "High Score: [accent]" + Settings.getInt("hiscore" + map.name)))
|
inset.label((() -> "High Score: [accent]" + Settings.getInt("hiscore" + map.name)))
|
||||||
.pad(3f).units(Unit.dp);
|
.pad(3f);
|
||||||
inset.pack();
|
inset.pack();
|
||||||
|
|
||||||
float images = 154f;
|
float images = 154f;
|
||||||
@@ -79,7 +79,7 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
|
|
||||||
ImageButton image = new ImageButton(new TextureRegion(map.texture), "togglemap");
|
ImageButton image = new ImageButton(new TextureRegion(map.texture), "togglemap");
|
||||||
image.row();
|
image.row();
|
||||||
image.add(inset).width(images+6).units(Unit.dp);
|
image.add(inset).width(images+6);
|
||||||
TextButton[] delete = new TextButton[1];
|
TextButton[] delete = new TextButton[1];
|
||||||
if(map.custom){
|
if(map.custom){
|
||||||
image.row();
|
image.row();
|
||||||
@@ -89,7 +89,7 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
reload();
|
reload();
|
||||||
Core.scene.setScrollFocus(pane);
|
Core.scene.setScrollFocus(pane);
|
||||||
});
|
});
|
||||||
}).width(images+16).units(Unit.dp).padBottom(-10f).grow().get();
|
}).width(images+16).padBottom(-10f).grow().get();
|
||||||
}
|
}
|
||||||
image.clicked(()->{
|
image.clicked(()->{
|
||||||
if(delete[0] != null && delete[0].getClickListener().isOver()){
|
if(delete[0] != null && delete[0].getClickListener().isOver()){
|
||||||
@@ -99,14 +99,14 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
hide();
|
hide();
|
||||||
Vars.control.playMap(selectedMap);
|
Vars.control.playMap(selectedMap);
|
||||||
});
|
});
|
||||||
image.getImageCell().size(images).units(Unit.dp);
|
image.getImageCell().size(images);
|
||||||
|
|
||||||
stack.add(back);
|
stack.add(back);
|
||||||
stack.add(image);
|
stack.add(image);
|
||||||
|
|
||||||
maps.add(stack).width(170).top().pad(4f).units(Unit.dp);
|
maps.add(stack).width(170).top().pad(4f);
|
||||||
|
|
||||||
maps.padRight(Unit.dp.inPixels(26));
|
maps.padRight(Unit.dp.scl(26));
|
||||||
|
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
pane = new ScrollPane(slots);
|
pane = new ScrollPane(slots);
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
|
|
||||||
slots.padRight(Unit.dp.inPixels(24));
|
slots.padRight(Unit.dp.scl(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.inPixels(12));
|
button.pad(Unit.dp.scl(12));
|
||||||
button.getLabelCell().top().left().growX();
|
button.getLabelCell().top().left().growX();
|
||||||
|
|
||||||
button.row();
|
button.row();
|
||||||
@@ -63,11 +63,11 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
button.add(info).padBottom(3).padTop(7);
|
button.add(info).padBottom(3).padTop(7);
|
||||||
button.row();
|
button.row();
|
||||||
//button.addImage("white", Color.GRAY)
|
//button.addImage("white", Color.GRAY)
|
||||||
//.growX().height(3f).pad(4f).units(Unit.dp);
|
//.growX().height(3f).pad(4f);
|
||||||
button.row();
|
button.row();
|
||||||
modifyButton(button, slot);
|
modifyButton(button, slot);
|
||||||
|
|
||||||
slots.add(button).size(404, 104).pad(4).units(Unit.dp);
|
slots.add(button).size(404, 104).pad(4);
|
||||||
slots.row();
|
slots.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
});
|
});
|
||||||
|
|
||||||
if(!Vars.android){
|
if(!Vars.android){
|
||||||
content().defaults().width(220).height(50).units(Unit.dp);
|
content().defaults().width(220).height(50);
|
||||||
|
|
||||||
content().addButton("Back", () -> {
|
content().addButton("Back", () -> {
|
||||||
hide();
|
hide();
|
||||||
@@ -63,7 +63,7 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
}){
|
}){
|
||||||
{
|
{
|
||||||
for(Cell<?> cell : getButtonTable().getCells())
|
for(Cell<?> cell : getButtonTable().getCells())
|
||||||
cell.pad(3).size(180, 44).units(Unit.dp);
|
cell.pad(3).size(180, 44);
|
||||||
}
|
}
|
||||||
}.show();
|
}.show();
|
||||||
});
|
});
|
||||||
@@ -73,8 +73,8 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
|
|
||||||
PressGroup group = new PressGroup();
|
PressGroup group = new PressGroup();
|
||||||
|
|
||||||
content().defaults().size(120f).pad(5).units(Unit.dp);
|
content().defaults().size(120f).pad(5);
|
||||||
float isize = Unit.dp.inPixels(14f*4);
|
float isize = Unit.dp.scl(14f*4);
|
||||||
|
|
||||||
new imagebutton("icon-play-2", isize, () -> {
|
new imagebutton("icon-play-2", isize, () -> {
|
||||||
hide();
|
hide();
|
||||||
@@ -94,7 +94,7 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
GameState.set(State.menu);
|
GameState.set(State.menu);
|
||||||
}){{
|
}){{
|
||||||
for(Cell<?> cell : getButtonTable().getCells())
|
for(Cell<?> cell : getButtonTable().getCells())
|
||||||
cell.pad(3).size(180, 44).units(Unit.dp);
|
cell.pad(3).size(180, 44);
|
||||||
}}.show();
|
}}.show();
|
||||||
}).text("Quit").padTop(4f);
|
}).text("Quit").padTop(4f);
|
||||||
|
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ public class MindustryKeybindDialog extends KeybindDialog{
|
|||||||
title().setAlignment(Align.center);
|
title().setAlignment(Align.center);
|
||||||
getTitleTable().row();
|
getTitleTable().row();
|
||||||
getTitleTable().add(new Image("white"))
|
getTitleTable().add(new Image("white"))
|
||||||
.growX().height(3f).pad(4f).units(Unit.dp).get().setColor(Colors.get("accent"));
|
.growX().height(3f).pad(4f).get().setColor(Colors.get("accent"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("Back", "icon-arrow-left", Unit.dp.inPixels(30f), ()->{
|
buttons().addImageTextButton("Back", "icon-arrow-left", Unit.dp.scl(30f), ()->{
|
||||||
hide();
|
hide();
|
||||||
}).size(230f, 64f).units(Unit.dp);
|
}).size(230f, 64f);
|
||||||
|
|
||||||
keyDown(key->{
|
keyDown(key->{
|
||||||
if(key == Keys.ESCAPE || key == Keys.BACK)
|
if(key == Keys.ESCAPE || key == Keys.BACK)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class MindustrySettingsDialog extends SettingsDialog{
|
|||||||
title().setAlignment(Align.center);
|
title().setAlignment(Align.center);
|
||||||
getTitleTable().row();
|
getTitleTable().row();
|
||||||
getTitleTable().add(new Image("white"))
|
getTitleTable().add(new Image("white"))
|
||||||
.growX().height(3f).pad(4f).units(Unit.dp).get().setColor(Colors.get("accent"));
|
.growX().height(3f).pad(4f).get().setColor(Colors.get("accent"));
|
||||||
|
|
||||||
content().remove();
|
content().remove();
|
||||||
buttons().remove();
|
buttons().remove();
|
||||||
@@ -32,9 +32,9 @@ public class MindustrySettingsDialog extends SettingsDialog{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("Back", "icon-arrow-left", Unit.dp.inPixels(30f), ()->{
|
buttons().addImageTextButton("Back", "icon-arrow-left", Unit.dp.scl(30f), ()->{
|
||||||
hide();
|
hide();
|
||||||
}).size(230f, 64f).units(Unit.dp);
|
}).size(230f, 64f);
|
||||||
|
|
||||||
keyDown(key->{
|
keyDown(key->{
|
||||||
if(key == Keys.ESCAPE || key == Keys.BACK)
|
if(key == Keys.ESCAPE || key == Keys.BACK)
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import io.anuke.ucore.core.Timers;
|
|||||||
import io.anuke.ucore.scene.ui.ConfirmDialog;
|
import io.anuke.ucore.scene.ui.ConfirmDialog;
|
||||||
import io.anuke.ucore.scene.ui.TextButton;
|
import io.anuke.ucore.scene.ui.TextButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Cell;
|
import io.anuke.ucore.scene.ui.layout.Cell;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
|
|
||||||
//TODO unified save/load dialogs
|
//TODO unified save/load dialogs
|
||||||
public class SaveDialog extends LoadDialog{
|
public class SaveDialog extends LoadDialog{
|
||||||
@@ -27,7 +26,7 @@ public class SaveDialog extends LoadDialog{
|
|||||||
{
|
{
|
||||||
content().pad(16);
|
content().pad(16);
|
||||||
for(Cell<?> cell : getButtonTable().getCells())
|
for(Cell<?> cell : getButtonTable().getCells())
|
||||||
cell.size(110, 45).pad(4).units(Unit.dp);
|
cell.size(110, 45).pad(4);
|
||||||
}
|
}
|
||||||
}.show();
|
}.show();
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ public class BlocksFragment implements Fragment{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
button.setName("sectionbutton" + sec.name());
|
button.setName("sectionbutton" + sec.name());
|
||||||
add(button).growX().height(54).padTop(sec.ordinal() <= 2 ? -10 : -5).units(Unit.dp);
|
add(button).growX().height(54).padTop(sec.ordinal() <= 2 ? -10 : -5);
|
||||||
button.getImageCell().size(40).padBottom(4).padTop(2).units(Unit.dp);
|
button.getImageCell().size(40).padBottom(4).padTop(2);
|
||||||
group.add(button);
|
group.add(button);
|
||||||
|
|
||||||
if(sec.ordinal() % 3 == 2 && sec.ordinal() > 0){
|
if(sec.ordinal() % 3 == 2 && sec.ordinal() > 0){
|
||||||
@@ -96,8 +96,8 @@ public class BlocksFragment implements Fragment{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
table.add(image).size(size+8).pad(2).units(Unit.dp);
|
table.add(image).size(size+8).pad(2);
|
||||||
image.getImageCell().size(size).units(Unit.dp);
|
image.getImageCell().size(size);
|
||||||
|
|
||||||
image.update(()->{
|
image.update(()->{
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ public class BlocksFragment implements Fragment{
|
|||||||
|
|
||||||
desctable.defaults().left();
|
desctable.defaults().left();
|
||||||
desctable.left();
|
desctable.left();
|
||||||
desctable.pad(Unit.dp.inPixels(12));
|
desctable.pad(Unit.dp.scl(12));
|
||||||
|
|
||||||
Table header = new Table();
|
Table header = new Table();
|
||||||
|
|
||||||
@@ -154,10 +154,10 @@ public class BlocksFragment implements Fragment{
|
|||||||
TextureRegion region = Draw.hasRegion(recipe.result.name() + "-icon") ?
|
TextureRegion region = Draw.hasRegion(recipe.result.name() + "-icon") ?
|
||||||
Draw.region(recipe.result.name() + "-icon") : Draw.region(recipe.result.name());
|
Draw.region(recipe.result.name() + "-icon") : Draw.region(recipe.result.name());
|
||||||
|
|
||||||
header.addImage(region).size(8*5).padTop(4).units(Unit.dp);
|
header.addImage(region).size(8*5).padTop(4);
|
||||||
Label nameLabel = new Label(recipe.result.formalName);
|
Label nameLabel = new Label(recipe.result.formalName);
|
||||||
nameLabel.setWrap(true);
|
nameLabel.setWrap(true);
|
||||||
header.add(nameLabel).padLeft(2).width(130f).units(Unit.dp);
|
header.add(nameLabel).padLeft(2).width(130f);
|
||||||
|
|
||||||
//extra info
|
//extra info
|
||||||
if(recipe.result.fullDescription != null){
|
if(recipe.result.fullDescription != null){
|
||||||
@@ -173,16 +173,16 @@ public class BlocksFragment implements Fragment{
|
|||||||
|
|
||||||
FloatingDialog d = new FloatingDialog("Block Info");
|
FloatingDialog d = new FloatingDialog("Block Info");
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.defaults().pad(1f).units(Unit.dp);
|
table.defaults().pad(1f);
|
||||||
ScrollPane pane = new ScrollPane(table, "clear");
|
ScrollPane pane = new ScrollPane(table, "clear");
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
Table top = new Table();
|
Table top = new Table();
|
||||||
top.left();
|
top.left();
|
||||||
top.add(new Image(Draw.region(recipe.result.name))).size(8*5 * recipe.result.width).units(Unit.dp);
|
top.add(new Image(Draw.region(recipe.result.name))).size(8*5 * recipe.result.width);
|
||||||
top.add("[accent]"+recipe.result.formalName).padLeft(6f).units(Unit.dp);
|
top.add("[accent]"+recipe.result.formalName).padLeft(6f);
|
||||||
table.add(top).fill().left();
|
table.add(top).fill().left();
|
||||||
table.row();
|
table.row();
|
||||||
table.add(desclabel).width(600).units(Unit.dp);
|
table.add(desclabel).width(600);
|
||||||
table.row();
|
table.row();
|
||||||
|
|
||||||
d.content().add(pane).grow();
|
d.content().add(pane).grow();
|
||||||
@@ -200,14 +200,14 @@ public class BlocksFragment implements Fragment{
|
|||||||
d.buttons().addButton("OK", ()->{
|
d.buttons().addButton("OK", ()->{
|
||||||
if(!wasPaused) GameState.set(State.playing);
|
if(!wasPaused) GameState.set(State.playing);
|
||||||
d.hide();
|
d.hide();
|
||||||
}).size(110, 50).pad(10f).units(Unit.dp);
|
}).size(110, 50).pad(10f);
|
||||||
|
|
||||||
d.show();
|
d.show();
|
||||||
}).expandX().padLeft(3).top().right().size(40f, 44f).padTop(-2).units(Unit.dp);
|
}).expandX().padLeft(3).top().right().size(40f, 44f).padTop(-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
desctable.add().pad(2).units(Unit.dp);
|
desctable.add().pad(2);
|
||||||
|
|
||||||
Table requirements = new Table();
|
Table requirements = new Table();
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ public class BlocksFragment implements Fragment{
|
|||||||
|
|
||||||
for(ItemStack stack : recipe.requirements){
|
for(ItemStack stack : recipe.requirements){
|
||||||
ItemStack fs = stack;
|
ItemStack fs = stack;
|
||||||
requirements.addImage(Draw.region("icon-"+stack.item.name())).size(8*3).units(Unit.dp);
|
requirements.addImage(Draw.region("icon-"+stack.item.name())).size(8*3);
|
||||||
Label reqlabel = new Label("");
|
Label reqlabel = new Label("");
|
||||||
|
|
||||||
reqlabel.update(()->{
|
reqlabel.update(()->{
|
||||||
@@ -239,7 +239,7 @@ public class BlocksFragment implements Fragment{
|
|||||||
Label label = new Label("[health]health: " + recipe.result.health + (recipe.result.description == null ?
|
Label label = new Label("[health]health: " + recipe.result.health + (recipe.result.description == null ?
|
||||||
"" : ("\n[]" + recipe.result.description)));
|
"" : ("\n[]" + recipe.result.description)));
|
||||||
label.setWrap(true);
|
label.setWrap(true);
|
||||||
desctable.add(label).width(200).padTop(4).padBottom(2).units(Unit.dp);
|
desctable.add(label).width(200).padTop(4).padBottom(2);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ public class HudFragment implements Fragment{
|
|||||||
|
|
||||||
new table(){{
|
new table(){{
|
||||||
left();
|
left();
|
||||||
defaults().size(68).units(Unit.dp).left();
|
defaults().size(68).left();
|
||||||
float isize = Unit.dp.inPixels(40);
|
float isize = Unit.dp.scl(40);
|
||||||
|
|
||||||
new imagebutton("icon-menu", isize, ()->{
|
new imagebutton("icon-menu", isize, ()->{
|
||||||
ui.showMenu();
|
ui.showMenu();
|
||||||
@@ -92,7 +92,7 @@ public class HudFragment implements Fragment{
|
|||||||
atop();
|
atop();
|
||||||
|
|
||||||
new table("pane"){{
|
new table("pane"){{
|
||||||
new label("[orange]< paused >").scale(Unit.dp.inPixels(0.75f)).pad(6).units(Unit.dp);
|
new label("[orange]< paused >").scale(Unit.dp.scl(0.75f)).pad(6);
|
||||||
}}.end();
|
}}.end();
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
@@ -169,22 +169,22 @@ public class HudFragment implements Fragment{
|
|||||||
new label(()-> control.getEnemiesRemaining() > 0 ?
|
new label(()-> control.getEnemiesRemaining() > 0 ?
|
||||||
control.getEnemiesRemaining() + printEnemiesRemaining() :
|
control.getEnemiesRemaining() + printEnemiesRemaining() :
|
||||||
(control.getTutorial().active() || Vars.control.getMode() == GameMode.sandbox) ? "waiting..." : "Wave in " + (int) (control.getWaveCountdown() / 60f))
|
(control.getTutorial().active() || Vars.control.getMode() == GameMode.sandbox) ? "waiting..." : "Wave in " + (int) (control.getWaveCountdown() / 60f))
|
||||||
.minWidth(140).units(Unit.dp).left();
|
.minWidth(140).left();
|
||||||
|
|
||||||
margin(12f);
|
margin(12f);
|
||||||
get().padLeft(6);
|
get().padLeft(6);
|
||||||
}}.left().end();
|
}}.left().end();
|
||||||
|
|
||||||
playButton(uheight);
|
playButton(uheight);
|
||||||
}}.height(uheight).units(Unit.dp).fillX().expandX().end();
|
}}.height(uheight).fillX().expandX().end();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playButton(float uheight){
|
private void playButton(float uheight){
|
||||||
new imagebutton("icon-play", Unit.dp.inPixels(30f), ()->{
|
new imagebutton("icon-play", Unit.dp.scl(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).units(Unit.dp).update(l->{
|
.padLeft(-10f).width(40f).update(l->{
|
||||||
boolean vis = Vars.control.getMode() == GameMode.sandbox && Vars.control.getEnemiesRemaining() <= 0;
|
boolean vis = Vars.control.getMode() == GameMode.sandbox && Vars.control.getEnemiesRemaining() <= 0;
|
||||||
boolean paused = GameState.is(State.paused) || !vis;
|
boolean paused = GameState.is(State.paused) || !vis;
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ public class HudFragment implements Fragment{
|
|||||||
Image image = new Image(Draw.region("icon-" + items[i]));
|
Image image = new Image(Draw.region("icon-" + items[i]));
|
||||||
Label label = new Label(formatted);
|
Label label = new Label(formatted);
|
||||||
label.setFontScale(fontscale*1.5f);
|
label.setFontScale(fontscale*1.5f);
|
||||||
itemtable.add(image).size(8*3).units(Unit.dp);
|
itemtable.add(image).size(8*3);
|
||||||
itemtable.add(label).left();
|
itemtable.add(label).left();
|
||||||
itemtable.row();
|
itemtable.row();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class MenuFragment implements Fragment{
|
|||||||
PressGroup group = new PressGroup();
|
PressGroup group = new PressGroup();
|
||||||
|
|
||||||
float scale = 4f;
|
float scale = 4f;
|
||||||
defaults().size(100*scale, 21*scale).pad(-10f).units(Unit.dp);
|
defaults().size(100*scale, 21*scale).pad(-10f);
|
||||||
|
|
||||||
add(new MenuButton("text-play", group, ui::showLevels));
|
add(new MenuButton("text-play", group, ui::showLevels));
|
||||||
row();
|
row();
|
||||||
@@ -46,7 +46,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.inPixels(16));
|
get().pad(Unit.dp.scl(16));
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
visible(()->GameState.is(State.menu));
|
visible(()->GameState.is(State.menu));
|
||||||
@@ -54,8 +54,8 @@ public class MenuFragment implements Fragment{
|
|||||||
}else{
|
}else{
|
||||||
new table(){{
|
new table(){{
|
||||||
new table(){{
|
new table(){{
|
||||||
defaults().size(120f).pad(5).units(Unit.dp);
|
defaults().size(120f).pad(5);
|
||||||
float isize = Unit.dp.inPixels(14f*4);
|
float isize = Unit.dp.scl(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 +84,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.inPixels(30f), ()->{
|
new imagebutton("icon-discord", Unit.dp.scl(30f), ()->{
|
||||||
ui.showDiscord();
|
ui.showDiscord();
|
||||||
}).margin(14);
|
}).margin(14);
|
||||||
}
|
}
|
||||||
new imagebutton("icon-info", Unit.dp.inPixels(30f), ()->{
|
new imagebutton("icon-info", Unit.dp.scl(30f), ()->{
|
||||||
ui.showAbout();
|
ui.showAbout();
|
||||||
}).margin(14);
|
}).margin(14);
|
||||||
}}.end().visible(()->GameState.is(State.menu));
|
}}.end().visible(()->GameState.is(State.menu));
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public class PlacementFragment implements Fragment{
|
|||||||
|
|
||||||
new table("pane"){{
|
new table("pane"){{
|
||||||
visible(() -> player.recipe != null && player.recipe.result.rotate);
|
visible(() -> player.recipe != null && player.recipe.result.rotate);
|
||||||
add(image).size(40f).units(Unit.dp);
|
add(image).size(40f);
|
||||||
}}.size(54f).units(Unit.dp).end();
|
}}.size(54f).end();
|
||||||
|
|
||||||
row();*/
|
row();*/
|
||||||
|
|
||||||
@@ -50,31 +50,31 @@ public class PlacementFragment implements Fragment{
|
|||||||
aleft();
|
aleft();
|
||||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||||
|
|
||||||
defaults().size(54, 58).pad(0).units(Unit.dp);
|
defaults().size(54, 58).pad(0);
|
||||||
|
|
||||||
for(PlaceMode mode : PlaceMode.values()){
|
for(PlaceMode mode : PlaceMode.values()){
|
||||||
if(!mode.shown || mode.delete) continue;
|
if(!mode.shown || mode.delete) continue;
|
||||||
|
|
||||||
defaults().padBottom(-5.5f);
|
defaults().padBottom(-5.5f);
|
||||||
|
|
||||||
new imagebutton("icon-" + mode.name(), "toggle", Unit.dp.inPixels(10*3), ()->{
|
new imagebutton("icon-" + mode.name(), "toggle", Unit.dp.scl(10*3), ()->{
|
||||||
control.getInput().resetCursor();
|
control.getInput().resetCursor();
|
||||||
player.placeMode = mode;
|
player.placeMode = mode;
|
||||||
}).group(group).units(Unit.dp);
|
}).group(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
row();
|
row();
|
||||||
|
|
||||||
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.inPixels(14*3), ()->{
|
new imagebutton("icon-cancel", Unit.dp.scl(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.inPixels(14*3), ()->{
|
new imagebutton("icon-arrow", Unit.dp.scl(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);
|
||||||
@@ -99,7 +99,7 @@ public class PlacementFragment implements Fragment{
|
|||||||
aleft();
|
aleft();
|
||||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||||
|
|
||||||
defaults().size(54, 58).pad(0).units(Unit.dp);
|
defaults().size(54, 58).pad(0);
|
||||||
|
|
||||||
int d = 0;
|
int d = 0;
|
||||||
|
|
||||||
@@ -108,12 +108,12 @@ 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.inPixels(10*3), ()->{
|
new imagebutton("icon-" + mode.name(), "toggle", Unit.dp.scl(10*3), ()->{
|
||||||
control.getInput().resetCursor();
|
control.getInput().resetCursor();
|
||||||
player.breakMode = mode;
|
player.breakMode = mode;
|
||||||
}){{
|
}){{
|
||||||
group.add(get());
|
group.add(get());
|
||||||
}}.units(Unit.dp);
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|||||||
@@ -17,16 +17,16 @@ public class ToolFragment implements Fragment{
|
|||||||
|
|
||||||
public void build(){
|
public void build(){
|
||||||
tools = new Table();
|
tools = new Table();
|
||||||
tools.addIButton("icon-cancel", Unit.dp.inPixels(42), ()->{
|
tools.addIButton("icon-cancel", Unit.dp.scl(42), ()->{
|
||||||
player.recipe = null;
|
player.recipe = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
tools.addIButton("icon-rotate", Unit.dp.inPixels(42), ()->{
|
tools.addIButton("icon-rotate", Unit.dp.scl(42), ()->{
|
||||||
player.rotation ++;
|
player.rotation ++;
|
||||||
player.rotation %= 4;
|
player.rotation %= 4;
|
||||||
});
|
});
|
||||||
|
|
||||||
tools.addIButton("icon-check", Unit.dp.inPixels(42), ()->{
|
tools.addIButton("icon-check", Unit.dp.scl(42), ()->{
|
||||||
player.placeMode.tapped(control.getInput().getBlockX(), control.getInput().getBlockY());
|
player.placeMode.tapped(control.getInput().getBlockX(), control.getInput().getBlockY());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,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.inPixels(10*3), ()->{
|
table.addIButton("icon-arrow-left", Unit.dp.scl(10*3), ()->{
|
||||||
int color = entity.sortItem.ordinal();
|
int color = entity.sortItem.ordinal();
|
||||||
|
|
||||||
color --;
|
color --;
|
||||||
@@ -103,9 +103,9 @@ public class Sorter extends Junction implements Configurable{
|
|||||||
entity.sortItem = Item.values()[color];
|
entity.sortItem = Item.values()[color];
|
||||||
});
|
});
|
||||||
|
|
||||||
table.add().size(40f).units(Unit.dp);
|
table.add().size(40f);
|
||||||
|
|
||||||
table.addIButton("icon-arrow-right", Unit.dp.inPixels(10*3), ()->{
|
table.addIButton("icon-arrow-right", Unit.dp.scl(10*3), ()->{
|
||||||
int color = entity.sortItem.ordinal();
|
int color = entity.sortItem.ordinal();
|
||||||
|
|
||||||
color ++;
|
color ++;
|
||||||
|
|||||||
@@ -69,13 +69,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.inPixels(10*3), ()->{
|
table.addIButton("icon-arrow-left", Unit.dp.scl(10*3), ()->{
|
||||||
entity.color = (byte)Mathf.mod(entity.color - 1, colors);
|
entity.color = (byte)Mathf.mod(entity.color - 1, colors);
|
||||||
});
|
});
|
||||||
|
|
||||||
table.add().size(40f).units(Unit.dp);
|
table.add().size(40f);
|
||||||
|
|
||||||
table.addIButton("icon-arrow-right", Unit.dp.inPixels(10*3), ()->{
|
table.addIButton("icon-arrow-right", Unit.dp.scl(10*3), ()->{
|
||||||
entity.color = (byte)Mathf.mod(entity.color + 1, colors);
|
entity.color = (byte)Mathf.mod(entity.color + 1, colors);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms512m -Xmx1536m
|
org.gradle.jvmargs=-Xms512m -Xmx1536m
|
||||||
org.gradle.configureondemand=true
|
org.gradle.configureondemand=true
|
||||||
|
android.enableAapt2=false
|
||||||
|
|||||||
Reference in New Issue
Block a user