Example usage for com.badlogic.gdx.graphics Color BLACK

List of usage examples for com.badlogic.gdx.graphics Color BLACK

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics Color BLACK.

Prototype

Color BLACK

To view the source code for com.badlogic.gdx.graphics Color BLACK.

Click Source Link

Usage

From source file:scenes.Debug.java

@Override
public void create() {
    layout = new GlyphLayout();
    batch = new SpriteBatch();

    //initialize fonts
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 30;//from  www . j av a  2  s  .  c om
    font30 = generator.generateFont(parameter);
    font30.setColor(Color.BLACK);
}

From source file:scenes.EnterName.java

@Override
public void create() {
    usesSpecialChars = false;//from   w w w.  ja va2  s .  c om
    layout = new GlyphLayout();
    batch = new SpriteBatch();
    enteredName = Config.username;
    Config.username = "";
    numberOfChars = enteredName.length();
    maxNumberOfChars = 10;

    //initialize fonts
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 60;
    font60 = generator.generateFont(parameter); // font size 12 pixels
    font60.setColor(Color.BLACK);
    parameter.size = 40;
    font30 = generator.generateFont(parameter); // font size 12 pixels
    font30.setColor(0.38f, 0.38f, 0.38f, 1f);
    font30Fade = generator.generateFont(parameter); // font size 12 pixels
    font30Fade.setColor(0.38f, 0.38f, 0.38f, 1f);
    parameter.size = 25;
    errorFont = generator.generateFont(parameter); // font size 12 pixels
    errorFont.setColor(CircleColors.red);
    font25 = generator.generateFont(parameter); // font size 12 pixels
    font25.setColor(Color.BLACK);
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    fade = new FontFade(font30Fade);

    //prepare buttons
    stage = new Stage() {
        @Override
        public boolean keyDown(int keyCode) {
            if (keyCode == Input.Keys.BACKSPACE) {
                if (enteredName.length() > 0)
                    enteredName = enteredName.substring(0, enteredName.length() - 1);
            } else if (keyCode == Input.Keys.ENTER && enteredName.length() != 0) {
                Config.username = enteredName;
                GameClient.registerClientName(enteredName);
            } else if (keyCode > 28 && keyCode < 55) {
                if (numberOfChars < maxNumberOfChars)
                    enteredName += Input.Keys.toString(keyCode);
            } else {
                usesSpecialChars = true;
                Timer.schedule(new Task() {

                    @Override
                    public void run() {
                        usesSpecialChars = false;
                    }
                }, 1);
            }

            numberOfChars = enteredName.length();
            return super.keyDown(keyCode);
        }
    };
    Gdx.input.setInputProcessor(stage);
    atlas = new TextureAtlas("ui/buttonPack.pack");
    skin = new Skin(atlas);
    table = new Table(skin);
    table.setBounds(0, -150, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    final TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.downFontColor = new Color(0f, 0.57f, 0.92f, 1f);
    textButtonStyle.overFontColor = new Color(0f, 0.57f, 1f, 1f);
    textButtonStyle.font = font30;
    textButtonStyle.fontColor = Color.BLACK;

    buttonStart = new TextButton("Play", textButtonStyle);
    buttonStart.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (enteredName.length() == 0)
                return;

            Config.username = enteredName;
            GameClient.registerClientName(enteredName);
        }

    });
    buttonStart.pad(20);

    table.add(buttonStart);
    stage.addActor(table);
}

From source file:scenes.GameCreate.java

