From f30a4ef17f9522722a6dd10b4083e2cec5fd1ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 31 May 2020 11:54:14 +0200 Subject: Camera : add unprojectTranslation() --- core/src/ch/asynk/gdx/boardgame/Camera.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/ch/asynk/gdx/boardgame/Camera.java b/core/src/ch/asynk/gdx/boardgame/Camera.java index 5140538..d72f15c 100644 --- a/core/src/ch/asynk/gdx/boardgame/Camera.java +++ b/core/src/ch/asynk/gdx/boardgame/Camera.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.glutils.HdpiUtils; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.math.Rectangle; +import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Matrix4; @@ -179,6 +180,11 @@ public class Camera extends OrthographicCamera } } + public void unprojectTranslation(int dx, int dy, Vector2 v) + { + v.set((dx * zoom * widthFactor), (-dy * zoom * heightFactor)); + } + public void unproject(int x, int y, Vector3 v) { unproject(v.set(x, y, 0), viewport.x, viewport.y, viewport.width, viewport.height); -- cgit v1.1-2-g2b99