From 7ae570c772041c071ac78a58c0ebe0d92ad200df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 3 Oct 2018 15:58:55 +0200 Subject: Camera : fix hudInBoard logic --- core/src/ch/asynk/gdx/tabletop/Camera.java | 12 ++++++------ 1 file 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; -- cgit v1.1-2-g2b99