@Override
public void create() {
    playerLimitIndex = 0;//  w  w w  .j  a  v  a2s .  c o  m
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setAutoShapeType(true);

    batch = new SpriteBatch();
    availableMaps = GameMaps.getMaps();
    availableGameModeMap = GameMapsDomination.getMaps();
    availableGamemodes = new GameMode[] { new NormalMatch("Normal Game"), new TutorialMatch("Tutorial"),
            new DominationMatch("Domination") };
    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    atlas = new TextureAtlas("ui/buttonPack.pack");
    skin = new Skin(atlas);

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    //initialize fonts
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 60;
    font60 = generator.generateFont(parameter); // font size 12 pixels
    font60.setColor(Color.BLACK);
    parameter.size = 40;
    font30 = generator.generateFont(parameter); // font size 12 pixels
    font30.setColor(0.5f, 0.5f, 0.5f, 255);
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    final TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.downFontColor = new Color(0f, 0.57f, 0.92f, 1f);
    textButtonStyle.overFontColor = new Color(0f, 0.57f, 1f, 1f);
    textButtonStyle.font = font30;
    textButtonStyle.fontColor = Color.BLACK;

    buttonPlay = new TextButton("Start Game", textButtonStyle);
    buttonPlay.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if ("Domination".equals(availableGamemodes[selectedGameMode].getName())) {
                Config.page = new SearchGame(availableGameModeMap[selectedMap].getName(),
                        availableGamemodes[selectedGameMode].getName(), playerLimit[playerLimitIndex]);
            } else {
                Config.page = new SearchGame(availableMaps[selectedMap].getName(),
                        availableGamemodes[selectedGameMode].getName(), playerLimit[playerLimitIndex]);

            }
        }

    });

    buttonExit = new TextButton("Back", textButtonStyle);
    buttonExit.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.page = new MainMenu();
        }

    });
    buttonExit.pad(20);

    LabelStyle headingStyle = new LabelStyle(font60, Color.BLACK);

    final TextButton toggleGameMode = new TextButton(
            "GameMode: " + availableGamemodes[selectedGameMode].getName(), textButtonStyle);
    toggleGameMode.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            selectedGameMode++;
            if (selectedGameMode >= availableGamemodes.length) {
                selectedGameMode = 0;
            }

            toggleGameMode.setText("GameMode: " + availableGamemodes[selectedGameMode].getName());
        }
    });

    final TextButton toggleLevel = new TextButton("Map: " + availableMaps[selectedMap].getName(),
            textButtonStyle);
    toggleLevel.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            selectedMap++;
            if (selectedMap >= availableMaps.length) {
                selectedMap = 0;
            }

            toggleLevel.setText("Map: " + availableMaps[selectedMap].getName());
        }
    });

    final TextButton togglePlayeLimit = new TextButton("players: " + playerLimit[playerLimitIndex],
            textButtonStyle);
    togglePlayeLimit.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            playerLimitIndex++;
            if (playerLimitIndex >= playerLimit.length) {
                playerLimitIndex = 0;
            }

            togglePlayeLimit.setText("players: " + playerLimit[playerLimitIndex]);
        }
    });
    heading = new Label("Game modes", headingStyle);

    table.add(heading);
    table.row();
    table.padBottom(100);
    table.add(toggleGameMode);
    table.row();
    table.padBottom(50);
    table.add(toggleLevel);
    table.row();
    table.padBottom(50);
    table.add(togglePlayeLimit);
    table.row();
    table.padBottom(50);
    table.add(buttonPlay);
    table.row();
    table.padBottom(50);
    table.add(buttonExit);
    //table.debug();
    stage.addActor(table);
    //xOffset = (Gdx.graphics.getWidth() / 100 * 65);
    xOffset = (int) table.getX() + (int) toggleLevel.getRight() + (Gdx.graphics.getWidth() / 2);
    yOffset = Gdx.graphics.getHeight() / 2 - (availableMaps[selectedMap].getHeight() / 5);

}

From source file:scenes.GameLobby.java

