Merge remote-tracking branch 'origin/master'
# Conflicts: # core/src/netwerkprog/game/client/MainGame.java
This commit is contained in:
@@ -40,37 +40,8 @@ import java.awt.*;
|
|||||||
* Main game class
|
* Main game class
|
||||||
*/
|
*/
|
||||||
public class MainGame extends Game implements ClientCallback {
|
public class MainGame extends Game implements ClientCallback {
|
||||||
SpriteBatch batch;
|
|
||||||
float screenWidth;
|
|
||||||
float screenHeight;
|
|
||||||
private FrameRate frameRate;
|
|
||||||
private Client client;
|
|
||||||
private OrthographicCamera camera;
|
|
||||||
private GameInputProcessor gameInputProcessor;
|
|
||||||
private GameCharacter selectedCharacter;
|
|
||||||
private Team team;
|
|
||||||
private Team enemyTeam;
|
|
||||||
private TextRenderer textRenderer;
|
|
||||||
private BitmapFont font;
|
|
||||||
private GlyphLayout layout;
|
|
||||||
private GAMESTATE gamestate;
|
|
||||||
private Faction chosenFaction;
|
|
||||||
private boolean gameOver = false;
|
|
||||||
private int turn = 0;
|
|
||||||
private boolean playersTurn = true;
|
|
||||||
private String username;
|
|
||||||
private boolean ready = false;
|
|
||||||
private boolean enemyReady = false;
|
|
||||||
|
|
||||||
private Map map;
|
|
||||||
public MapRenderer mapRenderer;
|
|
||||||
public AssetManager assets;
|
|
||||||
|
|
||||||
private static MainGame INSTANCE;
|
private static MainGame INSTANCE;
|
||||||
|
|
||||||
private MainGame() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return the instance of the main game.
|
* return the instance of the main game.
|
||||||
* @return the main game
|
* @return the main game
|
||||||
@@ -82,6 +53,33 @@ public class MainGame extends Game implements ClientCallback {
|
|||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GAMESTATE gamestate;
|
||||||
|
private Client client;
|
||||||
|
private FrameRate frameRate;
|
||||||
|
private OrthographicCamera camera;
|
||||||
|
private GameInputProcessor gameInputProcessor;
|
||||||
|
private SpriteBatch batch;
|
||||||
|
private BitmapFont font;
|
||||||
|
private GlyphLayout layout;
|
||||||
|
private TextRenderer textRenderer;
|
||||||
|
private Map map;
|
||||||
|
public MapRenderer mapRenderer; //todo public?
|
||||||
|
public AssetManager assets; //todo public?
|
||||||
|
private Faction chosenFaction;
|
||||||
|
private Team team;
|
||||||
|
private Team enemyTeam;
|
||||||
|
private GameCharacter selectedCharacter;
|
||||||
|
private float screenWidth;
|
||||||
|
private float screenHeight;
|
||||||
|
private String username;
|
||||||
|
private int turn = 0;
|
||||||
|
private boolean playersTurn = true;
|
||||||
|
private boolean ready = false;
|
||||||
|
private boolean enemyReady = false;
|
||||||
|
private boolean gameOver = false;
|
||||||
|
|
||||||
|
private MainGame() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
@@ -94,11 +92,15 @@ public class MainGame extends Game implements ClientCallback {
|
|||||||
screenHeight = Gdx.graphics.getHeight();
|
screenHeight = Gdx.graphics.getHeight();
|
||||||
frameRate = new FrameRate();
|
frameRate = new FrameRate();
|
||||||
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
textRenderer = new TextRenderer();
|
camera.position.set(screenWidth / 2, screenHeight / 2, 0);
|
||||||
|
camera.viewportWidth = screenWidth / 2;
|
||||||
|
camera.viewportHeight = screenHeight / 2;
|
||||||
|
camera.update();
|
||||||
|
gameInputProcessor = new GameInputProcessor(camera);
|
||||||
|
batch = new SpriteBatch();
|
||||||
font = new BitmapFont();
|
font = new BitmapFont();
|
||||||
layout = new GlyphLayout();
|
layout = new GlyphLayout();
|
||||||
assets = new AssetManager();
|
textRenderer = new TextRenderer();
|
||||||
|
|
||||||
String[] strings = new String[]{
|
String[] strings = new String[]{
|
||||||
"#########################",
|
"#########################",
|
||||||
"#xxxx # #",
|
"#xxxx # #",
|
||||||
@@ -115,15 +117,11 @@ public class MainGame extends Game implements ClientCallback {
|
|||||||
"#########################"
|
"#########################"
|
||||||
};
|
};
|
||||||
map = new Map(strings);
|
map = new Map(strings);
|
||||||
gameInputProcessor = new GameInputProcessor(camera);
|
|
||||||
Gdx.input.setInputProcessor(gameInputProcessor);
|
|
||||||
mapRenderer = new MapRenderer(map, 32, batch, camera);
|
mapRenderer = new MapRenderer(map, 32, batch, camera);
|
||||||
camera.position.set(screenWidth / 2, screenHeight / 2, 0);
|
assets = new AssetManager();
|
||||||
camera.viewportWidth = screenWidth / 2;
|
screenWidth = Gdx.graphics.getWidth();
|
||||||
camera.viewportHeight = screenHeight / 2;
|
screenHeight = Gdx.graphics.getHeight();
|
||||||
camera.update();
|
Gdx.input.setInputProcessor(gameInputProcessor);
|
||||||
setGamestate(GAMESTATE.SELECTING_FACTION);
|
|
||||||
connectToServer();
|
|
||||||
playSong();
|
playSong();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user