diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-30 17:11:58 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-30 17:11:58 +0200 |
commit | 6d4c18b1d6b83a58ccd739586ba5d1e7b9421be0 (patch) | |
tree | e380aa289c02bb0bff4f818978818ee43d8f5851 /core/src/ch/asynk | |
parent | b85879c878bbf7cae47f1ab2722af7e07f00dd93 (diff) | |
download | RustAndDust-6d4c18b1d6b83a58ccd739586ba5d1e7b9421be0.zip RustAndDust-6d4c18b1d6b83a58ccd739586ba5d1e7b9421be0.tar.gz |
GameScreen: screenToViewport -> screenToWorld
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/tankontank/screens/GameScreen.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java index 371eaa7..764ff37 100644 --- a/core/src/ch/asynk/tankontank/screens/GameScreen.java +++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java @@ -62,7 +62,7 @@ public class GameScreen implements Screen private Label fps; private Stage hud; - private Vector2 screenToViewport = new Vector2(); // ratio + private Vector2 screenToWorld = new Vector2(); // ratio private Vector3 touchPos = new Vector3(); // world coordinates private Vector2 dragPos = new Vector2(); // screen coordinates @@ -140,8 +140,8 @@ public class GameScreen implements Screen @Override public boolean touchDragged(int x, int y, int pointer) { - float deltaX = ((x - dragPos.x) * cam.zoom * screenToViewport.x); - float deltaY = ((dragPos.y - y) * cam.zoom * screenToViewport.y); + float deltaX = ((x - dragPos.x) * cam.zoom * screenToWorld.x); + float deltaY = ((dragPos.y - y) * cam.zoom * screenToWorld.y); dragPos.set(x, y); if (map.drag(deltaX, deltaY)) { unproject(x, y, touchPos); @@ -238,7 +238,7 @@ public class GameScreen implements Screen maxZoomOut = Math.min((map.getWidth() / cam.viewportWidth), (map.getHeight() / cam.viewportHeight)); cam.zoom = MathUtils.clamp(cam.zoom, ZOOM_IN_MAX, maxZoomOut); - screenToViewport.set((cam.viewportWidth / width), (cam.viewportHeight / height)); + screenToWorld.set((cam.viewportWidth / width), (cam.viewportHeight / height)); } @Override |