@Override
public void create() {
    playerLimitIndex = 0;//from w w  w  .  ja va  2  s.  co m
    //        shapeRenderer = new ShapeRenderer();
    //        shapeRenderer.setAutoShapeType(true);
    GameClient.getAllMaches(true);

    java.util.List<ActiveMatch> allActiveMatches = GameClient.getAllActiveMatches();

    System.out.println(allActiveMatches);

    batch = new SpriteBatch();
    availableMaps = GameMaps.getMaps();
    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    atlas = new TextureAtlas("ui/buttonPack.pack");
    skin = new Skin(atlas);

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    //initialize fonts
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 60;
    font60 = generator.generateFont(parameter); // font size 12 pixels
    font60.setColor(Color.BLACK);
    parameter.size = 40;
    font30 = generator.generateFont(parameter); // font size 12 pixels
    font30.setColor(0.5f, 0.5f, 0.5f, 255);
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    ScrollPaneStyle paneStyle = new ScrollPaneStyle();

    //Font
    final TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.downFontColor = new Color(0f, 0.57f, 0.92f, 1f);
    textButtonStyle.overFontColor = new Color(0f, 0.57f, 1f, 1f);
    textButtonStyle.font = font30;
    textButtonStyle.fontColor = Color.BLACK;

    //System.out.println(atlas.getRegions());

    paneStyle.background = new TextureRegionDrawable(atlas.findRegion("up"));

    table2 = new Table();

    TextButton[] aam = new TextButton[allActiveMatches.size()];

    for (int i = 0; i < allActiveMatches.size(); i++) {
        final ActiveMatch am = allActiveMatches.get(i);
        aam[i] = new TextButton(
                "Map:" + am.map + " - " + am.getGameMode() + " - Max:" + am.getNumberOfPlayers(),
                textButtonStyle);
        aam[i].addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                Config.page = new GameWaiting(am.getMap(), am.getGameMode(), am.getNumberOfPlayers());
            }
        });

        table2.add(aam[i]);
    }

    ScrollPane lobby = new ScrollPane(table2, paneStyle);

    buttonExit = new TextButton("Back", textButtonStyle);
    buttonExit.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.page = new MainMenu();
        }

    });
    buttonExit.pad(20);
    buttonCreate = new TextButton("Create", textButtonStyle);
    buttonCreate.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.page = new GameCreate();
        }

    });
    buttonCreate.pad(20);

    buttonNoGame = new TextButton("No Games found", textButtonStyle);
    buttonNoGame.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {

        }

    });
    buttonNoGame.pad(20);
    LabelStyle headingStyle = new LabelStyle(font60, Color.BLACK);

    heading = new Label("Lobby", headingStyle);

    table.add(heading).colspan(2).center();
    table.padBottom(100);
    table.row();

    if (allActiveMatches.size() <= 0) {
        table.add(buttonNoGame).colspan(2).center();
    } else {
        table.add(lobby).colspan(2).center();
    }

    table.padBottom(50);
    table.row();
    table.add(buttonExit);
    table.add(buttonCreate);
    stage.addActor(table);
}

From source file:scenes.GameModeSelect.java

@Override
public void create() {
    playerLimitIndex = 0;//  w  w w. ja  v a  2s. co m
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setAutoShapeType(true);

    batch = new SpriteBatch();
    availableMaps = GameMaps.getMaps();
    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    atlas = new TextureAtlas("ui/buttonPack.pack");
    skin = new Skin(atlas);

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    //initialize fonts
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 60;
    font60 = generator.generateFont(parameter); // font size 12 pixels
    font60.setColor(Color.BLACK);
    parameter.size = 40;
    font30 = generator.generateFont(parameter); // font size 12 pixels
    font30.setColor(0.5f, 0.5f, 0.5f, 255);
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    final TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.downFontColor = new Color(0f, 0.57f, 0.92f, 1f);
    textButtonStyle.overFontColor = new Color(0f, 0.57f, 1f, 1f);
    textButtonStyle.font = font30;
    textButtonStyle.fontColor = Color.BLACK;

    buttonTut = new TextButton("Tutorial", textButtonStyle);
    buttonTut.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.page = new SearchGame(availableMaps[selectedMap].getName(), "Tutorial",
                    playerLimit[playerLimitIndex]);
        }

    });

    buttonTut.pad(20);

    buttonPlay = new TextButton("Normal Game", textButtonStyle);
    buttonPlay.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.page = new SearchGame(availableMaps[selectedMap].getName(), "Normal Game",
                    playerLimit[playerLimitIndex]);
        }

    });

    buttonPlay.pad(20);

    buttonExit = new TextButton("Back", textButtonStyle);
    buttonExit.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.page = new MainMenu();
        }

    });
    buttonExit.pad(20);

    LabelStyle headingStyle = new LabelStyle(font60, Color.BLACK);

    final TextButton toggleLevel = new TextButton("Map: " + availableMaps[selectedMap].getName(),
            textButtonStyle);
    toggleLevel.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            selectedMap++;
            if (selectedMap >= availableMaps.length)
                selectedMap = 0;

            toggleLevel.setText("Map: " + availableMaps[selectedMap].getName());
        }
    });

    final TextButton togglePlayeLimit = new TextButton("players: " + playerLimit[playerLimitIndex],
            textButtonStyle);
    togglePlayeLimit.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            playerLimitIndex++;
            if (playerLimitIndex >= playerLimit.length)
                playerLimitIndex = 0;

            togglePlayeLimit.setText("players: " + playerLimit[playerLimitIndex]);
        }
    });
    heading = new Label("Game modes", headingStyle);

    table.add(heading);
    table.row();
    table.padBottom(50);
    table.add(buttonTut);
    table.row();
    table.padBottom(50);
    table.add(buttonPlay);
    table.row();
    table.padBottom(50);
    table.add(toggleLevel);
    table.row();
    table.padBottom(50);
    table.add(togglePlayeLimit);
    table.row();
    table.padBottom(50);
    table.add(buttonExit);
    //table.debug();
    stage.addActor(table);
    //xOffset = (Gdx.graphics.getWidth() / 100 * 65);
    xOffset = (int) table.getX() + (int) toggleLevel.getRight() + (Gdx.graphics.getWidth() / 2);
    yOffset = Gdx.graphics.getHeight() / 2 - (availableMaps[selectedMap].getHeight() / 5);

}

