you can see the length of the wall you're drawing

master
GammelJAN 5 years ago
parent af5628949d
commit 5189ef95bd

@ -138,6 +138,14 @@ public class Controller extends ApplicationAdapter implements InputProcessor {
polygonSpriteBatch.begin();
poly2.draw(polygonSpriteBatch);
polygonSpriteBatch.end();
renderer.end();
batch.begin();
font.setColor(Color.BLACK);
if(model.getCurrentLength()!=0)font.draw(batch, ""+model.getCurrentLength(), Gdx.input.getX()+10, GAME_WORLD_HEIGHT - Gdx.input.getY()+10);
batch.end();
renderer.begin(ShapeRenderer.ShapeType.Filled);
}
//
renderer.end();

@ -14,6 +14,7 @@ public class Model {
private Polygon tempPolygon;
private Vector2 tempStart;
private boolean drawing = false;
private int currentLength;
private int leftWallLength = 2500;
@ -45,6 +46,7 @@ public class Model {
if(drawing){
double angle = StaticMath.calculateAngle(x,y,(int)tempStart.x,(int)tempStart.y);
tempPolygon = StaticMath.createPolygon((int)tempStart.x, (int)tempStart.y, angle-Math.PI,10,Vector2.dst(tempStart.x,tempStart.y,x,y));
currentLength = (int)Vector2.dst(tempStart.x,tempStart.y,x,y);
}
}
public void finishWall(int x, int y){
@ -77,6 +79,7 @@ public class Model {
tempPolygon = null;
tempStart = null;
drawing = false;
currentLength = 0;
}
@ -99,4 +102,8 @@ public class Model {
public int getLeftWallLength() {
return leftWallLength;
}
public int getCurrentLength() {
return currentLength;
}
}

Loading…
Cancel
Save