Skip to content

Commit e80bb2a

Browse files
committed
Better aspect calc. in Help screen.
1 parent be5d87d commit e80bb2a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

blade-engine/src/com/bladecoder/engine/ui/HelpScreen.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ public void render(float delta) {
9595
public void resize(int width, int height) {
9696

9797
float aspect = width / height;
98+
float bgAspect = (float)tex.getWidth() / (float)tex.getHeight();
9899

99-
if(aspect < 16f/9f)
100-
viewport.setWorldSize(width, (int)(width * 9f/16f));
100+
if(aspect < bgAspect)
101+
viewport.setWorldSize(width, (int)(width / bgAspect));
101102
else
102-
viewport.setWorldSize((int)(height * 16f/9f), height);
103+
viewport.setWorldSize((int)(height * bgAspect), height);
103104

104105
viewport.update(width, height, true);
105106
}

0 commit comments

Comments
 (0)