mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-25 22:58:54 +07:00
Added debug rendering for toTile50
This commit is contained in:
parent
5acbaa54f1
commit
0414472042
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user