mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-11 11:27:16 +07:00
Added support for isometric offsets
This commit is contained in:
parent
eaf97baf6e
commit
a7682d8743
@ -28,7 +28,7 @@ public class IsometricCamera extends OrthographicCamera {
|
||||
public void translate(float x, float y) {
|
||||
position.add(x, y);
|
||||
toScreen(position.x, position.y, tmp);
|
||||
super.position.set(tmp, 0);
|
||||
super.position.set(tmp, 0).add(offset.x, offset.y, 0);
|
||||
}
|
||||
|
||||
public void set(Vector2 vec) {
|
||||
@ -38,7 +38,7 @@ public class IsometricCamera extends OrthographicCamera {
|
||||
public void set(float x, float y) {
|
||||
position.set(x, y);
|
||||
toScreen(position.x, position.y, tmp);
|
||||
super.position.set(tmp.x, tmp.y, 0);
|
||||
super.position.set(tmp.x, tmp.y, 0).add(offset.x, offset.y, 0);
|
||||
}
|
||||
|
||||
public Vector2 toScreen(Vector2 worldCoords) {
|
||||
@ -54,9 +54,6 @@ public class IsometricCamera extends OrthographicCamera {
|
||||
}
|
||||
|
||||
public Vector2 toWorld(float x, float y, Vector2 dst) {
|
||||
x += offset.x;
|
||||
y += offset.y;
|
||||
//y += offset.y;
|
||||
x /= Tile.SUBTILE_WIDTH50;
|
||||
y /= Tile.SUBTILE_HEIGHT50;
|
||||
dst.x = ( x - y) / 2;
|
||||
|
@ -53,7 +53,7 @@ public class CameraTool extends ApplicationAdapter {
|
||||
idt.set(shapes.getProjectionMatrix());
|
||||
|
||||
iso.setToOrtho(false);
|
||||
//iso.offset(0, -Tile.SUBTILE_HEIGHT50);
|
||||
iso.offset(0, -Tile.SUBTILE_HEIGHT50);
|
||||
iso.set(0, 0);
|
||||
|
||||
Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
|
||||
|
Loading…
Reference in New Issue
Block a user