diff --git a/forge-gui-mobile/src/forge/Forge.java b/forge-gui-mobile/src/forge/Forge.java index 79cda06a27e..4090e7cb3d8 100644 --- a/forge-gui-mobile/src/forge/Forge.java +++ b/forge-gui-mobile/src/forge/Forge.java @@ -164,6 +164,9 @@ public class Forge implements ApplicationListener { frameRate = new FrameRate(); animationBatch = new SpriteBatch(); inputProcessor = new MainInputProcessor(); + //screenWidth and screenHeight should be set initially and only change upon restarting the app + screenWidth = Gdx.app.getGraphics().getWidth(); + screenHeight = Gdx.app.getGraphics().getHeight(); Gdx.input.setInputProcessor(inputProcessor); /* @@ -958,15 +961,15 @@ public class Forge implements ApplicationListener { @Override public void resize(int width, int height) { try { - screenWidth = width; - screenHeight = height; if (currentScreen != null) { currentScreen.setSize(width, height); } else if (splashScreen != null) { splashScreen.setSize(width, height); } + if (currentScene != null) + currentScene.resize(width, height); } catch (Exception ex) { - graphics.end(); + //graphics.end(); //check if sentry is enabled, if not it will call the gui interface but here we end the graphics so we only send it via sentry.. if (BugReporter.isSentryEnabled()) BugReporter.reportException(ex); diff --git a/forge-gui-mobile/src/forge/adventure/scene/Scene.java b/forge-gui-mobile/src/forge/adventure/scene/Scene.java index 781ddb002ac..2e84eaf364d 100644 --- a/forge-gui-mobile/src/forge/adventure/scene/Scene.java +++ b/forge-gui-mobile/src/forge/adventure/scene/Scene.java @@ -93,6 +93,9 @@ public abstract class Scene implements Disposable { public void updateInput() { } + public void resize(int width, int height) { + + } } diff --git a/forge-gui-mobile/src/forge/adventure/scene/UIScene.java b/forge-gui-mobile/src/forge/adventure/scene/UIScene.java index f353ef13ddf..887f18f9b6f 100644 --- a/forge-gui-mobile/src/forge/adventure/scene/UIScene.java +++ b/forge-gui-mobile/src/forge/adventure/scene/UIScene.java @@ -192,7 +192,6 @@ public class UIScene extends Scene { } public UIScene(String uiFilePath) { - uiFile = uiFilePath; stage = new Stage(new ScalingViewport(Scaling.stretch, getIntendedWidth(), getIntendedHeight())) { @Override @@ -711,4 +710,9 @@ public class UIScene extends Scene { super.updateInput(); Gdx.input.setInputProcessor(stage); } + + @Override + public void resize(int width, int height) { + stage.getViewport().update(width, height, true); + } }