public void signIn() { menu = Assets.menuSigninRegion; menuComponents = new ArrayList<MenuComponent>(); menuTextFields = new ArrayList<TextField>(); menuComponents.add(0, new MenuComponent(200, 300, 100, 50, Assets.menuUsernameRegion)); menuComponents.add(1, new MenuComponent(200, 200, 100, 50, Assets.menuPasswordRegion)); menuComponents.add(2, new MenuComponent(600, 50, 100, 50, Assets.menuSubmitRegion)); Skin usernameSkin = new Skin(Gdx.files.internal("data/uiskin.json")); TextField usernameTextField = new TextField("", usernameSkin); usernameTextField.setPosition(300, 300); usernameTextField.setWidth(400); usernameTextField.setFocusTraversal(false); Skin passwordSkin = new Skin(Gdx.files.internal("data/uiskin.json")); TextField passwordTextField = new TextField("", passwordSkin); passwordTextField.setPosition(300, 200); passwordTextField.setPasswordMode(true); passwordTextField.setPasswordCharacter('a'); passwordTextField.setWidth(400); passwordTextField.setFocusTraversal(false); menuTextFields.add(0, usernameTextField); menuTextFields.add(1, passwordTextField); menuNumber = 2; }
public void gameOver( boolean won, ArrayList<Integer> playerIDs, ArrayList<String> playerUsernames) { shouldClear = true; shouldAddScrollPane = false; charityScrollPane = false; characterScrollPane = false; scrollPaneContainer = null; menu = Assets.menuSplashBlankRegion; menuComponents = new ArrayList<MenuComponent>(); menuTextFields = new HashMap<String, TextField>(); menuNumber = this.MENU_GAMEOVER; this.isSplash = false; TextField resultsTextField = new TextField(("YOU LOSE"), Assets.tfsTrans100); resultsTextField.setPosition(50, 350); resultsTextField.setWidth(700); resultsTextField.setHeight(150); resultsTextField.setAlignment(Align.center); resultsTextField.setFocusTraversal(false); resultsTextField.setDisabled(true); if (won) { resultsTextField.setText("YOU WIN!"); } int yOffset = 0; for (String s : playerUsernames) // for each player passed in { TextField playerTextField = new TextField(s, Assets.tfsTrans40); playerTextField.setPosition(50, 260 - (yOffset * 70)); playerTextField.setWidth(300); playerTextField.setHeight(50); playerTextField.setAlignment(Align.left); playerTextField.setFocusTraversal(false); playerTextField.setDisabled(true); TextField friendTextField = new TextField(Integer.toString(playerIDs.get(yOffset)), Assets.tfsTrans40); friendTextField.setPosition(400, 260 - (yOffset * 70)); friendTextField.setWidth(300); friendTextField.setHeight(50); friendTextField.setAlignment(Align.left); friendTextField.setFocusTraversal(false); friendTextField.setDisabled(true); yOffset++; menuTextFields.put(s, playerTextField); } menuTextFields.put("resultsTF", resultsTextField); }
public void pickClass() { shouldClear = true; shouldAddScrollPane = true; charityScrollPane = false; characterScrollPane = true; menu = Assets.menuSplashBlankRegion; menuComponents = new ArrayList<MenuComponent>(); menuTextFields = new HashMap<String, TextField>(); menuComponents.add( 0, new MenuComponent(700, 100, 175, 75, Assets.menuButtonSmallRegion)); // continue menuComponents.add( 1, new MenuComponent(100, 100, 175, 75, Assets.menuButtonSmallRegion)); // return final TextField characterTextField = new TextField( "SELECT A CHARACTER", Assets.tfsTrans40); // obviously want to replace these with a real charity selection characterTextField.setPosition(50, 390); characterTextField.setWidth(700); characterTextField.setHeight(50); characterTextField.setAlignment(Align.center); characterTextField.setFocusTraversal(false); characterTextField.setDisabled(true); TextField continueTextField = new TextField(("CONTINUE"), Assets.tfsTransWhite40); continueTextField.setPosition(612, 27); continueTextField.setWidth(175); // to be centered well make the width about 325 continueTextField.setHeight(50); continueTextField.setAlignment(Align.center); continueTextField.setFocusTraversal(false); continueTextField.setDisabled(true); TextField returnTextField = new TextField(("RETURN"), Assets.tfsTransWhite40); returnTextField.setPosition(12, 27); returnTextField.setWidth(175); // to be centered well make the width about 325 returnTextField.setHeight(50); returnTextField.setAlignment(Align.center); returnTextField.setFocusTraversal(false); returnTextField.setDisabled(true); menuTextFields.put("characterTF", characterTextField); menuTextFields.put("continueTF", continueTextField); menuTextFields.put("returnTF", returnTextField); menuNumber = this.MENU_PICK_CLASS; }
public void welcome(String username, int wins, int losses, String charityName, int charityIcon) { menu = Assets.menuWelcomeRegion; menuComponents = new ArrayList<MenuComponent>(); menuTextFields = new ArrayList<TextField>(); Skin usernameSkin = new Skin(Gdx.files.internal("data/uiskin.json")); TextField usernameTextField = new TextField(username, usernameSkin); usernameTextField.setPosition(300, 400); usernameTextField.setWidth(400); usernameTextField.setFocusTraversal(false); usernameTextField.setDisabled(true); TextField winsTextField = new TextField(String.valueOf(wins), usernameSkin); winsTextField.setPosition(300, 300); winsTextField.setWidth(400); winsTextField.setFocusTraversal(false); winsTextField.setDisabled(true); TextField lossesTextField = new TextField(String.valueOf(losses), usernameSkin); lossesTextField.setPosition(300, 200); lossesTextField.setWidth(400); lossesTextField.setFocusTraversal(false); lossesTextField.setDisabled(true); TextField charityTextField = new TextField(charityName, usernameSkin); charityTextField.setPosition(300, 100); charityTextField.setWidth(400); charityTextField.setFocusTraversal(false); charityTextField.setDisabled(true); menuTextFields.add(0, usernameTextField); menuTextFields.add(1, winsTextField); menuTextFields.add(2, lossesTextField); menuTextFields.add(3, charityTextField); menuNumber = 3; }
public void welcome(String username, int wins, int losses, String charityName, int charityIcon) { shouldClear = true; shouldAddScrollPane = false; charityScrollPane = false; characterScrollPane = false; scrollPaneContainer = null; menu = Assets.menuSplashBlankRegion; menuComponents = new ArrayList<MenuComponent>(); menuTextFields = new HashMap<String, TextField>(); TextField usernameTextField = new TextField(("WELCOME " + username.toUpperCase() + "!"), Assets.tfsBigBlue70); usernameTextField.setPosition(50, 290); usernameTextField.setWidth(700); usernameTextField.setHeight(50); usernameTextField.setAlignment(Align.center); usernameTextField.setFocusTraversal(false); usernameTextField.setDisabled(true); menuTextFields.put("usernameTF", usernameTextField); menuNumber = this.MENU_WELCOME; }
public void splash() { shouldClear = true; shouldAddScrollPane = false; charityScrollPane = false; characterScrollPane = false; scrollPaneContainer = null; menu = Assets.menuSplashBlankRegion; menuComponents = new ArrayList<MenuComponent>(); menuTextFields = new HashMap<String, TextField>(); menuNumber = this.MENU_SPLASH; blinkTimer = 0; TextField charityChampsTextField = new TextField(("CHARITY CHAMPS!"), Assets.tfsTrans100); charityChampsTextField.setPosition(50, 190); charityChampsTextField.setWidth(700); charityChampsTextField.setHeight(150); charityChampsTextField.setAlignment(Align.center); charityChampsTextField.setFocusTraversal(false); charityChampsTextField.setDisabled(true); menuTextFields.put("charityChampsTF", charityChampsTextField); this.isSplash = true; }
public void options() { shouldClear = true; shouldAddScrollPane = false; charityScrollPane = false; characterScrollPane = false; scrollPaneContainer = null; menuNumber = this.MENU_OPTIONS; menu = Assets.menuSplashBlankRegion; menuComponents = new ArrayList<MenuComponent>(); menuTextFields = new HashMap<String, TextField>(); menuComponents.add( 0, new MenuComponent(600, 100, 175, 75, Assets.menuButtonSmallRegion)); // return menuComponents.add( 1, new MenuComponent(250, 350, 175, 75, Assets.menuButtonSmallRegion)); // player menuComponents.add( 2, new MenuComponent(250, 250, 175, 75, Assets.menuButtonSmallRegion)); // audio menuComponents.add( 3, new MenuComponent(250, 150, 175, 75, Assets.menuButtonSmallRegion)); // privacy menuComponents.add( 4, new MenuComponent(600, 350, 175, 75, Assets.menuButtonSmallRegion)); // log out // right now I am using the metric of setting the width to be 175 and height 50 (for textfields) // and making them 88 units below the buttons and 73 units below. thats maybe like 1 or 2 units // higher than it needs to be, but it looks aight TextField playerTextField = new TextField(("PLAYER"), Assets.tfsTransWhite40); playerTextField.setPosition(162, 277); playerTextField.setWidth(175); // to be centered well make the width about 325 playerTextField.setHeight(50); playerTextField.setAlignment(Align.center); playerTextField.setFocusTraversal(false); playerTextField.setDisabled(true); TextField audioTextField = new TextField(("AUDIO"), Assets.tfsTransWhite40); audioTextField.setPosition(162, 177); audioTextField.setWidth(175); audioTextField.setHeight(50); audioTextField.setAlignment(Align.center); audioTextField.setFocusTraversal(false); audioTextField.setDisabled(true); TextField privacyTextField = new TextField(("PRIVACY"), Assets.tfsTransWhite40); privacyTextField.setPosition(162, 77); privacyTextField.setWidth(175); privacyTextField.setHeight(50); privacyTextField.setAlignment(Align.center); privacyTextField.setFocusTraversal(false); privacyTextField.setDisabled(true); TextField returnTextField = new TextField(("RETURN"), Assets.tfsTransWhite40); returnTextField.setPosition(512, 27); returnTextField.setWidth(175); // to be centered well make the width about 325 returnTextField.setHeight(50); returnTextField.setAlignment(Align.center); returnTextField.setFocusTraversal(false); returnTextField.setDisabled(true); TextField logoutTextField = new TextField(("LOG OUT"), Assets.tfsTransWhite40); logoutTextField.setPosition(512, 277); logoutTextField.setWidth(175); // to be centered well make the width about 325 logoutTextField.setHeight(50); logoutTextField.setAlignment(Align.center); logoutTextField.setFocusTraversal(false); logoutTextField.setDisabled(true); TextField charityChampsTextField = new TextField(("OPTIONS"), Assets.tfsTrans100); charityChampsTextField.setPosition(50, 390); charityChampsTextField.setWidth(700); charityChampsTextField.setHeight(50); charityChampsTextField.setAlignment(Align.center); charityChampsTextField.setFocusTraversal(false); charityChampsTextField.setDisabled(true); menuTextFields.put("playTF", playerTextField); menuTextFields.put("optionsTF", audioTextField); menuTextFields.put("privacyTF", privacyTextField); menuTextFields.put("returnTF", returnTextField); menuTextFields.put("logoutTF", logoutTextField); menuTextFields.put("charityChampsTF", charityChampsTextField); }
public void mainMenu() { shouldClear = true; shouldAddScrollPane = false; charityScrollPane = false; characterScrollPane = false; scrollPaneContainer = null; menu = Assets.menuSplashBlankRegion; menuComponents = new ArrayList<MenuComponent>(); menuTextFields = new HashMap<String, TextField>(); menuComponents.add( 0, new MenuComponent(200, 350, 175, 75, Assets.menuButtonSmallRegion)); // play button menuComponents.add( 1, new MenuComponent(200, 250, 175, 75, Assets.menuButtonSmallRegion)); // options button menuComponents.add( 2, new MenuComponent(200, 150, 175, 75, Assets.menuButtonSmallRegion)); // profile button // right now I am using the metric of setting the width to be 175 and height 50 (for textfields) // and making them 88 units below the buttons and 73 units below. thats maybe like 1 or 2 units // higher than it needs to be, but it looks aight TextField playTextField = new TextField(("PLAY!"), Assets.tfsTransWhite40); playTextField.setPosition(112, 277); playTextField.setWidth(175); // to be centered well make the width about 325 playTextField.setHeight(50); playTextField.setAlignment(Align.center); playTextField.setFocusTraversal(false); playTextField.setDisabled(true); TextField optionsTextField = new TextField(("OPTIONS"), Assets.tfsTransWhite40); optionsTextField.setPosition(112, 177); optionsTextField.setWidth(175); optionsTextField.setHeight(50); optionsTextField.setAlignment(Align.center); optionsTextField.setFocusTraversal(false); optionsTextField.setDisabled(true); TextField profileTextField = new TextField(("PROFILE"), Assets.tfsTransWhite40); profileTextField.setPosition(112, 77); profileTextField.setWidth(175); profileTextField.setHeight(50); profileTextField.setAlignment(Align.center); profileTextField.setFocusTraversal(false); profileTextField.setDisabled(true); TextField charityChampsTextField = new TextField(("CHARITY CHAMPS"), Assets.tfsTrans100); charityChampsTextField.setPosition(50, 390); charityChampsTextField.setWidth(700); charityChampsTextField.setHeight(50); charityChampsTextField.setAlignment(Align.center); charityChampsTextField.setFocusTraversal(false); charityChampsTextField.setDisabled(true); Leaderboard leaderboard = new Leaderboard(game.getPlayerID(), 5, 0); int yOffset = 0; TreeMap<Integer, Integer> sortedMap = new TreeMap<Integer, Integer>(); for (Integer id : leaderboard.board.keySet()) // for each (INT, <String, String>) { System.out.println( "sorting " + Integer.parseInt(leaderboard.board.get(id).get("WINS")) + " " + id); sortedMap.put(Integer.parseInt(leaderboard.board.get(id).get("WINS")), id); } System.out.println(sortedMap.descendingMap()); for (Integer id : sortedMap .descendingMap() .values()) { // the values, is the id. should do it in the order of wins highest TextField playerTextField = new TextField(leaderboard.board.get(id).get("USERNAME"), Assets.tfsTrans40); playerTextField.setPosition(400, 260 - (yOffset * 70)); playerTextField.setWidth(300); playerTextField.setHeight(50); playerTextField.setAlignment(Align.left); playerTextField.setFocusTraversal(false); playerTextField.setDisabled(true); TextField winsTextField = new TextField(leaderboard.board.get(id).get("WINS"), Assets.tfsTrans40); winsTextField.setPosition(700, 260 - (yOffset * 70)); winsTextField.setWidth(100); winsTextField.setHeight(50); winsTextField.setAlignment(Align.left); winsTextField.setFocusTraversal(false); winsTextField.setDisabled(true); yOffset++; menuTextFields.put(leaderboard.board.get(id).get("USERNAME"), playerTextField); menuTextFields.put(leaderboard.board.get(id).get("WINS"), winsTextField); } menuTextFields.put("playTF", playTextField); menuTextFields.put("optionsTF", optionsTextField); menuTextFields.put("profileTF", profileTextField); menuTextFields.put("charityChampsTF", charityChampsTextField); menuNumber = this.MENU_MAINMENU; }
public void signUp() { shouldClear = true; // shouldAddScrollPane = false; shouldAddScrollPane = true; charityScrollPane = true; characterScrollPane = false; menu = Assets.menuSplashBlankRegion; menuComponents = new ArrayList<MenuComponent>(); menuTextFields = new HashMap<String, TextField>(); menuComponents.add( 0, new MenuComponent(600, 100, 175, 75, Assets.menuButtonSmallRegion)); // submit menuComponents.add( 1, new MenuComponent(400, 100, 175, 75, Assets.menuButtonSmallRegion)); // return // right now I am using the metric of setting the width to be 175 and height 50 (for textfields) // and making them 88 units below the buttons and 73 units below. thats maybe like 1 or 2 units // higher than it needs to be, but it looks aight TextField signUpTextField = new TextField(("SIGN UP!"), Assets.tfsTrans100); signUpTextField.setPosition(50, 330); signUpTextField.setWidth(700); signUpTextField.setHeight(150); signUpTextField.setAlignment(Align.center); signUpTextField.setFocusTraversal(false); signUpTextField.setDisabled(true); TextField returnTextField = new TextField(("RETURN"), Assets.tfsTransWhite40); returnTextField.setPosition(312, 27); returnTextField.setWidth(175); // to be centered well make the width about 325 returnTextField.setHeight(50); returnTextField.setAlignment(Align.center); returnTextField.setFocusTraversal(false); returnTextField.setDisabled(true); TextField submitTextField = new TextField(("SUBMIT"), Assets.tfsTransWhite40); submitTextField.setPosition(512, 27); submitTextField.setWidth(175); submitTextField.setHeight(50); submitTextField.setAlignment(Align.center); submitTextField.setFocusTraversal(false); submitTextField.setDisabled(true); final TextField usernameTextField = new TextField("USERNAME", Assets.tfs); usernameTextField.setPosition(100, 300); usernameTextField.setWidth(300); usernameTextField.setHeight(50); usernameTextField.setFocusTraversal(false); usernameTextField.addListener( new ClickListener() { public void clicked(InputEvent e, float x, float y) { if (usernameTextField.getText().equals("USERNAME")) usernameTextField.setText(""); } }); usernameTextField.setTextFieldListener( new TextField.TextFieldListener() { // if enter is pressed, remove the keyboard @Override public void keyTyped(TextField textField, char c) { if ((c == '\r') || (c == '\n')) { Gdx.input.setOnscreenKeyboardVisible(false); unfocusAll = true; } } }); final TextField passwordTextField = new TextField("PASSWORD", Assets.tfs); // passwordTextField.setPosition(100, 240); passwordTextField.setPosition(450, 300); passwordTextField.setPasswordMode(false); // passwordTextField.setPasswordCharacter('*'); passwordTextField.setWidth(300); passwordTextField.setHeight(50); passwordTextField.setFocusTraversal(false); passwordTextField.addListener( new ClickListener() { public void clicked(InputEvent e, float x, float y) { if (passwordTextField.getText().equals("PASSWORD")) passwordTextField.setPasswordMode(true); passwordTextField.setPasswordCharacter('*'); passwordTextField.setText(""); } }); passwordTextField.setTextFieldListener( new TextField.TextFieldListener() { // if enter is pressed, remove the keyboard @Override public void keyTyped(TextField textField, char c) { if ((c == '\r') || (c == '\n')) { Gdx.input.setOnscreenKeyboardVisible(false); unfocusAll = true; } } }); /*final TextField emailTextField = new TextField("EMAIL", Assets.tfs); emailTextField.setPosition(450, 300); emailTextField.setWidth(300); emailTextField.setHeight(50); emailTextField.setFocusTraversal(false); emailTextField.addListener(new ClickListener() { public void clicked(InputEvent e, float x, float y) { if (emailTextField.getText().equals("EMAIL")) emailTextField.setText(""); } }); emailTextField.setTextFieldListener(new TextField.TextFieldListener() {//if enter is pressed, remove the keyboard @Override public void keyTyped(TextField textField, char c) { if ((c == '\r') || (c == '\n')) { Gdx.input.setOnscreenKeyboardVisible(false); unfocusAll = true; } } });*/ final TextField charityTextField = new TextField( "SELECT A CHARITY", Assets.tfsTrans40); // obviously want to replace these with a real charity selection charityTextField.setPosition(250, 240); charityTextField.setDisabled(true); charityTextField.setWidth(300); charityTextField.setHeight(50); charityTextField.setFocusTraversal(false); menuTextFields.put("usernameTF", usernameTextField); menuTextFields.put("passwordTF", passwordTextField); // menuTextFields.put("emailTF", emailTextField); menuTextFields.put("charityTF", charityTextField); menuTextFields.put("returnTF", returnTextField); menuTextFields.put("submitTF", submitTextField); menuTextFields.put("signUpTF", signUpTextField); menuNumber = this.MENU_SIGNUP; }
public void signIn() { shouldClear = true; shouldAddScrollPane = false; charityScrollPane = false; characterScrollPane = false; scrollPaneContainer = null; menu = Assets.menuSplashBlankRegion; menuComponents = new ArrayList<MenuComponent>(); menuTextFields = new HashMap<String, TextField>(); menuComponents.add( 0, new MenuComponent(600, 100, 175, 75, Assets.menuButtonSmallRegion)); // lets go menuComponents.add( 1, new MenuComponent(400, 100, 175, 75, Assets.menuButtonSmallRegion)); // sign up // right now I am using the metric of setting the width to be 175 and height 50 (for textfields) // and making them 88 units below the buttons and 73 units below. thats maybe like 1 or 2 units // higher than it needs to be, but it looks aight menuComponents.add(2, new MenuComponent(45, 45, 178, 267, Assets.menuSpenceRegion)); TextField logInTextField = new TextField(("LOG IN"), Assets.tfsTrans100); logInTextField.setPosition(50, 330); logInTextField.setWidth(700); logInTextField.setHeight(150); logInTextField.setAlignment(Align.center); logInTextField.setFocusTraversal(false); logInTextField.setDisabled(true); TextField letsGoTextField = new TextField(("LETS GO"), Assets.tfsTransWhite40); letsGoTextField.setPosition(512, 27); letsGoTextField.setWidth(175); // to be centered well make the width about 325 letsGoTextField.setHeight(50); letsGoTextField.setAlignment(Align.center); letsGoTextField.setFocusTraversal(false); letsGoTextField.setDisabled(true); TextField signUpTextField = new TextField(("SIGN UP"), Assets.tfsTransWhite40); signUpTextField.setPosition(312, 27); signUpTextField.setWidth(175); signUpTextField.setHeight(50); signUpTextField.setAlignment(Align.center); signUpTextField.setFocusTraversal(false); signUpTextField.setDisabled(true); final TextField usernameTextField = new TextField("USERNAME", Assets.tfs); usernameTextField.setPosition(50, 270); usernameTextField.setWidth(300); usernameTextField.setHeight(50); usernameTextField.setFocusTraversal(false); usernameTextField.addListener( new ClickListener() { public void clicked(InputEvent e, float x, float y) { if (usernameTextField.getText().equals("USERNAME")) usernameTextField.setText(""); } }); usernameTextField.setTextFieldListener( new TextField.TextFieldListener() { // if enter is pressed, remove the keyboard @Override public void keyTyped(TextField textField, char c) { if ((c == '\r') || (c == '\n')) { Gdx.input.setOnscreenKeyboardVisible(false); unfocusAll = true; } } }); final TextField passwordTextField = new TextField("PASSWORD", Assets.tfs); passwordTextField.setPosition(450, 270); passwordTextField.setPasswordMode(false); // passwordTextField.setPasswordCharacter('*'); passwordTextField.setWidth(300); passwordTextField.setHeight(50); passwordTextField.setFocusTraversal(false); passwordTextField.addListener( new ClickListener() { public void clicked(InputEvent e, float x, float y) { if (passwordTextField.getText().equals("PASSWORD")) passwordTextField.setPasswordMode(true); passwordTextField.setPasswordCharacter('*'); passwordTextField.setText(""); } }); passwordTextField.setTextFieldListener( new TextField.TextFieldListener() { // if enter is pressed, remove the keyboard @Override public void keyTyped(TextField textField, char c) { if ((c == '\r') || (c == '\n')) { Gdx.input.setOnscreenKeyboardVisible(false); unfocusAll = true; } } }); menuTextFields.put("usernameTF", usernameTextField); menuTextFields.put("passwordTF", passwordTextField); menuTextFields.put("letsGoTF", letsGoTextField); menuTextFields.put("signUpTF", signUpTextField); menuTextFields.put("loginTF", logInTextField); menuNumber = this.MENU_SIGNIN; }
@Override public void show() { // Creates an stage that contains all the GUI elements stage = new Stage(); stage.clear(); Gdx.input.setInputProcessor(stage); // Title label font100orange = new BitmapFont(Gdx.files.internal("fonts/prehistorik100orange.fnt")); titleLabel = new Label(this.title, new LabelStyle(font100orange, Color.WHITE)); titleLabel.setPosition( Gdx.graphics.getWidth() / 2.0f - titleLabel.getWidth() / 2, 7.1f * Gdx.graphics.getHeight() / 9.0f); // Textbox label white30boldFont = new BitmapFont(Gdx.files.internal("fonts/white30bold.fnt")); label1 = new Label("IP adress of game creator:", new LabelStyle(white30boldFont, Color.WHITE)); label1.setPosition( Gdx.graphics.getWidth() / 2.0f - label1.getWidth() / 2, 6 * Gdx.graphics.getHeight() / 9.0f); // Username Label usernameLabel = ScreenUtils.createLabel("Username:"******"", 0, 0); usernameInput.setPosition( Gdx.graphics.getWidth() / 2f - usernameInput.getWidth() / 2f, 3 * Gdx.graphics.getHeight() / 9.0f); // Atlas of the GUI atlas = new TextureAtlas("gui/gui.pack"); skin = new Skin(atlas); // Buttons font60 = new BitmapFont(Gdx.files.internal("fonts/prehistorik60black.fnt"), false); TextButtonStyle buttonStyle = new TextButtonStyle(); buttonStyle.up = skin.getDrawable("button1"); buttonStyle.over = skin.getDrawable("button1-over"); buttonStyle.down = skin.getDrawable("button1-down"); buttonStyle.font = font60; joinButton = new TextButton("Join Game", buttonStyle); joinButton.setHeight(100f); joinButton.setWidth(500f); joinButton.setPosition( Gdx.graphics.getWidth() / 2.0f - joinButton.getWidth() / 2, 1.5f * Gdx.graphics.getHeight() / 9.0f); menuButton = new TextButton("Main Menu", buttonStyle); menuButton.setHeight(100f); menuButton.setWidth(500f); menuButton.setPosition( Gdx.graphics.getWidth() / 2.0f - joinButton.getWidth() / 2, 0f * Gdx.graphics.getHeight() / 9.0f); // TextField white36nonoFont = new BitmapFont(Gdx.files.internal("fonts/white36mono.fnt")); TextFieldStyle tfs = new TextFieldStyle(); tfs.font = white36nonoFont; tfs.cursor = skin.getDrawable("cursor"); tfs.background = skin.getDrawable("textField"); tfs.fontColor = Color.WHITE; inputAddress = new TextField("localhost", tfs); inputAddress.setHeight(50); inputAddress.setWidth(300); inputAddress.setPosition( Gdx.graphics.getWidth() / 2.0f - inputAddress.getWidth() / 2, 5 * Gdx.graphics.getHeight() / 9.0f); // add actors stage.addActor(joinButton); stage.addActor(menuButton); stage.addActor(inputAddress); stage.addActor(titleLabel); stage.addActor(usernameLabel); stage.addActor(usernameInput); stage.addActor(titleLabel); stage.addActor(label1); joinButton.addListener( new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { System.out.println(inputAddress.getText()); GameScreen.createInstance(game, false, inputAddress.getText(), usernameInput.getText()); game.setScreen(GameScreen.getInstance()); // game.initInputListeners(); } }); menuButton.addListener( new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { game.setScreen(new MenuScreen(game)); } }); }