Kiln texture fix / New map resize dialog

This commit is contained in:
Anuken 2019-02-01 18:08:09 -05:00
parent 163ecb160a
commit a6799dd29b
7 changed files with 1409 additions and 1413 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 179 B

View File

Before

Width:  |  Height:  |  Size: 110 B

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -202,7 +202,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
view.clearStack();
Core.scene.setScrollFocus(view);
if(!shownWithMap){
editor.beginEdit(new MapTileData(256, 256), new ObjectMap<>(), true);
editor.beginEdit(new MapTileData(200, 200), new ObjectMap<>(), true);
}
shownWithMap = false;

View File

@ -1,15 +1,13 @@
package io.anuke.mindustry.editor;
import io.anuke.arc.function.BiConsumer;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.mindustry.maps.MapTileData;
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.arc.function.BiConsumer;
import io.anuke.arc.scene.ui.ButtonGroup;
import io.anuke.arc.scene.ui.TextButton;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.math.Mathf;
public class MapResizeDialog extends FloatingDialog{
int[] validMapSizes = {200, 300, 400, 500};
private static final int minSize = 50, maxSize = 500, increment = 50;
int width, height;
public MapResizeDialog(MapEditor editor, BiConsumer<Integer, Integer> cons){
@ -23,28 +21,23 @@ public class MapResizeDialog extends FloatingDialog{
Table table = new Table();
for(boolean w : Mathf.booleans){
int curr = w ? data.width() : data.height();
int idx = 0;
for(int i = 0; i < validMapSizes.length; i++){
if(validMapSizes[i] == curr) idx = i;
}
table.add(w ? "$width" : "$height").padRight(8f);
ButtonGroup<TextButton> group = new ButtonGroup<>();
for(int i = 0; i < validMapSizes.length; i++){
int size = validMapSizes[i];
TextButton button = new TextButton(size + "", "toggle");
button.clicked(() -> {
if(w)
width = size;
else
height = size;
});
group.add(button);
if(i == idx) button.setChecked(true);
table.add(button).size(100f, 54f).pad(2f);
}
table.defaults().height(60f).padTop(8);
table.addButton("<", () -> {
if(w)
width = move(width, -1);
else
height = move(height, -1);
}).size(60f);
table.table("button", t -> t.label(() -> (w ? width : height) + "")).width(200);
table.addButton(">", () -> {
if(w)
width = move(width, 1);
else
height = move(height, 1);
}).size(60f);
table.row();
}
cont.row();
@ -58,6 +51,9 @@ public class MapResizeDialog extends FloatingDialog{
cons.accept(width, height);
hide();
});
}
static int move(int value, int direction){
return Mathf.clamp((value / increment + direction) * increment, minSize, maxSize);
}
}