From source file:scenes.GameSummary.java

@Override
public void create() {

    layout = new GlyphLayout();
    batch = new SpriteBatch();

    //initialize fonts
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 60;//from  www . j av a  2s .c  om
    font60 = generator.generateFont(parameter); // font size 12 pixels
    font60.setColor(Color.BLACK);
    parameter.size = 40;
    font30 = generator.generateFont(parameter); // font size 12 pixels
    font30.setColor(0.5f, 0.5f, 0.5f, 255);
    font30Fade = generator.generateFont(parameter); // font size 12 pixels
    font30Fade.setColor(0.5f, 0.5f, 0.5f, 255);
    parameter.size = 25;
    font25 = generator.generateFont(parameter); // font size 12 pixels
    font25.setColor(Color.BLACK);
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    //prepare buttons
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);
    atlas = new TextureAtlas("ui/buttonPack.pack");
    skin = new Skin(atlas);
    table = new Table();

    Label.LabelStyle headStyle = new Label.LabelStyle(font60, Color.BLACK);
    Label.LabelStyle headStyleOptions = new Label.LabelStyle(font25, CircleColors.black);
    Label heading = new Label("Highscores", headStyle);

    table.row();
    table.add(new Label("", headStyle)).colspan(2).width(600);
    table.row();
    table.add(heading).colspan(2).align(Align.center);
    table.row();
    table.add(new Label("Map: " + match.getMap().getName(), headStyleOptions)).align(Align.left);
    table.row();
    table.add(new Label("Gamemode: " + match.getGameMode().getName(), headStyleOptions)).align(Align.left);

    Label.LabelStyle headingStyle = new Label.LabelStyle(font25, Color.BLACK);

    table.row();
    table.add(new Label("Player", headingStyle)).align(Align.left).padTop(15);
    table.add(new Label("Score", headingStyle)).align(Align.right).padTop(15);

    for (Player player : match.getPlayers()) {
        table.row();
        table.add(new Label(player.getName(), headingStyle)).align(Align.left).padTop(10);
        table.add(new Label(Integer.toString(player.getScore()), headingStyle)).align(Align.right).padTop(10);
    }

    final TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.downFontColor = new Color(0f, 0.57f, 0.92f, 1f);
    textButtonStyle.overFontColor = new Color(0f, 0.57f, 1f, 1f);
    textButtonStyle.font = font30;
    textButtonStyle.fontColor = Color.BLACK;

    buttonBack = new TextButton("Main menu", textButtonStyle);
    buttonBack.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            textButtonStyle.font = font30;
            GameClient.leaveGames();
            //Config.page = new MainMenu();
        }

    });
    buttonBack.pad(20);

    table.row();
    table.add(buttonBack).colspan(2).align(Align.center).padTop(30);
    table.setBounds(Gdx.graphics.getWidth() / 2 - 300, Gdx.graphics.getHeight() / 2 - table.getHeight() / 2,
            600, 0);
    stage.addActor(table);
}

