From 6d4c18b1d6b83a58ccd739586ba5d1e7b9421be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 30 Sep 2014 17:11:58 +0200 Subject: GameScreen: screenToViewport -> screenToWorld --- core/src/ch/asynk/tankontank/screens/GameScreen.java | 8 ++++---- 1 file 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 -- cgit v1.1-2-g2b99