Add things
This commit is contained in:
@@ -40,7 +40,7 @@ public class Vars{
|
|||||||
//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.scl(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 = true;
|
public static boolean debug = false;
|
||||||
//whether the player can clip through walls
|
//whether the player can clip through walls
|
||||||
public static boolean noclip = false;
|
public static boolean noclip = false;
|
||||||
//whether to draw chunk borders
|
//whether to draw chunk borders
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public class Enemy extends DestructibleEntity{
|
|||||||
|
|
||||||
float minv = 0.07f;
|
float minv = 0.07f;
|
||||||
|
|
||||||
if(Math.abs(xvelocity) < minv && Math.abs(yvelocity) < minv && node > 0 && target == null){
|
if(Vector2.dst(xvelocity, yvelocity, 0, 0) < minv && node > 0 && target == null){
|
||||||
idletime += Timers.delta();
|
idletime += Timers.delta();
|
||||||
}else{
|
}else{
|
||||||
idletime = 0;
|
idletime = 0;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
Pixmap pixmap = new Pixmap(file);
|
Pixmap pixmap = new Pixmap(file);
|
||||||
if(verifySize(pixmap)){
|
if(verifySize(pixmap)){
|
||||||
editor.setPixmap(pixmap);
|
editor.setPixmap(pixmap);
|
||||||
|
view.clearStack();
|
||||||
}else{
|
}else{
|
||||||
Vars.ui.showError("[orange]Invalid image dimensions![]\nValid map dimensions: " + Arrays.toString(MapEditor.validMapSizes));
|
Vars.ui.showError("[orange]Invalid image dimensions![]\nValid map dimensions: " + Arrays.toString(MapEditor.validMapSizes));
|
||||||
}
|
}
|
||||||
@@ -89,6 +90,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
copy.texture = new Texture(copy.pixmap);
|
copy.texture = new Texture(copy.pixmap);
|
||||||
editor.beginEdit(copy);
|
editor.beginEdit(copy);
|
||||||
Vars.ui.hideLoading();
|
Vars.ui.hideLoading();
|
||||||
|
view.clearStack();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -98,6 +100,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
Vars.ui.showLoading();
|
Vars.ui.showLoading();
|
||||||
Timers.run(10f, ()->{
|
Timers.run(10f, ()->{
|
||||||
editor.resize(x, y);
|
editor.resize(x, y);
|
||||||
|
view.clearStack();
|
||||||
Vars.ui.hideLoading();
|
Vars.ui.hideLoading();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -112,6 +115,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
Vars.world.maps().saveAndReload(editor.getMap(), editor.pixmap());
|
Vars.world.maps().saveAndReload(editor.getMap(), editor.pixmap());
|
||||||
loadDialog.rebuild();
|
loadDialog.rebuild();
|
||||||
Vars.ui.hideLoading();
|
Vars.ui.hideLoading();
|
||||||
|
view.clearStack();
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
Vars.ui.hideLoading();
|
Vars.ui.hideLoading();
|
||||||
@@ -131,9 +135,14 @@ public class MapEditorDialog extends Dialog{
|
|||||||
editor.beginEdit(new Map());
|
editor.beginEdit(new Map());
|
||||||
blockgroup.getButtons().get(2).setChecked(true);
|
blockgroup.getButtons().get(2).setChecked(true);
|
||||||
Core.scene.setScrollFocus(view);
|
Core.scene.setScrollFocus(view);
|
||||||
|
view.clearStack();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MapView getView() {
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
public void resetSaved(){
|
public void resetSaved(){
|
||||||
saved = false;
|
saved = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,14 +62,12 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||||||
content().add(pane).fillY();
|
content().add(pane).fillY();
|
||||||
|
|
||||||
buttons().defaults().size(170f, 50f).pad(4f);
|
buttons().defaults().size(170f, 50f).pad(4f);
|
||||||
buttons().addButton("Back", () -> hide());
|
buttons().addButton("Back", this::hide);
|
||||||
buttons().addButton("Randomize", () ->{
|
buttons().addButton("Randomize", () ->{
|
||||||
editor.getFilter().randomize();
|
editor.getFilter().randomize();
|
||||||
apply();
|
apply();
|
||||||
});
|
});
|
||||||
buttons().addButton("Update", () ->{
|
buttons().addButton("Update", this::apply);
|
||||||
apply();
|
|
||||||
});
|
|
||||||
buttons().addButton("Apply", () ->{
|
buttons().addButton("Apply", () ->{
|
||||||
Vars.ui.showLoading();
|
Vars.ui.showLoading();
|
||||||
|
|
||||||
@@ -77,6 +75,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||||||
editor.applyFilter();
|
editor.applyFilter();
|
||||||
Vars.ui.hideLoading();
|
Vars.ui.hideLoading();
|
||||||
Vars.ui.getEditorDialog().resetSaved();
|
Vars.ui.getEditorDialog().resetSaved();
|
||||||
|
Vars.ui.getEditorDialog().getView().clearStack();
|
||||||
hide();
|
hide();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -93,7 +92,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||||||
|
|
||||||
private void apply(){
|
private void apply(){
|
||||||
loading = true;
|
loading = true;
|
||||||
Timers.run(3f, ()->{
|
Timers.run(3f, () -> {
|
||||||
editor.applyFilterPreview();
|
editor.applyFilterPreview();
|
||||||
loading = false;
|
loading = false;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
private MapEditor editor;
|
private MapEditor editor;
|
||||||
private EditorTool tool = EditorTool.pencil;
|
private EditorTool tool = EditorTool.pencil;
|
||||||
private OperationStack stack = new OperationStack();
|
private OperationStack stack = new OperationStack();
|
||||||
|
private PixelOperation op;
|
||||||
private Bresenham2 br = new Bresenham2();
|
private Bresenham2 br = new Bresenham2();
|
||||||
private float offsetx, offsety;
|
private float offsetx, offsety;
|
||||||
private float zoom = 1f;
|
private float zoom = 1f;
|
||||||
@@ -60,6 +61,8 @@ public class MapView extends Element implements GestureListener{
|
|||||||
Vars.ui.getEditorDialog().resetSaved();
|
Vars.ui.getEditorDialog().resetSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
op = new PixelOperation(editor.pixmap());
|
||||||
|
|
||||||
drawing = true;
|
drawing = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -67,6 +70,8 @@ public class MapView extends Element implements GestureListener{
|
|||||||
@Override
|
@Override
|
||||||
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
|
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
|
||||||
drawing = false;
|
drawing = false;
|
||||||
|
stack.add(op);
|
||||||
|
op = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
24
core/src/io/anuke/mindustry/mapeditor/PixelOperation.java
Normal file
24
core/src/io/anuke/mindustry/mapeditor/PixelOperation.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package io.anuke.mindustry.mapeditor;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
|
|
||||||
|
public class PixelOperation extends DrawOperation {
|
||||||
|
|
||||||
|
public PixelOperation(Pixmap pixmap){
|
||||||
|
super(pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void undo() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void redo() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user