From source file:scenes.GameWaiting.java

@Override
public void create() {
    layout = new GlyphLayout();
    batch = new SpriteBatch();

    //initialize fonts
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 60;/*from w w w .j ava 2  s . c om*/
    font60 = generator.generateFont(parameter); // font size 12 pixels
    font60.setColor(Color.BLACK);
    parameter.size = 40;
    font30 = generator.generateFont(parameter); // font size 12 pixels
    font30.setColor(0.38f, 0.38f, 0.38f, 1f);
    font30Fade = generator.generateFont(parameter); // font size 12 pixels
    font30Fade.setColor(0.38f, 0.38f, 0.38f, 1f);
    parameter.size = 25;
    font25 = generator.generateFont(parameter); // font size 12 pixels
    font25.setColor(Color.BLACK);
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    fade = new FontFade(font30Fade);

    //prepare buttons
    stage = new Stage();

    Gdx.input.setInputProcessor(stage);
    atlas = new TextureAtlas("ui/buttonPack.pack");
    skin = new Skin(atlas);
    table = new Table(skin);
    table.setBounds(0, -150, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    final TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.downFontColor = new Color(0f, 0.57f, 0.92f, 1f);
    textButtonStyle.overFontColor = new Color(0f, 0.57f, 1f, 1f);
    textButtonStyle.font = font30;
    textButtonStyle.fontColor = Color.BLACK;

    cancelButton = new TextButton("Cancel", textButtonStyle);
    cancelButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            GameClient.leaveGames();
            Config.page = new GameModeSelect();
        }

    });

    cancelButton.pad(20);

    table.add(cancelButton);
    stage.addActor(table);

    GameClient.joinGame(gameMode, map, numberOfPlayers);
}

From source file:scenes.PauseScreen.java

@Override
public void create() {
    stage = new Stage();
    previouspProcessor = Gdx.input.getInputProcessor();
    Gdx.input.setInputProcessor(stage);/* w  w  w .  j  ava  2  s  .  c  o  m*/

    stage.addListener(new InputListener() {
        @Override
        public boolean keyDown(InputEvent event, int keycode) {
            if (keycode == Input.Keys.ESCAPE) {
                Gdx.input.setInputProcessor(previouspProcessor);
                Config.overlay = null;
            }
            return true;
        }
    });
    atlas = new TextureAtlas("ui/buttonPack.pack");
    skin = new Skin(atlas);

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    //initialize fonts
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 60;
    font60 = generator.generateFont(parameter); // font size 12 pixels
    font60.setColor(Color.BLACK);
    parameter.size = 40;
    font30 = generator.generateFont(parameter); // font size 12 pixels
    font30.setColor(0.5f, 0.5f, 0.5f, 255);
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    final TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.downFontColor = new Color(0f, 0.57f, 0.92f, 1f);
    textButtonStyle.overFontColor = new Color(0f, 0.57f, 1f, 1f);
    textButtonStyle.font = font30;
    textButtonStyle.fontColor = Color.BLACK;

    Label.LabelStyle headingStyle = new Label.LabelStyle(font60, Color.BLACK);

    //Add head
    table.add(new Label("", headingStyle)).width(300);
    table.row();
    table.row().padBottom(20);
    table.add(new Label("In-game menu", headingStyle)).align(Align.center);

    //Add return to game button
    TextButton returnToGame = new TextButton("Return to game", textButtonStyle);
    returnToGame.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Gdx.input.setInputProcessor(previouspProcessor);
            Config.overlay = null;
        }
    });
    table.row().padBottom(10);
    table.add(returnToGame).align(Align.center);

    //Add quit game button
    TextButton quitGame = new TextButton("Quit game", textButtonStyle);
    quitGame.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            GameClient.leaveGames();
            Config.overlay = null;
            Config.page = new MainMenu();
        }
    });
    table.row().padBottom(10);
    table.add(quitGame).align(Align.center);

    //table.debug();
    stage.addActor(table);

}

