Commit 784cd645 authored by Turid Cecilie Dahl's avatar Turid Cecilie Dahl
Browse files

#99 back btn violet and play btn green

parent e24b0bd2
......@@ -250,7 +250,7 @@ public class CreateJoinTournamentState extends State {
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
TextButton backBtn = new TextButton(backBtnText, makeTextButtonStyle(backColor));
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
......
......@@ -57,7 +57,7 @@ public class CreateNewTournamentState extends State {
// Texts
private final String backBtnText = "Back";
private final String createBtnText = "Create";
private final String nextBtnText = "Next";
private final String nextBtnText = "Select games";
private final String noNameText = "No name given";
private final String noGamesSelectedText = "No games selected";
......@@ -169,7 +169,7 @@ public class CreateNewTournamentState extends State {
rootTable.add(makeBackBtn()).expand().bottom().left();
TextButton nextBtn = makeNextBtn();
rootTable.add(nextBtn).size(buttonWidth, buttonHeight).expand().bottom().right();
rootTable.add(nextBtn).size(buttonWidth*1.2f, buttonHeight).expand().bottom().right();
}
private void makePageTwo(){
......@@ -235,7 +235,7 @@ public class CreateNewTournamentState extends State {
}
private TextButton makeCreateBtn() {
TextButton createBtn = new TextButton(createBtnText, skin);
TextButton createBtn = new TextButton(createBtnText, makeTextButtonStyle(greenColor));
createBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
......@@ -274,7 +274,7 @@ public class CreateNewTournamentState extends State {
}
private TextButton makeBackBtn() {
TextButton backBtn = new TextButton(backBtnText, skin);
TextButton backBtn = new TextButton(backBtnText, makeTextButtonStyle(backColor));
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
......
......@@ -135,7 +135,7 @@ public class FinishedTournamentState extends State {
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
TextButton backBtn = new TextButton(backBtnText, makeTextButtonStyle(backColor));
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
......
package com.gameware.game.states;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
......@@ -196,14 +198,11 @@ public class LoginState extends State {
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backText, skin);
TextButton backBtn = new TextButton(backText, makeTextButtonStyle(backColor));
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
page --;
errorLabel.setText("");
stage.clear();
makeStage();
handleBackBtnClicked();
}
});
return backBtn;
......@@ -274,6 +273,13 @@ public class LoginState extends State {
}
}
private void handleBackBtnClicked(){
page --;
errorLabel.setText("");
stage.clear();
makeStage();
}
// Adds listener to stage that removes keyboard on touch
private void removeKeyPadAtTouch(){
stage.getRoot().addCaptureListener(new InputListener() {
......@@ -327,6 +333,13 @@ public class LoginState extends State {
this.loadingText.setLoading();
}
@Override
protected void handleInput() {
if (Gdx.input.isKeyJustPressed(Input.Keys.BACK) && page == 1){
handleBackBtnClicked();
}
}
@Override
public void dispose() {
stage.dispose();
......
......@@ -2,6 +2,7 @@ package com.gameware.game.states;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
......@@ -140,7 +141,7 @@ public class MenuState extends State{
Table table = new Table();
table.add(new Image(logOut)).width(logOutWidth).height(buttonHeight/3f).spaceRight(spacingLittle/2);
table.add(new Label(logOutBtnText, skin, "big")).spaceRight(spacingLittle/2);
Button btn = new Button(table, skin);
Button btn = new Button(table, makeTextButtonStyle(backColor));
btn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
......
......@@ -98,7 +98,7 @@ public class OptionsState extends State {
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
TextButton backBtn = new TextButton(backBtnText, makeTextButtonStyle(backColor));
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
......
......@@ -84,7 +84,7 @@ public class SinglePlayerSelectGameState extends State {
innerInnerTable.add(makeRow(new Label(g.getName(), skin), makeDialog(new Label(g.getExplanation().replaceAll("\\\\n", "\n"), skin)))).spaceBottom(spacingLittle);
innerInnerTable.row();
TextButton gameBtn = new TextButton(playBtnText, skin);
TextButton gameBtn = new TextButton(playBtnText, makeTextButtonStyle(greenColor));
gameBtn.addListener(new SinglePlayerSelectGameState.MyClickListener(g));
innerInnerTable.add(gameBtn);
......@@ -96,7 +96,7 @@ public class SinglePlayerSelectGameState extends State {
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
TextButton backBtn = new TextButton(backBtnText, makeTextButtonStyle(backColor));
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){ handleBackBtnClick(); }
......
......@@ -15,6 +15,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
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.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Align;
......@@ -56,6 +57,8 @@ public abstract class State {
protected TextureRegionDrawable backgroundTableBlueRounded = new TextureRegionDrawable(new TextureRegion(new Texture("state/tableBGRounded.png")));
protected TextureRegionDrawable questionMark = new TextureRegionDrawable(new TextureRegion(new Texture("state/questionMarkIcon.png")));
protected Color backColor = Color.VIOLET;
protected Color greenColor = Color.GREEN;
// Sound Effects
protected Sound buttonPressSound;
......@@ -165,4 +168,14 @@ public abstract class State {
return dialog;
}
protected TextButton.TextButtonStyle makeTextButtonStyle(Color background){
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = skin.newDrawable("button", background);
textButtonStyle.down = skin.newDrawable("button-down", background);
textButtonStyle.font = skin.getFont("font-big");
textButtonStyle.fontColor = Color.WHITE;
return textButtonStyle;
}
}
......@@ -109,7 +109,7 @@ public class TournamentHighScoreState extends State{
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
TextButton backBtn = new TextButton(backBtnText, makeTextButtonStyle(backColor));
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
......
......@@ -96,7 +96,7 @@ public class ViewHighScoreForGameState extends State {
// Make widgets methods
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
TextButton backBtn = new TextButton(backBtnText, makeTextButtonStyle(backColor));
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
......
......@@ -106,7 +106,7 @@ public class ViewHighScoreState extends State {
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
TextButton backBtn = new TextButton(backBtnText, makeTextButtonStyle(backColor));
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){ handleBackBtnClick(); }
......
......@@ -154,7 +154,7 @@ public class ViewTournamentState extends State {
}
private TextButton makeBackBtn(){
TextButton backBtn = new TextButton(backBtnText, skin);
TextButton backBtn = new TextButton(backBtnText, makeTextButtonStyle(backColor));
backBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
......@@ -168,8 +168,8 @@ public class ViewTournamentState extends State {
TextButton playBtn;
if(round.isPlayed()){
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = skin.newDrawable("button", Color.GRAY);
textButtonStyle.down = skin.newDrawable("button", Color.GRAY);
textButtonStyle.up = skin.newDrawable("button", new Color(0x207b20a0));
textButtonStyle.down = skin.newDrawable("button", new Color(0x207b20a0));
textButtonStyle.font = skin.getFont("font-big");
textButtonStyle.fontColor = Color.LIGHT_GRAY;
......@@ -185,7 +185,7 @@ public class ViewTournamentState extends State {
});
}
else{
playBtn = new TextButton(playBtnText, skin);
playBtn = new TextButton(playBtnText, makeTextButtonStyle(greenColor));
playBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent e, float x, float y){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment