Fixed compile errors
This commit is contained in:
@@ -3,7 +3,6 @@ package io.anuke.mindustry.editor;
|
|||||||
import com.badlogic.gdx.Input.Keys;
|
import com.badlogic.gdx.Input.Keys;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Colors;
|
import com.badlogic.gdx.graphics.Colors;
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
import com.badlogic.gdx.input.GestureDetector;
|
import com.badlogic.gdx.input.GestureDetector;
|
||||||
import com.badlogic.gdx.input.GestureDetector.GestureListener;
|
import com.badlogic.gdx.input.GestureDetector.GestureListener;
|
||||||
@@ -20,7 +19,6 @@ import io.anuke.ucore.core.Graphics;
|
|||||||
import io.anuke.ucore.core.Inputs;
|
import io.anuke.ucore.core.Inputs;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Lines;
|
import io.anuke.ucore.graphics.Lines;
|
||||||
import io.anuke.ucore.graphics.Pixmaps;
|
|
||||||
import io.anuke.ucore.scene.Element;
|
import io.anuke.ucore.scene.Element;
|
||||||
import io.anuke.ucore.scene.event.InputEvent;
|
import io.anuke.ucore.scene.event.InputEvent;
|
||||||
import io.anuke.ucore.scene.event.InputListener;
|
import io.anuke.ucore.scene.event.InputListener;
|
||||||
@@ -37,7 +35,6 @@ public class MapView extends Element implements GestureListener{
|
|||||||
private EditorTool tool = EditorTool.pencil;
|
private EditorTool tool = EditorTool.pencil;
|
||||||
private OperationStack stack = new OperationStack();
|
private OperationStack stack = new OperationStack();
|
||||||
private DrawOperation op;
|
private DrawOperation op;
|
||||||
private Pixmap current;
|
|
||||||
private Bresenham2 br = new Bresenham2();
|
private Bresenham2 br = new Bresenham2();
|
||||||
private boolean updated = false;
|
private boolean updated = false;
|
||||||
private float offsetx, offsety;
|
private float offsetx, offsety;
|
||||||
@@ -61,7 +58,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
|
|
||||||
public void clearStack(){
|
public void clearStack(){
|
||||||
stack.clear();
|
stack.clear();
|
||||||
current = null;
|
//TODO clear und obuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
public OperationStack getStack() {
|
public OperationStack getStack() {
|
||||||
@@ -76,24 +73,15 @@ public class MapView extends Element implements GestureListener{
|
|||||||
return grid;
|
return grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void push(Pixmap previous, Pixmap add){
|
|
||||||
DrawOperation op = new DrawOperation(editor.pixmap());
|
|
||||||
op.add(previous, add);
|
|
||||||
stack.add(op);
|
|
||||||
this.current = add;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void undo(){
|
public void undo(){
|
||||||
if(stack.canUndo()){
|
if(stack.canUndo()){
|
||||||
stack.undo();
|
stack.undo();
|
||||||
editor.updateTexture();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void redo(){
|
public void redo(){
|
||||||
if(stack.canRedo()){
|
if(stack.canRedo()){
|
||||||
stack.redo();
|
stack.redo();
|
||||||
editor.updateTexture();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,9 +99,6 @@ public class MapView extends Element implements GestureListener{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(current == null){
|
|
||||||
current = Pixmaps.copy(editor.pixmap());
|
|
||||||
}
|
|
||||||
updated = false;
|
updated = false;
|
||||||
|
|
||||||
GridPoint2 p = project(x, y);
|
GridPoint2 p = project(x, y);
|
||||||
@@ -128,8 +113,6 @@ public class MapView extends Element implements GestureListener{
|
|||||||
ui.editor.resetSaved();
|
ui.editor.resetSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
op = new DrawOperation(editor.pixmap());
|
|
||||||
|
|
||||||
drawing = true;
|
drawing = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -148,15 +131,6 @@ public class MapView extends Element implements GestureListener{
|
|||||||
}
|
}
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(updated){
|
|
||||||
if(op == null) op = new DrawOperation(editor.pixmap());
|
|
||||||
Pixmap next = Pixmaps.copy(editor.pixmap());
|
|
||||||
op.add(current, next);
|
|
||||||
current = null;
|
|
||||||
stack.add(op);
|
|
||||||
op = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -200,41 +174,42 @@ public class MapView extends Element implements GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private GridPoint2 project(float x, float y){
|
private GridPoint2 project(float x, float y){
|
||||||
float ratio = 1f / ((float)editor.pixmap().getWidth() / editor.pixmap().getHeight());
|
float ratio = 1f / ((float)editor.getMap().width() / editor.getMap().height());
|
||||||
float size = Math.min(width, height);
|
float size = Math.min(width, height);
|
||||||
float sclwidth = size * zoom;
|
float sclwidth = size * zoom;
|
||||||
float sclheight = size * zoom * ratio;
|
float sclheight = size * zoom * ratio;
|
||||||
x = (x - getWidth()/2 + sclwidth/2 - offsetx*zoom) / sclwidth * editor.texture().getWidth();
|
x = (x - getWidth()/2 + sclwidth/2 - offsetx*zoom) / sclwidth * editor.getMap().width();
|
||||||
y = (y - getHeight()/2 + sclheight/2 - offsety*zoom) / sclheight * editor.texture().getHeight();
|
y = (y - getHeight()/2 + sclheight/2 - offsety*zoom) / sclheight * editor.getMap().height();
|
||||||
return Tmp.g1.set((int)x, editor.texture().getHeight() - 1 - (int)y);
|
return Tmp.g1.set((int)x, editor.getMap().height() - 1 - (int)y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector2 unproject(int x, int y){
|
private Vector2 unproject(int x, int y){
|
||||||
float ratio = 1f / ((float)editor.pixmap().getWidth() / editor.pixmap().getHeight());
|
float ratio = 1f / ((float)editor.getMap().width() / editor.getMap().height());
|
||||||
float size = Math.min(width, height);
|
float size = Math.min(width, height);
|
||||||
float sclwidth = size * zoom;
|
float sclwidth = size * zoom;
|
||||||
float sclheight = size * zoom * ratio;
|
float sclheight = size * zoom * ratio;
|
||||||
float px = ((float)x / editor.texture().getWidth()) * sclwidth + offsetx*zoom - sclwidth/2 + getWidth()/2;
|
float px = ((float)x / editor.getMap().width()) * sclwidth + offsetx*zoom - sclwidth/2 + getWidth()/2;
|
||||||
float py = (float)((float)(editor.texture().getHeight() - 1 - y) / editor.texture().getHeight()) * sclheight
|
float py = (float)((float)(editor.getMap().height() - 1 - y) / editor.getMap().height()) * sclheight
|
||||||
+ offsety*zoom - sclheight/2 + getHeight()/2;
|
+ offsety*zoom - sclheight/2 + getHeight()/2;
|
||||||
return vec.set(px, py);
|
return vec.set(px, py);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Batch batch, float alpha){
|
public void draw(Batch batch, float alpha){
|
||||||
float ratio = 1f / ((float)editor.pixmap().getWidth() / editor.pixmap().getHeight());
|
float ratio = 1f / ((float)editor.getMap().width() / editor.getMap().height());
|
||||||
float size = Math.min(width, height);
|
float size = Math.min(width, height);
|
||||||
float sclwidth = size * zoom;
|
float sclwidth = size * zoom;
|
||||||
float sclheight = size * zoom * ratio;
|
float sclheight = size * zoom * ratio;
|
||||||
float centerx = x + width/2 + offsetx * zoom;
|
float centerx = x + width/2 + offsetx * zoom;
|
||||||
float centery = y + height/2 + offsety * zoom;
|
float centery = y + height/2 + offsety * zoom;
|
||||||
|
|
||||||
image.setImageSize(editor.pixmap().getWidth(), editor.pixmap().getHeight());
|
image.setImageSize(editor.getMap().width(), editor.getMap().height());
|
||||||
|
|
||||||
batch.flush();
|
batch.flush();
|
||||||
boolean pop = ScissorStack.pushScissors(rect.set(x + width/2 - size/2, y + height/2 - size/2, size, size));
|
boolean pop = ScissorStack.pushScissors(rect.set(x + width/2 - size/2, y + height/2 - size/2, size, size));
|
||||||
|
|
||||||
batch.draw(editor.texture(), centerx - sclwidth/2, centery - sclheight/2, sclwidth, sclheight);
|
//batch.draw(editor.texture(), centerx - sclwidth/2, centery - sclheight/2, sclwidth, sclheight);
|
||||||
|
//TODO actually render the map here?
|
||||||
|
|
||||||
if(grid){
|
if(grid){
|
||||||
Draw.color(Color.GRAY);
|
Draw.color(Color.GRAY);
|
||||||
|
|||||||
@@ -23,12 +23,13 @@ public class Inventory {
|
|||||||
updated = true;
|
updated = true;
|
||||||
Arrays.fill(items, 0);
|
Arrays.fill(items, 0);
|
||||||
|
|
||||||
addItem(Item.stone, 40);
|
|
||||||
|
|
||||||
if(debug){
|
if(debug){
|
||||||
for(Item item : Item.getAllItems()){
|
for(Item item : Item.getAllItems()){
|
||||||
if(item.material) items[item.id] = 99999;
|
if(item.material) items[item.id] = 99999;
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
addItem(Item.iron, 40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import static io.anuke.mindustry.resource.Section.*;
|
|||||||
|
|
||||||
public class Recipes {
|
public class Recipes {
|
||||||
private static final Array<Recipe> list = Array.with(
|
private static final Array<Recipe> list = Array.with(
|
||||||
new Recipe(defense, DefenseBlocks.stonewall, stack(Item.stone, 12)),
|
//new Recipe(defense, DefenseBlocks.stonewall, stack(Item.stone, 12)),
|
||||||
new Recipe(defense, DefenseBlocks.ironwall, stack(Item.iron, 12)),
|
new Recipe(defense, DefenseBlocks.ironwall, stack(Item.iron, 12)),
|
||||||
new Recipe(defense, DefenseBlocks.steelwall, stack(Item.steel, 12)),
|
new Recipe(defense, DefenseBlocks.steelwall, stack(Item.steel, 12)),
|
||||||
new Recipe(defense, DefenseBlocks.titaniumwall, stack(Item.titanium, 12)),
|
new Recipe(defense, DefenseBlocks.titaniumwall, stack(Item.titanium, 12)),
|
||||||
@@ -22,7 +22,7 @@ public class Recipes {
|
|||||||
new Recipe(defense, DefenseBlocks.largedoor, stack(Item.steel, 3*4), stack(Item.iron, 3*4*4)).setDesktop(),
|
new Recipe(defense, DefenseBlocks.largedoor, stack(Item.steel, 3*4), stack(Item.iron, 3*4*4)).setDesktop(),
|
||||||
new Recipe(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 16)),
|
new Recipe(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 16)),
|
||||||
|
|
||||||
new Recipe(distribution, DistributionBlocks.conveyor, stack(Item.stone, 1)),
|
new Recipe(distribution, DistributionBlocks.conveyor, stack(Item.iron, 1)),
|
||||||
new Recipe(distribution, DistributionBlocks.steelconveyor, stack(Item.steel, 1)),
|
new Recipe(distribution, DistributionBlocks.steelconveyor, stack(Item.steel, 1)),
|
||||||
new Recipe(distribution, DistributionBlocks.pulseconveyor, stack(Item.dirium, 1)),
|
new Recipe(distribution, DistributionBlocks.pulseconveyor, stack(Item.dirium, 1)),
|
||||||
new Recipe(distribution, DistributionBlocks.router, stack(Item.stone, 2)),
|
new Recipe(distribution, DistributionBlocks.router, stack(Item.stone, 2)),
|
||||||
@@ -60,7 +60,7 @@ public class Recipes {
|
|||||||
new Recipe(crafting, ProductionBlocks.weaponFactory, stack(Item.steel, 60), stack(Item.iron, 60)).setDesktop(),
|
new Recipe(crafting, ProductionBlocks.weaponFactory, stack(Item.steel, 60), stack(Item.iron, 60)).setDesktop(),
|
||||||
//new Recipe(crafting, ProductionBlocks.centrifuge, stack(Item.steel, 30), stack(Item.iron, 30)),
|
//new Recipe(crafting, ProductionBlocks.centrifuge, stack(Item.steel, 30), stack(Item.iron, 30)),
|
||||||
|
|
||||||
new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
|
//new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
|
||||||
new Recipe(production, ProductionBlocks.irondrill, stack(Item.stone, 25)),
|
new Recipe(production, ProductionBlocks.irondrill, stack(Item.stone, 25)),
|
||||||
new Recipe(production, ProductionBlocks.coaldrill, stack(Item.stone, 25), stack(Item.iron, 40)),
|
new Recipe(production, ProductionBlocks.coaldrill, stack(Item.stone, 25), stack(Item.iron, 40)),
|
||||||
new Recipe(production, ProductionBlocks.titaniumdrill, stack(Item.iron, 50), stack(Item.steel, 50)),
|
new Recipe(production, ProductionBlocks.titaniumdrill, stack(Item.iron, 50), stack(Item.steel, 50)),
|
||||||
|
|||||||
Reference in New Issue
Block a user