From 626dd256d06ae65328065a4bb3e8590fb6cd4d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 6 Jan 2015 11:50:34 +0100 Subject: GameCamera: compute viewportAspect at object construction --- core/src/ch/asynk/tankontank/screens/GameCamera.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/ch/asynk/tankontank/screens/GameCamera.java b/core/src/ch/asynk/tankontank/screens/GameCamera.java index eb54b1a..94b31c0 100644 --- a/core/src/ch/asynk/tankontank/screens/GameCamera.java +++ b/core/src/ch/asynk/tankontank/screens/GameCamera.java @@ -17,6 +17,7 @@ public class GameCamera extends OrthographicCamera private int screenHeight; private float zoomOut; private float zoomIn; + private float viewportAspect; private float widthFactor; private float heightFactor; private Rectangle window; @@ -28,6 +29,7 @@ public class GameCamera extends OrthographicCamera super(virtualWidth, virtualHeight); this.zoomOut = zoomOut; this.zoomIn = zoomIn; + this.viewportAspect = (viewportWidth / viewportHeight); this.window = new Rectangle(); this.hudMatrix = new Matrix4(); this.hudInvProjMatrix = new Matrix4(); @@ -38,7 +40,6 @@ public class GameCamera extends OrthographicCamera this.screenWidth = screenWidth; this.screenHeight = screenHeight; - float viewportAspect = (viewportWidth / viewportHeight); float aspect = (screenWidth / (float) screenHeight); float diff = (viewportAspect - aspect); -- cgit v1.1-2-g2b99