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

#29 Added some more front end features to the create-join-view

parent 0a1e2f32
No related branches found
No related tags found
1 merge request!23Resolve "Create-Join-More-Features"
...@@ -93,6 +93,7 @@ com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton$ImageTextButtonStyle: { ...@@ -93,6 +93,7 @@ com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton$ImageTextButtonStyle: {
com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: { com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
default: { default: {
font: font font: font
fontColor: black
} }
big: { big: {
font: font-big font: font-big
......
...@@ -6,24 +6,29 @@ import com.badlogic.gdx.math.Vector3; ...@@ -6,24 +6,29 @@ import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Button; 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.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; 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.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.gameware.game.GameWare; import com.gameware.game.GameWare;
public class CreateJoinTournamentState extends State { public class CreateJoinTournamentState extends State {
private Stage stage; private Stage stage;
private Table table; private Table outerTable;
private Table innerTable;
private int spacingOnBottom = Gdx.graphics.getHeight()/15; private int spacingOnBottom = Gdx.graphics.getHeight()/15;
private float fontScaleX = 3f; private float fontScaleX = 3f;
private float fontScaleY = 3f; private float fontScaleY = 3f;
private String backBtnText = "Back"; private String backBtnText = "Back";
private String enterBtnText = "Enter"; private String enterBtnText = "Enter";
private String createBtnText = "Create new";
private String joinBtnText = "Join new";
private String tournamentText = "Tournament 1";
public CreateJoinTournamentState(GameStateManager gsm) { public CreateJoinTournamentState(GameStateManager gsm) {
super(gsm); super(gsm);
...@@ -34,32 +39,100 @@ public class CreateJoinTournamentState extends State { ...@@ -34,32 +39,100 @@ public class CreateJoinTournamentState extends State {
skin.getFont("font").getData().setScale(fontScaleX,fontScaleY); skin.getFont("font").getData().setScale(fontScaleX,fontScaleY);
cam.setToOrtho(false, Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2); cam.setToOrtho(false, Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
table = new Table(); outerTable = new Table();
table.setFillParent(true); outerTable.setFillParent(true);
innerTable = new Table();
outerTable.setFillParent(true);
table.row(); outerTable.row();
innerTable.row();
TextButton backBtn = new TextButton(backBtnText, skin); Label tournamentLabel = new Label(tournamentText,skin);
backBtn.addListener(new ClickListener() {
TextButton enterBtn = new TextButton(enterBtnText, skin);
enterBtn.addListener(new ClickListener() {
@Override @Override
public void clicked(InputEvent e, float x, float y){ public void clicked(InputEvent e, float x, float y){
handleBackBtnClick(); handleEnterBtnClick();
} }
}); });
table.add(backBtn);
table.row(); TextButton enterBtn2 = new TextButton(enterBtnText, skin);
enterBtn2.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
handleEnterBtnClick();
}
});
TextButton enterBtn = new TextButton(enterBtnText, skin); TextButton enterBtn3 = new TextButton(enterBtnText, skin);
enterBtn.addListener(new ClickListener() { enterBtn3.addListener(new ClickListener() {
@Override @Override
public void clicked(InputEvent e, float x, float y){ public void clicked(InputEvent e, float x, float y){
handleEnterBtnClick(); handleEnterBtnClick();
} }
}); });
table.add(enterBtn);
stage.addActor(table); 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).pad(10);
outerTable.row();
TextButton createBtn = new TextButton(createBtnText, skin);
createBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
handleCreateBtnClick();
}
});
outerTable.add(createBtn).pad(10);
TextButton joinBtn = new TextButton(joinBtnText, skin);
joinBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
handleJoinBtnClick();
}
});
outerTable.add(joinBtn).pad(10);
outerTable.row();
TextButton backBtn = new TextButton(backBtnText, skin);
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
handleBackBtnClick();
}
});
outerTable.add(backBtn).pad(10);
//outerTable.row();
Label tournamentLabel1 = new Label(tournamentText,skin);
outerTable.add(tournamentLabel1).size(10f);
stage.addActor(outerTable);
} }
@Override @Override
...@@ -99,4 +172,9 @@ public class CreateJoinTournamentState extends State { ...@@ -99,4 +172,9 @@ public class CreateJoinTournamentState extends State {
private void handleEnterBtnClick(){ private void handleEnterBtnClick(){
gsm.set(new ViewTournamentState(gsm)); gsm.set(new ViewTournamentState(gsm));
} }
private void handleCreateBtnClick(){};
private void handleJoinBtnClick(){};
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment