diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-10-03 15:58:55 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-10-03 15:58:55 +0200 |
commit | 7ae570c772041c071ac78a58c0ebe0d92ad200df (patch) | |
tree | 9c2e04d3098fad710d43f3a54b4054db9699b45f | |
parent | bbf725c026a81881a6d810237253549ff2e6e703 (diff) | |
download | gdx-boardgame-7ae570c772041c071ac78a58c0ebe0d92ad200df.zip gdx-boardgame-7ae570c772041c071ac78a58c0ebe0d92ad200df.tar.gz |
Camera : fix hudInBoard logic
-rw-r--r-- | core/src/ch/asynk/gdx/tabletop/Camera.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/src/ch/asynk/gdx/tabletop/Camera.java b/core/src/ch/asynk/gdx/tabletop/Camera.java index bcee9e1..5d47b81 100644 --- a/core/src/ch/asynk/gdx/tabletop/Camera.java +++ b/core/src/ch/asynk/gdx/tabletop/Camera.java @@ -93,13 +93,13 @@ public class Camera extends OrthographicCamera } if (hudInBoard) { + hud.width = (viewport.width - (2 * hud.x)); + hud.height = (viewport.height - (2 * hud.y)); + } else { hud.x = 0; hud.y = 0; hud.width = screenWidth; hud.height = screenHeight; - } else { - hud.width = (viewport.width - (2 * hud.x)); - hud.height = (viewport.height - (2 * hud.y)); } // ratio viewport -> camera @@ -122,9 +122,9 @@ public class Camera extends OrthographicCamera public void applyHudViewport() { if (hudInBoard) - HdpiUtils.glViewport(0, 0, screenWidth, screenHeight); - else applyBoardViewport(); + else + HdpiUtils.glViewport(0, 0, screenWidth, screenHeight); } public void centerOnWorld() @@ -181,7 +181,7 @@ public class Camera extends OrthographicCamera public void unprojectHud(float x, float y, Vector3 v) { - Rectangle r = (hudInBoard ? hud : viewport); + Rectangle r = (hudInBoard ? viewport : hud); x = x - r.x; y = screenHeight - y - 1; y = y - r.y; |