diff --git a/core/src/com/saltosion/gladiator/GladiatorBrawler.java b/core/src/com/saltosion/gladiator/GladiatorBrawler.java index af3d223..9f75754 100644 --- a/core/src/com/saltosion/gladiator/GladiatorBrawler.java +++ b/core/src/com/saltosion/gladiator/GladiatorBrawler.java @@ -54,6 +54,17 @@ public class GladiatorBrawler extends ApplicationAdapter { engine.update(Gdx.graphics.getDeltaTime()); } + @Override + public void resize(int width, int height) { + super.resize(width, height); + RenderingSystem rs = engine.getSystem(RenderingSystem.class); + float aspectratio = ((float)width)/((float)height); + rs.setViewport((int)(rs.VPHEIGHT_CONST*aspectratio), rs.VPHEIGHT_CONST); + System.out.println(width + "x" + height); + System.out.println(aspectratio); + System.out.println(rs.VPHEIGHT_CONST + "x" + rs.VPHEIGHT_CONST*aspectratio); + } + public void initializePlayer() { player = new Entity(); diff --git a/core/src/com/saltosion/gladiator/systems/RenderingSystem.java b/core/src/com/saltosion/gladiator/systems/RenderingSystem.java index cdeac41..12987ea 100644 --- a/core/src/com/saltosion/gladiator/systems/RenderingSystem.java +++ b/core/src/com/saltosion/gladiator/systems/RenderingSystem.java @@ -20,6 +20,7 @@ public class RenderingSystem extends EntitySystem { private SpriteBatch batch; private OrthographicCamera camera; + public final int VPHEIGHT_CONST = 252; @Override public void addedToEngine(Engine engine) { @@ -27,7 +28,11 @@ public class RenderingSystem extends EntitySystem { batch = new SpriteBatch(); camera = new OrthographicCamera(); - camera.setToOrtho(false, 384, 216); + camera.setToOrtho(false, 448, 252); + } + + public void setViewport(int width, int height) { + camera.setToOrtho(false, width, height); } @Override