From source file:scenes.SelectServer.java

@Override
public void create() {
    layout = new GlyphLayout();
    batch = new SpriteBatch();
    enteredName = Config.serverIp;//  ww  w  .  ja  v  a  2  s .c  o m
    Config.username = "";
    numberOfChars = enteredName.length();
    maxNumberOfChars = 10;

    //initialize fonts
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 60;
    font60 = generator.generateFont(parameter); // font size 12 pixels
    font60.setColor(Color.BLACK);
    parameter.size = 40;
    font30 = generator.generateFont(parameter); // font size 12 pixels
    font30.setColor(0.38f, 0.38f, 0.38f, 1f);
    font30Fade = generator.generateFont(parameter); // font size 12 pixels
    font30Fade.setColor(0.38f, 0.38f, 0.38f, 1f);
    parameter.size = 25;
    font25 = generator.generateFont(parameter); // font size 12 pixels
    font25.setColor(Color.BLACK);
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    fade = new FontFade(font30Fade);

    //prepare buttons
    stage = new Stage() {

        @Override
        public boolean keyDown(int keyCode) {
            if (keyCode == Input.Keys.ENTER) {
                setServerIP();
            }
            return true;
        }

        @Override
        public boolean keyTyped(char character) {
            if (character == '\b' && enteredName.length() > 0) {
                enteredName = enteredName.substring(0, enteredName.length() - 1);
            }
            if (character == '\b' || character == '\t' || character == '\n' || character == '\r'
                    || character == '\f' || character == '`' || character == '\u0000'
                    || enteredName.length() >= 30) {
                return true;
            }

            enteredName += character;
            return true;
        }
    };
    Gdx.input.setInputProcessor(stage);
    atlas = new TextureAtlas("ui/buttonPack.pack");
    skin = new Skin(atlas);
    table = new Table(skin);
    table.setBounds(0, -150, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    final TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.downFontColor = new Color(0f, 0.57f, 0.92f, 1f);
    textButtonStyle.overFontColor = new Color(0f, 0.57f, 1f, 1f);
    textButtonStyle.font = font30;
    textButtonStyle.fontColor = Color.BLACK;

    buttonStart = new TextButton("Play", textButtonStyle);
    buttonStart.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (enteredName.length() == 0)
                return;

            setServerIP();
        }

    });
    buttonStart.pad(20);

    table.add(buttonStart);
    stage.addActor(table);
}

From source file:scenes.SettingsScreen.java

