summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/screens
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-12-28 20:09:48 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-12-28 20:09:48 +0100
commitda40130331b292b6b4a143959fe111a9312d8f9d (patch)
treecc5d3e82c393063f91211d5afdb98fa8529f5065 /core/src/ch/asynk/tankontank/screens
parentd162488fc655cf55bcf7399ecdb4df8b900694c6 (diff)
downloadRustAndDust-da40130331b292b6b4a143959fe111a9312d8f9d.zip
RustAndDust-da40130331b292b6b4a143959fe111a9312d8f9d.tar.gz
GameCamera: fix aspect computation
Diffstat (limited to 'core/src/ch/asynk/tankontank/screens')
-rw-r--r--core/src/ch/asynk/tankontank/screens/GameCamera.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/screens/GameCamera.java b/core/src/ch/asynk/tankontank/screens/GameCamera.java
index 14c308b..462745c 100644
--- a/core/src/ch/asynk/tankontank/screens/GameCamera.java
+++ b/core/src/ch/asynk/tankontank/screens/GameCamera.java
@@ -40,13 +40,14 @@ public class GameCamera extends OrthographicCamera
float viewportAspect = (viewportWidth / viewportHeight);
float aspect = (screenWidth / (float) screenHeight);
+ float diff = (viewportAspect - aspect);
- if ((viewportAspect - aspect) < ZEROF) {
+ if (diff < -ZEROF) {
screen.width = (screenHeight * viewportAspect);
screen.height = screenHeight;
screen.x = ((screenWidth - screen.width) / 2f);
screen.y = 0f;
- } else {
+ } else if (diff > ZEROF) {
screen.width = screenWidth;
screen.height = (screenWidth / viewportAspect);
screen.x = 0f;