mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Forenkler skjermer og fjerner en bug som gjorde at knapper hang fast
This commit is contained in:
parent
8676434326
commit
5f3c84e842
@ -21,6 +21,7 @@ public class ScreenManager {
|
|||||||
private LobbyScreen lobbyScreen;
|
private LobbyScreen lobbyScreen;
|
||||||
private WinnerScreen winnerScreen;
|
private WinnerScreen winnerScreen;
|
||||||
private CardChoiceScreen cardChoiceScreen;
|
private CardChoiceScreen cardChoiceScreen;
|
||||||
|
private PowerDownScreen powerDownScreen;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a new instance of the card choice screen
|
* Gets a new instance of the card choice screen
|
||||||
@ -66,7 +67,10 @@ public class ScreenManager {
|
|||||||
* @return A power down screen instance
|
* @return A power down screen instance
|
||||||
*/
|
*/
|
||||||
public synchronized PowerDownScreen getPowerDownScreen(RoboRallyWrapper roboRallyWrapper) {
|
public synchronized PowerDownScreen getPowerDownScreen(RoboRallyWrapper roboRallyWrapper) {
|
||||||
return new PowerDownScreen(roboRallyWrapper);
|
if (this.powerDownScreen == null) {
|
||||||
|
this.powerDownScreen = new PowerDownScreen(roboRallyWrapper);
|
||||||
|
}
|
||||||
|
return this.powerDownScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package inf112.fiasko.roborally.gamewrapper.screens;
|
package inf112.fiasko.roborally.gamewrapper.screens;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Screen;
|
import com.badlogic.gdx.Screen;
|
||||||
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
|
import com.badlogic.gdx.utils.viewport.Viewport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class overrides methods of screens which are often unused
|
* This class overrides methods of screens which are often unused
|
||||||
@ -9,9 +14,14 @@ public abstract class AbstractScreen implements Screen {
|
|||||||
protected final int applicationWidth = 600;
|
protected final int applicationWidth = 600;
|
||||||
protected final int applicationHeight = 800;
|
protected final int applicationHeight = 800;
|
||||||
|
|
||||||
|
protected OrthographicCamera camera;
|
||||||
|
protected Viewport viewport;
|
||||||
|
protected Stage stage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
//Nothing to do
|
Gdx.input.setInputProcessor(stage);
|
||||||
|
stage.cancelTouchFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -31,6 +41,20 @@ public abstract class AbstractScreen implements Screen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
//Nothing to do
|
stage.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resize(int width, int height) {
|
||||||
|
viewport.update(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(float delta) {
|
||||||
|
Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
|
||||||
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
camera.update();
|
||||||
|
stage.draw();
|
||||||
|
stage.act();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,6 @@ public class BoardActiveScreen extends AbstractScreen implements InputProcessor
|
|||||||
drawBoard(roboRallyWrapper.batch);
|
drawBoard(roboRallyWrapper.batch);
|
||||||
roboRallyWrapper.batch.end();
|
roboRallyWrapper.batch.end();
|
||||||
|
|
||||||
// Checks if there has been found a winning player and then changes the screen to display the winning screen
|
|
||||||
switch (roboRallyWrapper.roboRallyGame.getGameState()) {
|
switch (roboRallyWrapper.roboRallyGame.getGameState()) {
|
||||||
case GAME_IS_WON:
|
case GAME_IS_WON:
|
||||||
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getWinnerScreen(roboRallyWrapper));
|
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getWinnerScreen(roboRallyWrapper));
|
||||||
@ -211,8 +210,8 @@ public class BoardActiveScreen extends AbstractScreen implements InputProcessor
|
|||||||
if (lastFlagVisited > 0) {
|
if (lastFlagVisited > 0) {
|
||||||
TileType flagType = TileType.getTileTypeFromID(robot.getLastFlagVisited() + 16);
|
TileType flagType = TileType.getTileTypeFromID(robot.getLastFlagVisited() + 16);
|
||||||
TextureRegion flagRegion = TextureConverterUtil.convertElement(new Tile(flagType, Direction.NORTH));
|
TextureRegion flagRegion = TextureConverterUtil.convertElement(new Tile(flagType, Direction.NORTH));
|
||||||
batch.draw(flagRegion.getTexture(), viewPortWidth + 64, 128 * (index - 1), 64/2,
|
batch.draw(flagRegion.getTexture(), viewPortWidth + 64, 128 * (index - 1), 64 / 2,
|
||||||
64/2, 64, 64, 1, 1, 0, flagRegion.getRegionX(),
|
64 / 2, 64, 64, 1, 1, 0, flagRegion.getRegionX(),
|
||||||
flagRegion.getRegionY(), flagRegion.getRegionWidth(), flagRegion.getRegionWidth(),
|
flagRegion.getRegionY(), flagRegion.getRegionWidth(), flagRegion.getRegionWidth(),
|
||||||
false, false);
|
false, false);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +149,7 @@ public class CardChoiceScreen extends InputAdapter implements Screen {
|
|||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
Gdx.input.setInputProcessor(inputMultiplexer);
|
Gdx.input.setInputProcessor(inputMultiplexer);
|
||||||
|
stage.cancelTouchFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -166,6 +167,7 @@ public class CardChoiceScreen extends InputAdapter implements Screen {
|
|||||||
renderCardText();
|
renderCardText();
|
||||||
roboRallyWrapper.batch.end();
|
roboRallyWrapper.batch.end();
|
||||||
stage.draw();
|
stage.draw();
|
||||||
|
stage.act();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -268,7 +270,7 @@ public class CardChoiceScreen extends InputAdapter implements Screen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
//Nothing to do
|
stage.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,9 +24,6 @@ import java.io.IOException;
|
|||||||
public class IPAddressScreen extends AbstractScreen {
|
public class IPAddressScreen extends AbstractScreen {
|
||||||
private final RoboRallyWrapper roboRallyWrapper;
|
private final RoboRallyWrapper roboRallyWrapper;
|
||||||
|
|
||||||
private final OrthographicCamera camera;
|
|
||||||
private final Viewport viewport;
|
|
||||||
private final Stage stage;
|
|
||||||
private TextField textInput;
|
private TextField textInput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,9 +76,7 @@ public class IPAddressScreen extends AbstractScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
|
super.render(delta);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
||||||
camera.update();
|
|
||||||
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
||||||
|
|
||||||
roboRallyWrapper.batch.begin();
|
roboRallyWrapper.batch.begin();
|
||||||
@ -89,11 +84,6 @@ public class IPAddressScreen extends AbstractScreen {
|
|||||||
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 100, 380, 1,
|
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 100, 380, 1,
|
||||||
true);
|
true);
|
||||||
roboRallyWrapper.batch.end();
|
roboRallyWrapper.batch.end();
|
||||||
stage.draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resize(int width, int height) {
|
|
||||||
viewport.update(width, height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ package inf112.fiasko.roborally.gamewrapper.screens;
|
|||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
import com.badlogic.gdx.utils.viewport.ExtendViewport;
|
import com.badlogic.gdx.utils.viewport.ExtendViewport;
|
||||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
|
||||||
import inf112.fiasko.roborally.elementproperties.GameState;
|
import inf112.fiasko.roborally.elementproperties.GameState;
|
||||||
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
|
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
|
||||||
import inf112.fiasko.roborally.networking.containers.ProgramAndPowerdownRequest;
|
import inf112.fiasko.roborally.networking.containers.ProgramAndPowerdownRequest;
|
||||||
@ -17,9 +17,6 @@ import java.util.ArrayList;
|
|||||||
public class LoadingScreen extends AbstractScreen {
|
public class LoadingScreen extends AbstractScreen {
|
||||||
private final RoboRallyWrapper roboRallyWrapper;
|
private final RoboRallyWrapper roboRallyWrapper;
|
||||||
|
|
||||||
private final OrthographicCamera camera;
|
|
||||||
private final Viewport viewport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new loading screen
|
* Instantiates a new loading screen
|
||||||
*
|
*
|
||||||
@ -30,6 +27,7 @@ public class LoadingScreen extends AbstractScreen {
|
|||||||
camera = new OrthographicCamera();
|
camera = new OrthographicCamera();
|
||||||
camera.setToOrtho(false, applicationWidth, applicationHeight);
|
camera.setToOrtho(false, applicationWidth, applicationHeight);
|
||||||
viewport = new ExtendViewport(applicationWidth, applicationHeight, camera);
|
viewport = new ExtendViewport(applicationWidth, applicationHeight, camera);
|
||||||
|
stage = new Stage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,9 +83,4 @@ public class LoadingScreen extends AbstractScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resize(int width, int height) {
|
|
||||||
viewport.update(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package inf112.fiasko.roborally.gamewrapper.screens;
|
package inf112.fiasko.roborally.gamewrapper.screens;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
||||||
@ -11,7 +10,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.SelectBox;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
import com.badlogic.gdx.utils.viewport.FitViewport;
|
||||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
|
||||||
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
|
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
|
||||||
import inf112.fiasko.roborally.gamewrapper.SimpleButton;
|
import inf112.fiasko.roborally.gamewrapper.SimpleButton;
|
||||||
import inf112.fiasko.roborally.networking.containers.GameStartInfoResponse;
|
import inf112.fiasko.roborally.networking.containers.GameStartInfoResponse;
|
||||||
@ -28,10 +26,6 @@ import java.util.Map;
|
|||||||
public class LobbyScreen extends AbstractScreen {
|
public class LobbyScreen extends AbstractScreen {
|
||||||
private final RoboRallyWrapper roboRallyWrapper;
|
private final RoboRallyWrapper roboRallyWrapper;
|
||||||
|
|
||||||
private final OrthographicCamera camera;
|
|
||||||
private final Viewport viewport;
|
|
||||||
private final Stage stage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new lobby screen
|
* Instantiates a new lobby screen
|
||||||
*
|
*
|
||||||
@ -49,23 +43,21 @@ public class LobbyScreen extends AbstractScreen {
|
|||||||
camera.setToOrtho(false, applicationWidth, applicationHeight);
|
camera.setToOrtho(false, applicationWidth, applicationHeight);
|
||||||
|
|
||||||
|
|
||||||
Skin skin=new Skin(Gdx.files.internal("uiskin.json"));
|
Skin skin = new Skin(Gdx.files.internal("uiskin.json"));
|
||||||
|
|
||||||
Dialog dialog = new Dialog("Setting", skin);
|
Dialog dialog = new Dialog("Setting", skin);
|
||||||
|
|
||||||
|
|
||||||
final SelectBox<String> selectBox= new SelectBox<>(skin);
|
final SelectBox<String> selectBox = new SelectBox<>(skin);
|
||||||
selectBox.setItems("Dizzy_Dash","Checkmate","Risky_Exchange");
|
selectBox.setItems("Dizzy_Dash", "Checkmate", "Risky_Exchange");
|
||||||
selectBox.setPosition(Gdx.graphics.getWidth()/2f-100,Gdx.graphics.getHeight()/2f-100);
|
selectBox.setPosition(Gdx.graphics.getWidth() / 2f - 100, Gdx.graphics.getHeight() / 2f - 100);
|
||||||
selectBox.setSize(200,50);
|
selectBox.setSize(200, 50);
|
||||||
|
|
||||||
dialog.getContentTable().defaults().pad(10);
|
dialog.getContentTable().defaults().pad(10);
|
||||||
dialog.getContentTable().add(selectBox);
|
dialog.getContentTable().add(selectBox);
|
||||||
|
|
||||||
|
|
||||||
stage.addActor(selectBox);
|
stage.addActor(selectBox);
|
||||||
|
|
||||||
|
|
||||||
startGameButton.addListener(new InputListener() {
|
startGameButton.addListener(new InputListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
|
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
|
||||||
@ -74,7 +66,7 @@ public class LobbyScreen extends AbstractScreen {
|
|||||||
List<Player> playerList = IOUtil.playerGenerator(playerNames,
|
List<Player> playerList = IOUtil.playerGenerator(playerNames,
|
||||||
roboRallyWrapper.server.getRobotID());
|
roboRallyWrapper.server.getRobotID());
|
||||||
for (Connection connection : playerNames.keySet()) {
|
for (Connection connection : playerNames.keySet()) {
|
||||||
roboRallyWrapper.server.sendToClient(connection, new GameStartInfoResponse(selectBox.getSelected()+".txt"
|
roboRallyWrapper.server.sendToClient(connection, new GameStartInfoResponse(selectBox.getSelected() + ".txt"
|
||||||
, playerList, playerNames.get(connection)));
|
, playerList, playerNames.get(connection)));
|
||||||
}
|
}
|
||||||
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getLoadingScreen(roboRallyWrapper));
|
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getLoadingScreen(roboRallyWrapper));
|
||||||
@ -85,16 +77,9 @@ public class LobbyScreen extends AbstractScreen {
|
|||||||
stage.setViewport(viewport);
|
stage.setViewport(viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
Gdx.input.setInputProcessor(stage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
|
super.render(delta);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
||||||
camera.update();
|
|
||||||
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
||||||
|
|
||||||
roboRallyWrapper.batch.begin();
|
roboRallyWrapper.batch.begin();
|
||||||
@ -106,14 +91,6 @@ public class LobbyScreen extends AbstractScreen {
|
|||||||
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 100, 380, 1,
|
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 100, 380, 1,
|
||||||
true);
|
true);
|
||||||
roboRallyWrapper.batch.end();
|
roboRallyWrapper.batch.end();
|
||||||
stage.draw();
|
|
||||||
stage.act();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resize(int width, int height) {
|
|
||||||
viewport.update(width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package inf112.fiasko.roborally.gamewrapper.screens;
|
package inf112.fiasko.roborally.gamewrapper.screens;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
import com.badlogic.gdx.utils.viewport.FitViewport;
|
||||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
|
||||||
import inf112.fiasko.roborally.elementproperties.GameState;
|
import inf112.fiasko.roborally.elementproperties.GameState;
|
||||||
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
|
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
|
||||||
import inf112.fiasko.roborally.gamewrapper.SimpleButton;
|
import inf112.fiasko.roborally.gamewrapper.SimpleButton;
|
||||||
@ -20,9 +17,6 @@ import inf112.fiasko.roborally.networking.containers.ProgramAndPowerdownRequest;
|
|||||||
public class PowerDownScreen extends AbstractScreen {
|
public class PowerDownScreen extends AbstractScreen {
|
||||||
private final RoboRallyWrapper roboRallyWrapper;
|
private final RoboRallyWrapper roboRallyWrapper;
|
||||||
|
|
||||||
private final OrthographicCamera camera;
|
|
||||||
private final Viewport viewport;
|
|
||||||
private final Stage stage;
|
|
||||||
private long startTime;
|
private long startTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,7 +35,6 @@ public class PowerDownScreen extends AbstractScreen {
|
|||||||
powerDownButton.setX(applicationWidth / 2f - powerDownButton.getWidth() / 2f);
|
powerDownButton.setX(applicationWidth / 2f - powerDownButton.getWidth() / 2f);
|
||||||
this.roboRallyWrapper = roboRallyWrapper;
|
this.roboRallyWrapper = roboRallyWrapper;
|
||||||
camera.setToOrtho(false, applicationWidth, applicationHeight);
|
camera.setToOrtho(false, applicationWidth, applicationHeight);
|
||||||
startTime = System.currentTimeMillis();
|
|
||||||
powerDownButton.addListener(new InputListener() {
|
powerDownButton.addListener(new InputListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
|
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
|
||||||
@ -51,11 +44,15 @@ public class PowerDownScreen extends AbstractScreen {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
super.show();
|
||||||
|
startTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
|
super.render(delta);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
||||||
camera.update();
|
|
||||||
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
||||||
String descriptionText;
|
String descriptionText;
|
||||||
if (roboRallyWrapper.roboRallyGame.getGameState() == GameState.CHOOSING_POWER_DOWN) {
|
if (roboRallyWrapper.roboRallyGame.getGameState() == GameState.CHOOSING_POWER_DOWN) {
|
||||||
@ -74,7 +71,6 @@ public class PowerDownScreen extends AbstractScreen {
|
|||||||
applicationWidth / 2f - 40 / 2f, applicationHeight / 2f - 100, 40, 1,
|
applicationWidth / 2f - 40 / 2f, applicationHeight / 2f - 100, 40, 1,
|
||||||
true);
|
true);
|
||||||
roboRallyWrapper.batch.end();
|
roboRallyWrapper.batch.end();
|
||||||
stage.draw();
|
|
||||||
|
|
||||||
if (elapsedTime > 5) {
|
if (elapsedTime > 5) {
|
||||||
sendPowerDownStatus(Boolean.FALSE);
|
sendPowerDownStatus(Boolean.FALSE);
|
||||||
@ -104,15 +100,4 @@ public class PowerDownScreen extends AbstractScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resize(int width, int height) {
|
|
||||||
viewport.update(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
Gdx.input.setInputProcessor(stage);
|
|
||||||
startTime = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package inf112.fiasko.roborally.gamewrapper.screens;
|
package inf112.fiasko.roborally.gamewrapper.screens;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
import com.badlogic.gdx.utils.viewport.FitViewport;
|
||||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
|
||||||
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
|
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
|
||||||
import inf112.fiasko.roborally.gamewrapper.SimpleButton;
|
import inf112.fiasko.roborally.gamewrapper.SimpleButton;
|
||||||
import inf112.fiasko.roborally.networking.RoboRallyClient;
|
import inf112.fiasko.roborally.networking.RoboRallyClient;
|
||||||
@ -22,10 +20,6 @@ import java.io.IOException;
|
|||||||
public class StartMenuScreen extends AbstractScreen {
|
public class StartMenuScreen extends AbstractScreen {
|
||||||
private final RoboRallyWrapper roboRallyWrapper;
|
private final RoboRallyWrapper roboRallyWrapper;
|
||||||
|
|
||||||
private final OrthographicCamera camera;
|
|
||||||
private final Viewport viewport;
|
|
||||||
private final Stage stage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new start menu screen
|
* Instantiates a new start menu screen
|
||||||
*
|
*
|
||||||
@ -87,28 +81,14 @@ public class StartMenuScreen extends AbstractScreen {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
Gdx.input.setInputProcessor(stage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
|
super.render(delta);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
||||||
camera.update();
|
|
||||||
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
||||||
|
|
||||||
roboRallyWrapper.batch.begin();
|
roboRallyWrapper.batch.begin();
|
||||||
roboRallyWrapper.font.draw(roboRallyWrapper.batch, "RoboRally",
|
roboRallyWrapper.font.draw(roboRallyWrapper.batch, "RoboRally",
|
||||||
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 100, 380, 1,
|
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 100, 380, 1,
|
||||||
true);
|
true);
|
||||||
roboRallyWrapper.batch.end();
|
roboRallyWrapper.batch.end();
|
||||||
stage.draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resize(int width, int height) {
|
|
||||||
viewport.update(width, height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
import com.badlogic.gdx.utils.viewport.FitViewport;
|
||||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
|
||||||
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
|
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@ -21,9 +20,6 @@ import javax.swing.*;
|
|||||||
public class UsernameScreen extends AbstractScreen {
|
public class UsernameScreen extends AbstractScreen {
|
||||||
private final RoboRallyWrapper roboRallyWrapper;
|
private final RoboRallyWrapper roboRallyWrapper;
|
||||||
|
|
||||||
private final OrthographicCamera camera;
|
|
||||||
private final Viewport viewport;
|
|
||||||
private final Stage stage;
|
|
||||||
private TextField textInput;
|
private TextField textInput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,9 +86,7 @@ public class UsernameScreen extends AbstractScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
|
super.render(delta);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
||||||
camera.update();
|
|
||||||
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
||||||
|
|
||||||
roboRallyWrapper.batch.begin();
|
roboRallyWrapper.batch.begin();
|
||||||
@ -100,13 +94,6 @@ public class UsernameScreen extends AbstractScreen {
|
|||||||
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 100, 380, 1,
|
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 100, 380, 1,
|
||||||
true);
|
true);
|
||||||
roboRallyWrapper.batch.end();
|
roboRallyWrapper.batch.end();
|
||||||
stage.draw();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resize(int width, int height) {
|
|
||||||
viewport.update(width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,6 @@ import inf112.fiasko.roborally.gamewrapper.SimpleButton;
|
|||||||
public class WinnerScreen extends AbstractScreen {
|
public class WinnerScreen extends AbstractScreen {
|
||||||
private final RoboRallyWrapper roboRallyWrapper;
|
private final RoboRallyWrapper roboRallyWrapper;
|
||||||
|
|
||||||
private final OrthographicCamera camera;
|
|
||||||
private final Viewport viewport;
|
|
||||||
private final Stage stage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new winner screen
|
* Instantiates a new winner screen
|
||||||
*
|
*
|
||||||
@ -50,9 +46,7 @@ public class WinnerScreen extends AbstractScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
|
super.render(delta);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
||||||
camera.update();
|
|
||||||
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
||||||
|
|
||||||
roboRallyWrapper.batch.begin();
|
roboRallyWrapper.batch.begin();
|
||||||
@ -63,17 +57,6 @@ public class WinnerScreen extends AbstractScreen {
|
|||||||
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 150, 380, 1,
|
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 150, 380, 1,
|
||||||
true);
|
true);
|
||||||
roboRallyWrapper.batch.end();
|
roboRallyWrapper.batch.end();
|
||||||
stage.draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resize(int width, int height) {
|
|
||||||
viewport.update(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
Gdx.input.setInputProcessor(stage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -180,7 +180,7 @@ public class Board {
|
|||||||
Robot alternateRobot = getRobotFromDeadRobots(robotID);
|
Robot alternateRobot = getRobotFromDeadRobots(robotID);
|
||||||
if (robots.containsKey(robotID)) {
|
if (robots.containsKey(robotID)) {
|
||||||
robots.get(robotID).setPowerDown(powerDown);
|
robots.get(robotID).setPowerDown(powerDown);
|
||||||
} else if ( alternateRobot != null) {
|
} else if (alternateRobot != null) {
|
||||||
alternateRobot.setPowerDown(powerDown);
|
alternateRobot.setPowerDown(powerDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,7 +409,7 @@ public class Board {
|
|||||||
//If another robot is standing on a conveyor belt pointing to the tile in front, a conflict happens
|
//If another robot is standing on a conveyor belt pointing to the tile in front, a conflict happens
|
||||||
return (isValidPosition(frontLeftPosition) && isConveyorBelt(getTileOnPosition(frontLeftPosition)) &&
|
return (isValidPosition(frontLeftPosition) && isConveyorBelt(getTileOnPosition(frontLeftPosition)) &&
|
||||||
getTileOnPosition(frontLeftPosition).getDirection() ==
|
getTileOnPosition(frontLeftPosition).getDirection() ==
|
||||||
Direction.getRightRotatedDirection(conveyorBeltDirection) && hasRobotOnPosition(frontLeftPosition)) ||
|
Direction.getRightRotatedDirection(conveyorBeltDirection) && hasRobotOnPosition(frontLeftPosition)) ||
|
||||||
(isValidPosition(frontRightPosition) && isConveyorBelt(getTileOnPosition(frontRightPosition))
|
(isValidPosition(frontRightPosition) && isConveyorBelt(getTileOnPosition(frontRightPosition))
|
||||||
&& getTileOnPosition(frontRightPosition).getDirection() ==
|
&& getTileOnPosition(frontRightPosition).getDirection() ==
|
||||||
Direction.getLeftRotatedDirection(conveyorBeltDirection)
|
Direction.getLeftRotatedDirection(conveyorBeltDirection)
|
||||||
|
@ -21,11 +21,11 @@ public class Phase {
|
|||||||
private final Board gameBoard;
|
private final Board gameBoard;
|
||||||
private final List<Player> playerList;
|
private final List<Player> playerList;
|
||||||
private final int cycleDelay;
|
private final int cycleDelay;
|
||||||
|
private final InteractableGame game;
|
||||||
private List<BoardElementContainer<Tile>> cogwheels;
|
private List<BoardElementContainer<Tile>> cogwheels;
|
||||||
private List<BoardElementContainer<Tile>> conveyorBelts;
|
private List<BoardElementContainer<Tile>> conveyorBelts;
|
||||||
private List<BoardElementContainer<Tile>> fastConveyorBelts;
|
private List<BoardElementContainer<Tile>> fastConveyorBelts;
|
||||||
private List<BoardElementContainer<Tile>> flags;
|
private List<BoardElementContainer<Tile>> flags;
|
||||||
private final InteractableGame game;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new phase
|
* Instantiates a new phase
|
||||||
|
@ -24,6 +24,7 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
|
|||||||
private final boolean host;
|
private final boolean host;
|
||||||
private final String playerName;
|
private final String playerName;
|
||||||
private final RoboRallyServer server;
|
private final RoboRallyServer server;
|
||||||
|
private final Phase phase;
|
||||||
private Board gameBoard;
|
private Board gameBoard;
|
||||||
private List<BoardElementContainer<Tile>> repairTiles;
|
private List<BoardElementContainer<Tile>> repairTiles;
|
||||||
private Deck<ProgrammingCard> mainDeck;
|
private Deck<ProgrammingCard> mainDeck;
|
||||||
@ -31,7 +32,6 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
|
|||||||
private String winningPlayerName;
|
private String winningPlayerName;
|
||||||
private List<ProgrammingCard> program;
|
private List<ProgrammingCard> program;
|
||||||
private ProgrammingCardDeck playerHand;
|
private ProgrammingCardDeck playerHand;
|
||||||
private final Phase phase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new Robo Rally game
|
* Instantiates a new Robo Rally game
|
||||||
|
Loading…
x
Reference in New Issue
Block a user