summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-01-06 11:50:34 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-01-06 11:50:34 +0100
commit626dd256d06ae65328065a4bb3e8590fb6cd4d99 (patch)
tree1dc3ee0f4979fd592f784807d3385e47ff5fff66 /core/src/ch
parente4868aebea74bba5ded8d1ec9972d85bb96dd109 (diff)
downloadRustAndDust-626dd256d06ae65328065a4bb3e8590fb6cd4d99.zip
RustAndDust-626dd256d06ae65328065a4bb3e8590fb6cd4d99.tar.gz
GameCamera: compute viewportAspect at object construction
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/tankontank/screens/GameCamera.java3
1 files changed, 2 insertions, 1 deletions
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);