@Override
public void create() {
    stage = new Stage();

    Gdx.input.setInputProcessor(stage);//from  ww w . j av a2s . com

    atlas = new TextureAtlas("ui/buttonPack.pack");
    skin = new Skin(atlas);

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    //initialize fonts
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 60;
    font60 = generator.generateFont(parameter); // font size 12 pixels
    font60.setColor(Color.BLACK);
    parameter.size = 40;
    font30 = generator.generateFont(parameter); // font size 12 pixels
    font30.setColor(0.5f, 0.5f, 0.5f, 255);
    parameter.size = 25;
    font25 = generator.generateFont(parameter); // font size 12 pixels
    font25.setColor(Color.BLACK);
    generator.dispose(); // don't forget to dispose to avoid memory leaks!

    final TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.downFontColor = new Color(0f, 0.57f, 0.92f, 1f);
    textButtonStyle.overFontColor = new Color(0f, 0.57f, 1f, 1f);
    textButtonStyle.font = font30;
    textButtonStyle.fontColor = Color.BLACK;

    Label.LabelStyle headingStyle = new Label.LabelStyle(font60, Color.BLACK);
    Label.LabelStyle labelStyle = new Label.LabelStyle(font30, Color.BLACK);

    //Add head
    table.add(new Label("", headingStyle)).width(300);
    table.add(new Label("", headingStyle)).width(300);
    table.row();
    table.add(new Label("Settings", headingStyle)).colspan(2).align(Align.center);

    //Add fullscreen config
    TextButton toggleFullscreen = new TextButton(Config.fullscreen ? "True" : "False", textButtonStyle);
    toggleFullscreen.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.fullscreen = !Config.fullscreen;

            Gdx.graphics.setDisplayMode(Config.resolutionWidth, Config.resolutionHeight, Config.fullscreen);

            Config.page = new SettingsScreen();
        }
    });
    table.row().padBottom(10);
    table.add(new Label("Fullscreen", labelStyle)).align(Align.left);
    table.add(toggleFullscreen).align(Align.right);

    //Add fullscreen config
    TextButton toggleResolution = new TextButton(Config.resolutionWidth + "x" + Config.resolutionHeight,
            textButtonStyle);
    toggleResolution.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            List<String> resolutions = Arrays.asList("1024x768", "1600x900", "1680x1050", "1920x1080");
            String currentResolution = Config.resolutionWidth + "x" + Config.resolutionHeight;
            int index = 0;
            for (String resolution : resolutions) {
                index++;

                if (currentResolution.equals(resolution)) {
                    break;
                }
            }
            if (resolutions.size() <= index) {
                index = 0;
            }

            String[] newResolution = resolutions.get(index).split("x");
            Config.resolutionWidth = Integer.parseInt(newResolution[0]);
            Config.resolutionHeight = Integer.parseInt(newResolution[1]);

            Gdx.graphics.setDisplayMode(Config.resolutionWidth, Config.resolutionHeight, Config.fullscreen);

            Config.page = new SettingsScreen();
        }
    });
    table.row().padBottom(10);
    table.add(new Label("Resolution", labelStyle)).align(Align.left);
    table.add(toggleResolution).align(Align.right);

    //Add Music config
    TextButton toggleSound = new TextButton(Config.sound ? "True" : "False", textButtonStyle);
    toggleSound.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.sound = !Config.sound;
            if (!Config.sound) {
                Config.music.stop();
            } else {
                long id = Config.music.loop();
                Config.music.setVolume(id, 0.25f);
            }

            Config.page = new SettingsScreen();
        }
    });
    table.row().padBottom(10);
    table.add(new Label("Music", labelStyle)).align(Align.left);
    table.add(toggleSound).align(Align.right);

    //Add Sound Effect config
    TextButton toggleSoundfx = new TextButton(Config.soundfx ? "True" : "False", textButtonStyle);
    toggleSoundfx.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.soundfx = !Config.soundfx;

            Config.page = new SettingsScreen();
        }
    });
    table.row().padBottom(10);
    table.add(new Label("Sound Effect", labelStyle)).align(Align.left);
    table.add(toggleSoundfx).align(Align.right);

    //Add debug config
    TextButton toggleDebug = new TextButton(Config.debug ? "True" : "False", textButtonStyle);
    toggleDebug.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.debug = !Config.debug;
            if (Config.debug)
                GameClient.getClient().updateReturnTripTime();

            Config.page = new SettingsScreen();
        }
    });
    table.row().padBottom(10);
    table.add(new Label("Debug", labelStyle)).align(Align.left);
    table.add(toggleDebug).align(Align.right);

    // Add back button
    TextButton buttonBack = new TextButton("Back", textButtonStyle);
    buttonBack.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Config.page = new MainMenu();
        }
    });
    table.row().padBottom(10);
    table.add(buttonBack);

    final TextButton.TextButtonStyle textSaveButtonStyle = new TextButton.TextButtonStyle();
    textSaveButtonStyle.downFontColor = new Color(0f, 0.57f, 0.92f, 1f);
    textSaveButtonStyle.overFontColor = new Color(0f, 0.57f, 1f, 1f);
    textSaveButtonStyle.font = font30;
    textSaveButtonStyle.fontColor = Color.BLACK;
    TextButton buttonApply = new TextButton("Save", textSaveButtonStyle);
    buttonApply.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            saveProperties();
            textSaveButtonStyle.fontColor = new Color(0.15f, 0.68f, 0.37f, 1f);
            textSaveButtonStyle.downFontColor = new Color(0.15f, 0.68f, 0.37f, 1f);
            textSaveButtonStyle.overFontColor = new Color(0.15f, 0.68f, 0.37f, 1f);
        }
    });
    table.add(buttonApply);

    //table.debug();
    stage.addActor(table);

}