mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Bytter navn fra RoboRallyLauncher til RoboRallyWrapper
This commit is contained in:
parent
52046fea40
commit
e2e1fc902e
@ -2,7 +2,7 @@ package inf112.fiasko.roborally;
|
||||
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||
import inf112.fiasko.roborally.game_wrapper.RoboRallyLauncher;
|
||||
import inf112.fiasko.roborally.game_wrapper.RoboRallyWrapper;
|
||||
|
||||
|
||||
public class Main {
|
||||
@ -13,6 +13,6 @@ public class Main {
|
||||
cfg.height = 900;
|
||||
cfg.samples = 3;
|
||||
|
||||
new LwjglApplication(new RoboRallyLauncher(), cfg);
|
||||
new LwjglApplication(new RoboRallyWrapper(), cfg);
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ import inf112.fiasko.roborally.utility.TextureConverterUtil;
|
||||
import java.util.List;
|
||||
|
||||
public class BoardActiveScreen implements Screen, InputProcessor {
|
||||
private final RoboRallyLauncher roboRallyLauncher;
|
||||
private final RoboRallyWrapper roboRallyWrapper;
|
||||
private final OrthographicCamera camera;
|
||||
private IDrawableGame debugGame;
|
||||
|
||||
@ -35,9 +35,9 @@ public class BoardActiveScreen implements Screen, InputProcessor {
|
||||
private final int viewPortHeight = 12 * tileDimensions;
|
||||
private final Viewport viewport;
|
||||
|
||||
public BoardActiveScreen(final RoboRallyLauncher roboRallyLauncher) {
|
||||
this.roboRallyLauncher = roboRallyLauncher;
|
||||
roboRallyLauncher.roboRallyGame = new RoboRallyGame();
|
||||
public BoardActiveScreen(final RoboRallyWrapper roboRallyWrapper) {
|
||||
this.roboRallyWrapper = roboRallyWrapper;
|
||||
roboRallyWrapper.roboRallyGame = new RoboRallyGame();
|
||||
debugGame = new RoboRallyGame(true);
|
||||
|
||||
camera = new OrthographicCamera();
|
||||
@ -80,10 +80,10 @@ public class BoardActiveScreen implements Screen, InputProcessor {
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT |
|
||||
(Gdx.graphics.getBufferFormat().coverageSampling?GL20.GL_COVERAGE_BUFFER_BIT_NV:0));
|
||||
updateCamera();
|
||||
roboRallyLauncher.batch.setProjectionMatrix(camera.combined);
|
||||
roboRallyLauncher.batch.begin();
|
||||
drawBoard(roboRallyLauncher.batch);
|
||||
roboRallyLauncher.batch.end();
|
||||
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
||||
roboRallyWrapper.batch.begin();
|
||||
drawBoard(roboRallyWrapper.batch);
|
||||
roboRallyWrapper.batch.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,8 +101,8 @@ public class BoardActiveScreen implements Screen, InputProcessor {
|
||||
@Override
|
||||
public boolean keyUp(int keycode) {
|
||||
if (keycode == Input.Keys.HOME) {
|
||||
IDrawableGame temp = roboRallyLauncher.roboRallyGame;
|
||||
roboRallyLauncher.roboRallyGame = debugGame;
|
||||
IDrawableGame temp = roboRallyWrapper.roboRallyGame;
|
||||
roboRallyWrapper.roboRallyGame = debugGame;
|
||||
this.debugGame = temp;
|
||||
return true;
|
||||
}
|
||||
@ -175,7 +175,7 @@ public class BoardActiveScreen implements Screen, InputProcessor {
|
||||
*/
|
||||
private void drawBoard(SpriteBatch batch) {
|
||||
List<IDrawableObject> elementsToDraw =
|
||||
IOUtil.getDrawableObjectsFromGame(roboRallyLauncher.roboRallyGame, tileDimensions, tileDimensions);
|
||||
IOUtil.getDrawableObjectsFromGame(roboRallyWrapper.roboRallyGame, tileDimensions, tileDimensions);
|
||||
for (IDrawableObject object : elementsToDraw) {
|
||||
TextureRegion objectTextureRegion = object.getTexture();
|
||||
batch.draw(objectTextureRegion.getTexture(), object.getXPosition(), object.getYPosition(),
|
||||
|
@ -8,13 +8,13 @@ import com.badlogic.gdx.utils.viewport.ExtendViewport;
|
||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
||||
|
||||
public class MainMenuScreen implements Screen {
|
||||
private final RoboRallyLauncher roboRallyLauncher;
|
||||
private final RoboRallyWrapper roboRallyWrapper;
|
||||
|
||||
private final OrthographicCamera camera;
|
||||
private final Viewport viewport;
|
||||
|
||||
public MainMenuScreen(final RoboRallyLauncher roboRallyLauncher) {
|
||||
this.roboRallyLauncher = roboRallyLauncher;
|
||||
public MainMenuScreen(final RoboRallyWrapper roboRallyWrapper) {
|
||||
this.roboRallyWrapper = roboRallyWrapper;
|
||||
camera = new OrthographicCamera();
|
||||
camera.setToOrtho(false, 400, 400);
|
||||
viewport = new ExtendViewport(400, 400, camera);
|
||||
@ -30,16 +30,16 @@ public class MainMenuScreen implements Screen {
|
||||
Gdx.gl.glClearColor(0.2f, 1f, 0.2f, 1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
camera.update();
|
||||
roboRallyLauncher.batch.setProjectionMatrix(camera.combined);
|
||||
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
||||
|
||||
roboRallyLauncher.batch.begin();
|
||||
roboRallyLauncher.font.draw(roboRallyLauncher.batch, "Robo Rally", 0, 250,
|
||||
roboRallyWrapper.batch.begin();
|
||||
roboRallyWrapper.font.draw(roboRallyWrapper.batch, "Robo Rally", 0, 250,
|
||||
200, 0, false);
|
||||
roboRallyLauncher.font.draw(roboRallyLauncher.batch, "Click anywhere to run the demo", 70, 200);
|
||||
roboRallyLauncher.batch.end();
|
||||
roboRallyWrapper.font.draw(roboRallyWrapper.batch, "Click anywhere to run the demo", 70, 200);
|
||||
roboRallyWrapper.batch.end();
|
||||
|
||||
if (Gdx.input.isTouched()) {
|
||||
roboRallyLauncher.setScreen(roboRallyLauncher.screenManager.getBoardActiveScreen(this.roboRallyLauncher));
|
||||
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper));
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import inf112.fiasko.roborally.objects.IDrawableGame;
|
||||
|
||||
public class RoboRallyLauncher extends Game {
|
||||
public class RoboRallyWrapper extends Game {
|
||||
public SpriteBatch batch;
|
||||
public BitmapFont font;
|
||||
public ScreenManager screenManager;
|
@ -9,24 +9,24 @@ public class ScreenManager {
|
||||
|
||||
/**
|
||||
* Gets an instance of the main menu screen
|
||||
* @param roboRallyLauncher The robo rally launcher instance to use
|
||||
* @param roboRallyWrapper The robo rally launcher instance to use
|
||||
* @return A main menu screen instance
|
||||
*/
|
||||
public synchronized MainMenuScreen getMainMenuScreen(RoboRallyLauncher roboRallyLauncher) {
|
||||
public synchronized MainMenuScreen getMainMenuScreen(RoboRallyWrapper roboRallyWrapper) {
|
||||
if (this.mainMenuScreen == null) {
|
||||
this.mainMenuScreen = new MainMenuScreen(roboRallyLauncher);
|
||||
this.mainMenuScreen = new MainMenuScreen(roboRallyWrapper);
|
||||
}
|
||||
return mainMenuScreen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance of the board active screen
|
||||
* @param roboRallyLauncher The robo rally launcher instance to use
|
||||
* @param roboRallyWrapper The robo rally launcher instance to use
|
||||
* @return A board active screen instance
|
||||
*/
|
||||
public synchronized BoardActiveScreen getBoardActiveScreen(RoboRallyLauncher roboRallyLauncher) {
|
||||
public synchronized BoardActiveScreen getBoardActiveScreen(RoboRallyWrapper roboRallyWrapper) {
|
||||
if (this.boardActiveScreen == null) {
|
||||
this.boardActiveScreen = new BoardActiveScreen(roboRallyLauncher);
|
||||
this.boardActiveScreen = new BoardActiveScreen(roboRallyWrapper);
|
||||
}
|
||||
return boardActiveScreen;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user