Skip to content
Snippets Groups Projects
Commit 61081550 authored by Karl Aaron Rudkowski's avatar Karl Aaron Rudkowski
Browse files

fitviewports

parent f5e49831
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
/**
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment