From 0414472042d54e566d8b5c18105f3258ae0d9f3c Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Sun, 12 May 2019 02:04:09 -0700 Subject: [PATCH] Added debug rendering for toTile50 --- tools/src/com/riiablo/camera/CameraTool.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/src/com/riiablo/camera/CameraTool.java b/tools/src/com/riiablo/camera/CameraTool.java index cebff4ba..6681e263 100644 --- a/tools/src/com/riiablo/camera/CameraTool.java +++ b/tools/src/com/riiablo/camera/CameraTool.java @@ -121,6 +121,8 @@ public class CameraTool extends ApplicationAdapter { final Vector2 vec2 = new Vector2(); final Vector2 loc = new Vector2(); final Vector2 pos = new Vector2(); + final Vector2 near = new Vector2(); + final Vector2 tmp = new Vector2(); final StringBuilder builder = new StringBuilder(); @Override @@ -172,13 +174,24 @@ public class CameraTool extends ApplicationAdapter { vec2.set(Gdx.input.getX(), Gdx.input.getY()); iso.unproject(vec2); iso.toWorld(vec2); + near.set(vec2); iso.toTile(vec2); loc.set(vec2); iso.toScreen(vec2); + iso.toTile50(near); + tmp.set(near); + iso.toScreen(tmp); + shapes.set(ShapeRenderer.ShapeType.Filled); shapes.setColor(Color.SALMON); DebugUtils.drawDiamond(shapes, vec2.x, vec2.y - Tile.SUBTILE_HEIGHT50, Tile.SUBTILE_WIDTH, Tile.SUBTILE_HEIGHT); + shapes.set(ShapeRenderer.ShapeType.Line); + if (!tmp.epsilonEquals(vec2)) { + shapes.setColor(Color.SKY); + DebugUtils.drawDiamond(shapes, tmp.x, tmp.y - Tile.SUBTILE_HEIGHT50, Tile.SUBTILE_WIDTH, Tile.SUBTILE_HEIGHT); + } + shapes.set(ShapeRenderer.ShapeType.Filled); shapes.setColor(Color.GREEN); shapes.rect(vec2.x - 0.5f, vec2.y - 0.5f, 1, 1); @@ -194,7 +207,8 @@ public class CameraTool extends ApplicationAdapter { .append("iso:").append('\n') .append("pos:").append('\n') .append("cursor:").append('\n') - .append("px:").append('\n'); + .append("px:").append('\n') + .append("near:").append('\n'); GlyphLayout layout = font.draw(batch, builder.toString(), 0, Gdx.graphics.getHeight()); width = layout.width; builder.setLength(0); @@ -202,7 +216,8 @@ public class CameraTool extends ApplicationAdapter { .append(iso.position).append('\n') .append(pos).append('\n') .append(loc).append('\n') - .append(vec2).append('\n'); + .append(vec2).append('\n') + .append(near).append('\n'); font.draw(batch, builder.toString(), width, Gdx.graphics.getHeight()); batch.end(); }