diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/MainMenu.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/MainMenu.java index 119360f0a2439369382245467c6c6ff3911f7a33..cdf492e871d9c500d0355c927b43d57d538f9f0b 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/MainMenu.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/MainMenu.java @@ -5,6 +5,8 @@ import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.utils.viewport.FitViewport; +import com.badlogic.gdx.utils.viewport.Viewport; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons.NewGameButton; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.MenuButtons.QuitButton; @@ -20,6 +22,8 @@ public class MainMenu implements Screen { private Stage stage; + private Viewport viewport; + private NewGameButton newGame; private QuitButton quit; @@ -30,7 +34,8 @@ public class MainMenu implements Screen { newGame = new NewGameButton(main.WIDTH/2 - 124, main.HEIGHT/2 - 25, 248, 50, this); quit = new QuitButton(main.WIDTH/2 - 75 , main.HEIGHT/2 - 100 - 25, 248, 50, this); - stage = new Stage(); + viewport = new FitViewport(main.WIDTH, main.HEIGHT); + stage = new Stage(viewport); stage.addActor(quit); stage.addActor(newGame); @@ -67,7 +72,7 @@ public class MainMenu implements Screen { */ @Override public void resize(int width, int height) { - + viewport.update(width, height); } /** diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/ShipSelector.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/ShipSelector.java index 82438ff5800f68acdd75599455ed17a8c0b3905e..8f35a81b4c9a36af6fc95ec6ad7d5fdd50d42e51 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/ShipSelector.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/ShipSelector.java @@ -5,6 +5,8 @@ import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.utils.viewport.FitViewport; +import com.badlogic.gdx.utils.viewport.Viewport; import com.galaxytrucker.galaxytruckerreloaded.Controller.HangerController; import com.galaxytrucker.galaxytruckerreloaded.Main; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.CreateGameButton; @@ -56,6 +58,8 @@ public class ShipSelector implements Screen { private HangerController controller; + private Viewport viewport; + /** Constructor * @param main - main class */ public ShipSelector(Main main){ @@ -65,7 +69,8 @@ public class ShipSelector implements Screen { background = new Texture("1080p.png"); - stage = new Stage(); + viewport = new FitViewport(main.WIDTH, main.HEIGHT); + stage = new Stage(viewport); singlePlayerButton = new SinglePlayerButton(main.WIDTH-100, main.HEIGHT-100, 248, 50, this); stage.addActor(singlePlayerButton); @@ -99,7 +104,7 @@ public class ShipSelector implements Screen { @Override public void resize(int width, int height) { - + viewport.update(width, height); } @Override