summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-05-31 11:54:14 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-05-31 11:54:14 +0200
commitf30a4ef17f9522722a6dd10b4083e2cec5fd1ca2 (patch)
treed2856db52e6e6484d0e95c25f0bdddbf4df2aba2 /core/src
parent239cce546c1660dc8c6cd0c3b83485e7d06106f9 (diff)
downloadgdx-boardgame-f30a4ef17f9522722a6dd10b4083e2cec5fd1ca2.zip
gdx-boardgame-f30a4ef17f9522722a6dd10b4083e2cec5fd1ca2.tar.gz
Camera : add unprojectTranslation()
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/Camera.java6
1 files changed, 6 insertions, 0 deletions
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);