mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Fjerner unødvendig kode fra LoadingScreen
This commit is contained in:
parent
fc7fd6fa12
commit
d24eb1aa64
@ -17,8 +17,6 @@ public class LoadingScreen extends AbstractScreen {
|
|||||||
private final OrthographicCamera camera;
|
private final OrthographicCamera camera;
|
||||||
private final Viewport viewport;
|
private final Viewport viewport;
|
||||||
|
|
||||||
private GameState initialGameState;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new loading screen
|
* Instantiates a new loading screen
|
||||||
* @param roboRallyWrapper The Robo Rally wrapper which is parent of this screen
|
* @param roboRallyWrapper The Robo Rally wrapper which is parent of this screen
|
||||||
@ -30,8 +28,6 @@ public class LoadingScreen extends AbstractScreen {
|
|||||||
viewport = new ExtendViewport(applicationWidth, applicationHeight, camera);
|
viewport = new ExtendViewport(applicationWidth, applicationHeight, camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
|
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
|
||||||
@ -40,20 +36,24 @@ public class LoadingScreen extends AbstractScreen {
|
|||||||
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
||||||
|
|
||||||
roboRallyWrapper.batch.begin();
|
roboRallyWrapper.batch.begin();
|
||||||
roboRallyWrapper.font.draw(roboRallyWrapper.batch, "Loading...", applicationWidth/2f-380/2f,
|
roboRallyWrapper.font.draw(roboRallyWrapper.batch, "Loading...", applicationWidth / 2f - 380 / 2f,
|
||||||
applicationHeight / 2f,380, 1, true);
|
applicationHeight / 2f,380, 1, true);
|
||||||
roboRallyWrapper.batch.end();
|
roboRallyWrapper.batch.end();
|
||||||
|
|
||||||
//if (roboRallyWrapper.roboRallyGame != null){
|
if (roboRallyWrapper.roboRallyGame != null) {
|
||||||
// System.out.println(roboRallyWrapper.roboRallyGame.getGameState());
|
GameState gameState = roboRallyWrapper.roboRallyGame.getGameState();
|
||||||
//}
|
if (gameState != GameState.LOADING) {
|
||||||
if (roboRallyWrapper.roboRallyGame != null && roboRallyWrapper.roboRallyGame.getGameState() != GameState.LOADING) {
|
handleScreenChange(gameState);
|
||||||
handleScreenChange();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleScreenChange() {
|
/**
|
||||||
switch (roboRallyWrapper.roboRallyGame.getGameState()) {
|
* Changes to another screen depending on which state the game is in
|
||||||
|
* @param gameState The current state of the game
|
||||||
|
*/
|
||||||
|
private void handleScreenChange(GameState gameState) {
|
||||||
|
switch (gameState) {
|
||||||
case RUNNING_PROGRAMS:
|
case RUNNING_PROGRAMS:
|
||||||
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper));
|
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper));
|
||||||
break;
|
break;
|
||||||
@ -70,14 +70,4 @@ public class LoadingScreen extends AbstractScreen {
|
|||||||
viewport.update(width, height);
|
viewport.update(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
if (roboRallyWrapper.roboRallyGame == null){
|
|
||||||
initialGameState = GameState.INITIAL_SETUP;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
initialGameState = roboRallyWrapper.roboRallyGame.getGameState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user