Skip to content
Snippets Groups Projects
Commit c87cf334 authored by Haakon Gunleiksrud's avatar Haakon Gunleiksrud
Browse files

#32 Resolved merge conflicts with dev.

parents bb7d4fe9 1dbdbcbb
No related branches found
No related tags found
1 merge request!26Resolve "Options-functionality"
Showing
with 401 additions and 166 deletions
......@@ -31,7 +31,7 @@ public class GameWare extends ApplicationAdapter {
@Override
public void create () {
gsm = new GameStateManager();
gsm = GameStateManager.getInstance();
batch = new SpriteBatch();
music = Gdx.audio.newMusic(Gdx.files.internal(("bensound-goinghigher.mp3")));
......
package com.gameware.game.models;
import com.badlogic.gdx.utils.Json;
public class Game {
private String _id;
private String name;
public Game(String _id, String name) {
this._id = _id;
this.name = name;
}
public Game() {
}
public String getId() {
return _id;
}
public String getName() {
return name;
}
public void reset() {
this._id = null;
this.name = null;
}
public String report() {
return new Json().toJson(this);
}
}
package com.gameware.game.models;
import com.badlogic.gdx.utils.Json;
public class Highscore {
private String _id;
private String gameid;
private String userid;
private double value;
public Highscore() {
}
public Highscore(String _id, String gameId, String userId, double value) {
this._id = _id;
this.gameid = gameId;
this.userid = userId;
this.value = value;
}
public String get_id() {
return _id;
}
public String getGameId() {
return gameid;
}
public String getUserId() {
return userid;
}
public double getValue() {
return value;
}
public void reset() {
_id = null;
gameid = null;
userid = null;
value = Double.parseDouble(null);
}
public String report() {
return new Json().toJson(this);
}
}
package com.gameware.game.models;
import com.badlogic.gdx.utils.Json;
import java.util.jar.JarEntry;
public class Player {
private String _id;
private String name;
public Player(String _id, String name) {
this._id = _id;
this.name = name;
}
public Player() {}
public String getId() {
return _id;
}
public String getName() {
return name;
}
public void reset() {
this._id = null;
this.name = null;
}
public String report() {
return new Json().toJson(this);
}
}
package com.gameware.game.models;
import com.badlogic.gdx.utils.Json;
public class Round {
private String _id;
private String tournamentId;
private String playerId;
private String gameId;
private int roundNr;
private String deadlineDate;
private double scoreValue;
private boolean hasPlayed;
private int tournamentPoints;
public Round() {
}
public String get_id() { return _id; }
public String getTournamentId() { return tournamentId;}
public String getPlayerId() { return playerId; }
public String getGameId() { return gameId; }
public int getRoundNr() { return roundNr; }
public String getDeadlineDate() { return deadlineDate; }
public double getScoreValue() { return scoreValue; }
public boolean isPlayed() { return hasPlayed; }
public int getTournamentPoints() { return tournamentPoints; }
public void reset() {
_id = null;
tournamentId = null;
playerId = null;
gameId = null;
roundNr = Integer.parseInt(null);
deadlineDate = null;
scoreValue = Double.parseDouble(null);
hasPlayed = Boolean.parseBoolean(null);
tournamentPoints = Integer.parseInt(null);
}
public String report() {
return new Json().toJson(this);
}
}
package com.gameware.game.models;
import com.badlogic.gdx.utils.Json;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
public class Tournament {
private String _id;
private List<String> players;
private List<String> games;
private String name;
private double timePerRound;
private int maxPlayers;
private int roundsPerGame;
private int currentRound;
private String dateCreated;
private boolean active;
public Tournament() {
}
public String get_id() {
return _id;
}
public List<String> getPlayers() {
return players;
}
public List<String> getGames() {
return games;
}
public String getName() {
return name;
}
public double getTimePerRound() {
return timePerRound;
}
public int getMaxPlayers() {
return maxPlayers;
}
public int getRoundsPerGame() {
return roundsPerGame;
}
public int getCurrentRound() {
return currentRound;
}
public String getDateCreated() {
return dateCreated;
}
public boolean isActive() {
return active;
}
public void reset() {
_id = null;
players = null;
games = null;
name = null;
timePerRound = Double.parseDouble(null);
maxPlayers = Integer.parseInt(null);
roundsPerGame = Integer.parseInt(null);
currentRound = Integer.parseInt(null);
dateCreated = null;
active = Boolean.parseBoolean(null);
}
public String report() {
return new Json().toJson(this);
}
}
......@@ -2,42 +2,30 @@ package com.gameware.game.states;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.gameware.game.GameWare;
public class CreateJoinTournamentState extends State {
private Stage stage;
private Table outerTable;
private Table innerTable;
private final float labelSize = 10f;
private int spacingOnBottom = Gdx.graphics.getHeight()/15;
private float fontScaleX = 3f;
private float fontScaleY = 3f;
private String backBtnText = "Back";
private String enterBtnText = "Enter";
private String createBtnText = "Create new";
private String joinBtnText = "Join new";
private String tournamentText = "Tournament 1";
public CreateJoinTournamentState(GameStateManager gsm) {
super(gsm);
System.out.println("Du er i create join tournament state :0");
stage = new Stage();
Gdx.input.setInputProcessor(stage);
Skin skin = new Skin(Gdx.files.internal(GameWare.skinFilePath));
skin.getFont("font").getData().setScale(fontScaleX,fontScaleY);
cam.setToOrtho(false, Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
outerTable = new Table();
outerTable.setFillParent(true);
......@@ -48,7 +36,7 @@ public class CreateJoinTournamentState extends State {
innerTable.row();
Label tournamentLabel = new Label(tournamentText,skin);
//TODO: autogenerere utifra query og putt dem i en liste
TextButton enterBtn = new TextButton(enterBtnText, skin);
enterBtn.addListener(new ClickListener() {
@Override
......@@ -65,18 +53,51 @@ public class CreateJoinTournamentState extends State {
}
});
TextButton enterBtn3 = new TextButton(enterBtnText, skin);
enterBtn3.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
handleEnterBtnClick();
}
});
TextButton enterBtn4 = new TextButton(enterBtnText, skin);
enterBtn4.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
handleEnterBtnClick();
}
});
innerTable.add(tournamentLabel).size(Gdx.graphics.getWidth()/5);
innerTable.add(enterBtn);
innerTable.row();
innerTable.add(enterBtn2);
innerTable.row();
innerTable.add(enterBtn3);
innerTable.row();
innerTable.add(enterBtn4);
innerTable.row();
ScrollPane tournamentsPane = new ScrollPane(innerTable, skin);
outerTable.add(tournamentsPane).height(Gdx.graphics.getHeight()/4).width(Gdx.graphics.getWidth());
outerTable.add(tournamentsPane).spaceBottom(spacingOnBottom);
outerTable.row();
outerTable.add(makeCreateBtn()).spaceBottom(spacingOnBottom);
outerTable.add(makeJoinBtn()).spaceBottom(spacingOnBottom);
outerTable.row();
outerTable.add(makeBackBtn()).spaceBottom(spacingOnBottom);
//outerTable.row();
Label tournamentLabel1 = new Label(tournamentText,skin);
outerTable.add(tournamentLabel1).size(labelSize);
stage.addActor(outerTable);
}
private TextButton makeCreateBtn(){
TextButton createBtn = new TextButton(createBtnText, skin);
createBtn.addListener(new ClickListener() {
@Override
......@@ -84,8 +105,10 @@ public class CreateJoinTournamentState extends State {
handleCreateBtnClick();
}
});
outerTable.add(createBtn).pad(10);
return createBtn;
}
private TextButton makeJoinBtn(){
TextButton joinBtn = new TextButton(joinBtnText, skin);
joinBtn.addListener(new ClickListener() {
@Override
......@@ -93,10 +116,10 @@ public class CreateJoinTournamentState extends State {
handleJoinBtnClick();
}
});
outerTable.add(joinBtn).pad(10);
outerTable.row();
return joinBtn;
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
backBtn.addListener(new ClickListener() {
@Override
......@@ -104,9 +127,7 @@ public class CreateJoinTournamentState extends State {
handleBackBtnClick();
}
});
outerTable.add(backBtn).pad(10);
stage.addActor(outerTable);
return backBtn;
}
@Override
......
......@@ -7,7 +7,17 @@ import java.util.Stack;
public class GameStateManager {
private Stack<State> states;
public GameStateManager(){
private static GameStateManager instance = null;
//Singleton (lazy initialization)
public static GameStateManager getInstance(){
if( instance == null){
instance = new GameStateManager();
}
return instance;
}
private GameStateManager(){
states = new Stack<State>();
}
......
......@@ -3,17 +3,14 @@ package com.gameware.game.states;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.gameware.game.GameWare;
public class LoginState extends State {
private Stage stage;
private Table table;
private String usernameInputText = "Username";
private TextField usernameInputField;
......@@ -23,9 +20,6 @@ public class LoginState extends State {
private int inputFieldWidth = Gdx.graphics.getWidth()/2;
private int inputFieldHeight = Gdx.graphics.getHeight()/15;
private int spacingOnBottom = Gdx.graphics.getHeight()/15;
private float fontScaleX = 3f;
private float fontScaleY = 3f;
private String loginBtnText = "Log in";
private String signUpBtnText = "Sign Up";
......@@ -33,28 +27,20 @@ public class LoginState extends State {
public LoginState(GameStateManager gsm) {
super(gsm);
stage = new Stage();
Gdx.input.setInputProcessor(stage);
Skin skin = new Skin(Gdx.files.internal(GameWare.skinFilePath));
skin.getFont("font").getData().setScale(fontScaleX,fontScaleY);
cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//Make Table
table = new Table();
table.setFillParent(true);
table.add(makeUserInputField(skin)).size(inputFieldWidth, inputFieldHeight).spaceBottom(spacingOnBottom);
table.add(makeUserInputField()).size(inputFieldWidth, inputFieldHeight).spaceBottom(spacingOnBottom);
table.row();
table.add(makePasswordInputField(skin)).size(inputFieldWidth, inputFieldHeight).spaceBottom(spacingOnBottom);
table.add(makePasswordInputField()).size(inputFieldWidth, inputFieldHeight).spaceBottom(spacingOnBottom);
table.row();
table.add(makeLoginBtn(skin));
table.add(makeLoginBtn()).spaceBottom(spacingOnBottom);
table.row();
table.add(makeSignUpBtn(skin));
table.add(makeSignUpBtn());
stage.addActor(table);
}
private TextField makeUserInputField(Skin skin){
private TextField makeUserInputField( ){
usernameInputField = new TextField(usernameInputText, skin);
usernameInputField.addListener(new ClickListener() {
@Override
......@@ -66,7 +52,7 @@ public class LoginState extends State {
return usernameInputField;
}
private TextField makePasswordInputField(Skin skin){
private TextField makePasswordInputField( ){
passwordInputField = new TextField(passwordInputText, skin);
passwordInputField.setPasswordCharacter(passwordCharacter);
passwordInputField.addListener(new ClickListener() {
......@@ -80,7 +66,7 @@ public class LoginState extends State {
return passwordInputField;
}
private TextButton makeLoginBtn(Skin skin){
private TextButton makeLoginBtn( ){
TextButton loginBtn = new TextButton(loginBtnText, skin);
loginBtn.addListener(new ClickListener() {
@Override
......@@ -91,7 +77,7 @@ public class LoginState extends State {
return loginBtn;
}
private TextButton makeSignUpBtn(Skin skin){
private TextButton makeSignUpBtn( ){
TextButton signUpBtn = new TextButton(signUpBtnText, skin);
signUpBtn.addListener(new ClickListener() {
@Override
......@@ -135,61 +121,29 @@ public class LoginState extends State {
private void handleLoginBtnClick(){
String username = usernameInputField.getText();
String password = passwordInputField.getText();
if(isValidLogin(username, password)){
gsm.set(new MenuState(gsm));
//User user = QueryIntermediate.getUser(username);
//GameWare.setUser(user);
}
else{
//TODO: give user error popup (or something) about why not valid
}
}
//TODO: Check if username is in DB and matches with correct password given
private boolean isValidLogin(String username, String password){
// User user;
try {
//TODO:
// User u = QueryIntermediate.getUser(username)
// if(u.getPassword() == password){
// return true;
// }
// return false;
// User user = QueryIntermediate.getUser(username, password);
// gsm.set(new MenuState(gsm));
// GameWare.setUser(user);
}catch(Exception e){
// TODO: Endre fra exception til spesifisert Element Not Found Exception eller hva det heter
// melding ut om at brukeren ikke eksisterer
//return false;
} finally{
//TODO: Endre return under til fasle når lagt inn faktisk henting til DB og melding om at noe gikk galt
return true;
}
}
private void handleSignUpBtnClick(){
String username = usernameInputField.getText();
String password = passwordInputField.getText();
if(isValidSignUp(username)){
gsm.set(new MenuState(gsm));
//TODO:
//User user = QueryIntermediate.getUser(username);
//GameWare.setUser(user);
}
else{
//TODO: give user error popup (or something) about why not valid
}
}
//TODO: Check if username is already taken in DB
private boolean isValidSignUp(String username){
// User user;
try {
// TODO:
//QueryIntermediate.getUser(username)
//return false;
// QueryIntermediate.createPlayer(username, password)
// gsm.set(new MenuState(gsm));
// GameWare.setUser(user);
}catch(Exception e){
// TODO: Endre fra exception til spesifisert Element Not Found Exception eller hva det heter
//return true;
} finally{
//TODO: Endre return under til fasle når lagt inn faktisk henting til DB og melding om at noe gikk galt
return true;
}
}
}
package com.gameware.game.states;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.gameware.game.GameWare;
public class MenuState extends State{
private Stage stage;
private Table table;
private int spacingOnBottom = Gdx.graphics.getHeight()/15;
private float fontScaleX = 3f;
private float fontScaleY = 3f;
private String singlePlayerBtnText = "Single player";
private String multiPlayerBtnText = "Multi player";
private String highScoreBtnText = "High Scores";
private String optionBtnText = "Options";
private String logOutBtnText = "Log out";
public MenuState(GameStateManager gsm) {
super(gsm);
System.out.println("Du er i menu state :0");
stage = new Stage();
Gdx.input.setInputProcessor(stage);
Skin skin = new Skin(Gdx.files.internal(GameWare.skinFilePath));
skin.getFont("font").getData().setScale(fontScaleX,fontScaleY);
cam.setToOrtho(false, Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
table = new Table();
table.setFillParent(true);
table.row();
table.add(makeSinglePlayerBtn()).spaceBottom(spacingOnBottom);
table.row();
table.add(makeMultiPlayerBtn()).spaceBottom(spacingOnBottom);
table.row();
table.add(makeOptionsBtn()).spaceBottom(spacingOnBottom);
table.row();
table.add(makeHighScoreBtn()).spaceBottom(spacingOnBottom);
table.row();
table.add(makeLogOutBtn()).spaceBottom(spacingOnBottom);
stage.addActor(table);
}
private TextButton makeSinglePlayerBtn(){
TextButton singlePlayerBtn = new TextButton(singlePlayerBtnText, skin);
singlePlayerBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){ handleSingleBtnClick(); }
});
table.add(singlePlayerBtn);
return singlePlayerBtn;
}
table.row();
private TextButton makeMultiPlayerBtn(){
TextButton multiPlayerBtn = new TextButton(multiPlayerBtnText, skin);
multiPlayerBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){ handleMultiBtnClick(); }
});
table.add(multiPlayerBtn);
return multiPlayerBtn;
}
table.row();
private TextButton makeOptionsBtn(){
TextButton optionsBtn = new TextButton(optionBtnText, skin);
optionsBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){ handleOptionsBtnClick(); }
});
table.add(optionsBtn);
return optionsBtn;
}
table.row();
private TextButton makeHighScoreBtn(){
TextButton highScoreBtn = new TextButton(highScoreBtnText, skin);
highScoreBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){ handleHighscoreBtnClick(); }
});
table.add(highScoreBtn);
stage.addActor(table);
return highScoreBtn;
}
private TextButton makeLogOutBtn(){
TextButton logOutBtn = new TextButton(logOutBtnText, skin);
logOutBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){ handleLogOutBtnClick(); }
});
return logOutBtn;
}
@Override
......@@ -120,7 +128,8 @@ public class MenuState extends State{
}
private void handleLogOutBtnClick(){
gsm.set(new LoginState(gsm));
//TODO: antar at når ikke logget inn at user i GameWare skal bli satt til null
//Gameware.setUser(null);
}
}
package com.gameware.game.states;
import com.gameware.game.states.GameStateManager;
import com.gameware.game.states.State;
public abstract class PlayStateTemplate extends State {
private int score;
private boolean isFinished;
// private QueryIntermediate qi;
// public PlayStateTemplate(QueryIntermediate qi){
// this.qi = qi;
// }
public PlayStateTemplate(GameStateManager gsm){
super(gsm);
......@@ -30,7 +23,7 @@ public abstract class PlayStateTemplate extends State {
}
// public void postScore(){
// this.qi.addHighscore(this.score);
// QueryIntermediate.addHighscore(this.score);
// }
}
package com.gameware.game.states;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.gameware.game.GameWare;
public abstract class State {
protected OrthographicCamera cam;
protected GameStateManager gsm;
protected Stage stage;
protected Skin skin;
protected static final float fontScaleX = 3f;
protected static final float fontScaleY = 3f;
protected static final float spacingOnBottom = Gdx.graphics.getHeight()/50;
protected static final float spacingOnBottomInputFIeld = Gdx.graphics.getHeight()/15;
protected State(GameStateManager gsm){
this.gsm = gsm;
cam = new OrthographicCamera();
cam.setToOrtho(false, Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
stage = new Stage();
Gdx.input.setInputProcessor(stage);
skin = new Skin(Gdx.files.internal(GameWare.skinFilePath));
skin.getFont("font").getData().setScale(fontScaleX, fontScaleY);
}
protected abstract void handleInput();
......
package com.gameware.game.states;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.gameware.game.GameWare;
public class ViewHighScoreState extends State {
private Stage stage;
private Table table;
private int spacingOnBottom = Gdx.graphics.getHeight()/15;
private float fontScaleX = 3f;
private float fontScaleY = 3f;
private String backBtnText = "Back";
private String colorRushHighScoreBtnText = "Color Rush";
private String bubbleWrapHighScoreBtnText = "Bubble Wrap";
......@@ -28,23 +19,14 @@ public class ViewHighScoreState extends State {
public ViewHighScoreState(GameStateManager gsm) {
super(gsm);
System.out.println("Du er i view high score state :0");
stage = new Stage();
Gdx.input.setInputProcessor(stage);
Skin skin = new Skin(Gdx.files.internal(GameWare.skinFilePath));
skin.getFont("font").getData().setScale(fontScaleX,fontScaleY);
cam.setToOrtho(false, Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
table = new Table();
table.setFillParent(true);
table.row();
TextButton backBtn = new TextButton(backBtnText, skin);
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){ handleBackBtnClick(); }
});
table.add(backBtn);
table.add(makeBackBtn());
//TODO: autogenerer fra QI get
table.row();
TextButton colorRushBtn = new TextButton(colorRushHighScoreBtnText, skin);
colorRushBtn.addListener(new ClickListener() {
......@@ -64,6 +46,15 @@ public class ViewHighScoreState extends State {
stage.addActor(table);
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){ handleBackBtnClick(); }
});
return backBtn;
}
@Override
protected void handleInput() {
......
package com.gameware.game.states;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.gameware.game.GameWare;
public class ViewTournamentState extends State {
private Stage stage;
private Table table;
private int spacingOnBottom = Gdx.graphics.getHeight()/15;
private float fontScaleX = 3f;
private float fontScaleY = 3f;
private String backBtnText = "Back";
public ViewTournamentState(GameStateManager gsm) {
super(gsm);
System.out.println("Du er i view tournament state :0");
stage = new Stage();
Gdx.input.setInputProcessor(stage);
Skin skin = new Skin(Gdx.files.internal(GameWare.skinFilePath));
skin.getFont("font").getData().setScale(fontScaleX,fontScaleY);
cam.setToOrtho(false, Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
table = new Table();
table.setFillParent(true);
table.row();
table.add(makeBackBtn());
stage.addActor(table);
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
backBtn.addListener(new ClickListener() {
@Override
......@@ -44,9 +33,7 @@ public class ViewTournamentState extends State {
handleBackBtnClick();
}
});
table.add(backBtn);
stage.addActor(table);
return backBtn;
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment