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:com.mygdx.game.TrafficLightDrawer.java

public void draw() {

    sr.setColor(Color.BLACK);
    float x = trafficLight.getXOnScreen(), y = trafficLight.getYOnScreen();
    float width = trafficLight.getWidth() + 8, height = trafficLight.getHeight() + 12;
    sr.rect(x, y, width, height);/*from ww w.  j  a  v a 2 s.  c  o  m*/

    if (trafficLight.isYellow())
        sr.setColor(Color.YELLOW);
    else
        sr.setColor(Color.DARK_GRAY);
    sr.circle(x + width / 2, y + height / 2, trafficLight.getRadius());

    if (trafficLight.isGreen())
        sr.setColor(Color.GREEN);
    else
        sr.setColor(Color.DARK_GRAY);
    sr.circle(x + width / 2, y + width / 2 - 1, trafficLight.getRadius());

    if (trafficLight.isRed())
        sr.setColor(Color.RED);
    else
        sr.setColor(Color.DARK_GRAY);
    sr.circle(x + width / 2, y + 2 * width + 3, trafficLight.getRadius());
}

From source file:com.mygdx.gui.Element.java

License:Open Source License

public void draw(Batch batch, float parentAlpha) {
    if (sprite != null) {
        sprite.setSize(width, height);/*from ww w. j  a  v a2s.  com*/
        sprite.setCenterX(x);
        sprite.setCenterY(y);
        sprite.setAlpha(parentAlpha);
        sprite.draw(batch, parentAlpha);
        if (mess != null) {
            MYGDXGAME.game.draw(batch, mess, x - 40, y + getHeight() / 2 - 70, Color.BLACK,
                    Game.fontSizes.STANDART);
        }
    }
}

From source file:com.mygdx.gui.UpgradeButton.java

@Override
public void draw(Batch batch, float parentAlpha) {
    sprite.setColor(MYGDXGAME.game.moneys >= price ? Color.WHITE : Color.GRAY);
    if (sprite != null) {
        sprite.setSize(width, height);//from w w w  .ja v  a2 s  .  co m
        sprite.setCenterX(x);
        sprite.setCenterY(y);
        sprite.setAlpha(parentAlpha);
        sprite.draw(batch, parentAlpha);
        if (mess != null) {
            MYGDXGAME.game.draw(batch, mess, x - 40, y + getHeight() / 2 - 20, Color.BLACK,
                    Game.fontSizes.STANDART);
        }
    }
    if (desc != null)
        MYGDXGAME.game.draw(batch, desc, x - getWidth() / 2 + 30, y + getHeight() / 2 - 60, Color.BLACK,
                Game.fontSizes.STANDART);
    MYGDXGAME.game.draw(batch, "$" + price, x - getWidth() / 2 + 30, y + getHeight() / 2 - 100, Color.RED,
            Game.fontSizes.STANDART);
}

From source file:com.mygdx.jogo.Jogador.java

/**Mtodo utilizado para ao termino de uma jogada fazer as casas voltarem a sua cor inicial
*
*///  w  ww .  j a  v  a  2 s.c om
public void ocultarVizinhos() {
    for (List<MovimentoEstado> vizinho : caminhos) {
        vizinho.get(0).c.imagem.setColor(Color.BLACK);
    }
}

From source file:com.mygdx.jogo.Tabuleiro.java

/**Mtodo utilizado para alocar as peas ao estado incial de um jogo de damas,
* instanciando 12 peas do jogador1, 12 peas do jogador2 e 64 casas ,colorindo tanto peas quanto as casas do tabuleiro.
*//*from ww w .  j  av  a2 s  .c  om*/
public void reiniciarTabuleiro() {
    matrizCasas = new Casa[altura][largura];
    Color cor = Color.WHITE;
    for (int lin = 0; lin < altura; lin++) {

        for (int col = 0; col < largura; col++) {
            //Define uma cor para uma casa de acorda com sua posio na matriz
            if (par(lin) && par(col)) {
                cor = Color.BLACK;
            } else if (!par(lin) && !par(col)) {
                cor = Color.BLACK;
            } else {
                cor = Color.WHITE;
            }
            //Configura a posio de cada casa de acordo com suas dimeses e ordem  
            matrizCasas[lin][col] = new Casa(posX + Casa.LARGURA * col, posY + Casa.ALTURA * lin, cor);
            //Salva as posies da matriz na casa.
            matrizCasas[lin][col].setPosicaoMatriz(lin, col);
            if (estado.matriz[lin][col] == Estado.PECAJOGADOR1) {
                //Adiciona peas nas trs primeiras linhas do tabuleiro.
                matrizCasas[lin][col].peca = new Peca(posX + Casa.LARGURA * col, posY + Casa.ALTURA * lin);
                matrizCasas[lin][col].peca.imagem.setColor(Jogo.COLORJOGADOR1);
                matrizCasas[lin][col].peca.setColorOriginal(Jogo.COLORJOGADOR1);//lol isso deve estar dentro de peca !!
                Jogo.getInstance().getJogador1().getPecas().add(matrizCasas[lin][col].peca);
            } else if (estado.matriz[lin][col] == Estado.PECAJOGADOR2) {//Adiciona peas nas trs ltimas linhas do tabuleiro.
                matrizCasas[lin][col].peca = new Peca(posX + Casa.LARGURA * col, posY + Casa.ALTURA * lin);
                matrizCasas[lin][col].peca.imagem.setColor(Jogo.COLORJOGADOR2);
                matrizCasas[lin][col].peca.setColorOriginal(Jogo.COLORJOGADOR2);
                Jogo.getInstance().getJogador2().getPecas().add(matrizCasas[lin][col].peca);

            }
        }
    }
}

From source file:com.o2d.pkayjava.editor.view.ui.followers.PolygonFollower.java

License:Apache License

public void drawPoints() {
    for (int i = 0; i < originalPoints.size(); i++) {
        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
        shapeRenderer.setColor(Color.WHITE);
        if (selectedAnchorId == i) {
            shapeRenderer.setColor(Color.ORANGE);
        }//www .jav a 2  s. c o  m
        float side = (float) (ANCHOR_SIZE) / ((float) pixelsPerWU / runtimeCamera.zoom);
        float onePixel = 1f / ((float) pixelsPerWU / runtimeCamera.zoom);
        shapeRenderer.rect(originalPoints.get(i).x * transformComponent.getScaleX() - side / 2f,
                originalPoints.get(i).y * transformComponent.getScaleY() - side / 2f, side, side);
        shapeRenderer.setColor(Color.BLACK);
        shapeRenderer.rect(originalPoints.get(i).x * transformComponent.getScaleX() - side / 2f + onePixel,
                originalPoints.get(i).y * transformComponent.getScaleY() - side / 2f + onePixel,
                side - 2 * onePixel, side - 2 * onePixel);
        shapeRenderer.end();
    }
}

From source file:com.o2d.pkayjava.editor.view.ui.widget.components.color.CustomColorPicker.java

License:Apache License

public CustomColorPicker(String title, ColorPickerListener listener) {
    super(title);
    this.listener = listener;

    setModal(true);//from   w ww . j av a 2  s .c  om
    setMovable(true);

    addCloseButton();
    closeOnEscape();

    oldColor = new Color(Color.BLACK);
    color = new Color(Color.BLACK);
    tmpColor = new Color(Color.BLACK);

    createColorWidgets();
    createUI();
    createListeners();
    initPixmaps();

    pack();
    centerWindow();

    setStyle(VisUI.getSkin().get("box", WindowStyle.class));
    getTitleLabel().setAlignment(Align.left);
}

From source file:com.paperscape.game.GameAssets.java

public static void loadAssets() {

    //how long the app will wait between screen in milliseconds. Is ran when the game changes a screen
    waitTimeForScreens = 200;//from w  w  w .  j  a  v a  2  s  .c om
    //how long the game will wait in milliseconds. Used so the same touch doesn't retstart the game when the pause button is pressed
    waitTimeForPause = 100;
    //how long the game will wait in milliseconds. Helps Android by not playing music as soon as it is created
    timeForMusicToLoad = 100;

    //when called and initialised is set to the resolution of the screen, allows sprite batch to draw to screen
    camera = new OrthographicCamera();
    //the resolution of the game, currently 1080p HD as it will be scaled down for smaller screens
    screenResolutionX = 1920;
    screenResolutionY = 1080;
    //holds the position of a touch made on the screen
    touch = new Vector3();
    //the spritebatch used by Level, Menu etc. to draw objects to screen
    batch = new SpriteBatch();
    //used to check position of enemy waypoints
    shapeRenderer = new ShapeRenderer();

    //initialising paperBackgroundTexture object as walls_image file in menu folder
    paperBackgroundTexture = new Texture(Gdx.files.internal("paper-background.png"));
    //used for scaling
    paperBackgroundTexture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    //initialising a sprite which will hold the paperBackgroundTexture
    paperBackgroundSprite = new Sprite(paperBackgroundTexture);

    //-------------------------------------------------------------------------
    //the size of each individual sprite (i.e. 128 = 128x128 sprite image)
    frameSize = 128;
    //the position of each of the frames within a sprite sheet
    //0, 0 is the top left of the sprite sheet
    framePosition01X = 0;
    framePosition01Y = 0;
    framePosition02X = frameSize;
    framePosition02Y = 0;
    framePosition03X = (frameSize * 2);
    framePosition03Y = 0;
    framePosition04X = (frameSize * 3);
    framePosition04Y = 0;
    framePosition05X = 0;
    framePosition05Y = frameSize;
    framePosition06X = frameSize;
    framePosition06Y = frameSize;
    framePosition07X = (frameSize * 2);
    framePosition07Y = frameSize;
    framePosition08X = (frameSize * 3);
    framePosition08Y = frameSize;
    framePosition09X = 0;
    framePosition09Y = (frameSize * 2);
    framePosition10X = frameSize;
    framePosition10Y = (frameSize * 2);
    framePosition11X = (frameSize * 2);
    framePosition11Y = (frameSize * 2);
    framePosition12X = (frameSize * 3);
    framePosition12Y = (frameSize * 2);
    framePosition13X = 0;
    framePosition13Y = (frameSize * 3);
    framePosition14X = frameSize;
    framePosition14Y = (frameSize * 3);
    framePosition15X = (frameSize * 2);
    framePosition15Y = (frameSize * 3);
    framePosition16X = (frameSize * 3);
    framePosition16Y = (frameSize * 3);

    //initialising the first sprite sheet from an image in the 'assets' folder
    spriteSheet1 = new Texture(Gdx.files.internal("sprite_sheet_1.png"));
    //declaring each sprite, (what texture are they from, X-position, Y-position, X-size, Y-size);
    playerSprite = new Sprite(spriteSheet1, framePosition01X, framePosition01Y, frameSize, frameSize);
    enemySprite = new Sprite(spriteSheet1, framePosition02X, framePosition02Y, frameSize, frameSize);
    textBackgroundSprite = new Sprite(spriteSheet1, framePosition03X, framePosition03Y, frameSize, frameSize);
    pauseButtonSprite = new Sprite(spriteSheet1, framePosition04X, framePosition04Y, frameSize, frameSize);
    leftArrowSprite = new Sprite(spriteSheet1, framePosition05X, framePosition05Y, frameSize, frameSize);
    upArrowSprite = new Sprite(spriteSheet1, framePosition06X, framePosition06Y, frameSize, frameSize);
    leftArrowSpritePressed = new Sprite(spriteSheet1, framePosition07X, framePosition07Y, frameSize, frameSize);
    upArrowSpritePressed = new Sprite(spriteSheet1, framePosition08X, framePosition08Y, frameSize, frameSize);
    sightVerticalDownSprite = new Sprite(spriteSheet1, framePosition09X, framePosition09Y, frameSize,
            frameSize);
    sightHorisontalRightSprite = new Sprite(spriteSheet1, framePosition10X, framePosition10Y, frameSize,
            frameSize);
    levelButtonSprite = new Sprite(spriteSheet1, framePosition11X, framePosition11Y, frameSize, frameSize);
    lockedLevelSprite = new Sprite(spriteSheet1, framePosition12X, framePosition12Y, frameSize, frameSize);
    yellowButtonSprite = new Sprite(spriteSheet1, framePosition13X, framePosition13Y, frameSize, frameSize);
    creditsButtonSprite = new Sprite(spriteSheet1, framePosition14X, framePosition14Y, frameSize, frameSize);
    restartButtonSprite = new Sprite(spriteSheet1, framePosition15X, framePosition15Y, frameSize, frameSize);
    levelSelectMenuSprite = new Sprite(spriteSheet1, framePosition16X, framePosition16Y, frameSize, frameSize);

    //initialising a sprite for an enemy sight pointing up from the sprite for a sight facing down
    sightVerticalUpSprite = new Sprite(spriteSheet1, framePosition09X, framePosition09Y, frameSize, frameSize);
    //the sprite needs to be flipped vertically (boolean X, boolean Y)
    sightVerticalUpSprite.flip(false, true);
    //initialising a sprite for an enemy sight pointing left from the sprite for a sight facing right
    sightHorisontalLeftSprite = new Sprite(spriteSheet1, framePosition10X, framePosition10Y, frameSize,
            frameSize);
    //the sprite needs to be flipped horizontally (boolean X, boolean Y)
    sightHorisontalLeftSprite.flip(true, false);

    //sprite for the right arrow of GUI controls
    rightArrowSprite = new Sprite(spriteSheet1, framePosition05X, framePosition05Y, frameSize, frameSize);
    //needs to be flipped horizontally (boolean X, boolean Y)
    rightArrowSprite.flip(true, false);
    //sprite for when the right arrow of GUI controls is pressed
    rightArrowSpritePressed = new Sprite(spriteSheet1, framePosition07X, framePosition07Y, frameSize,
            frameSize);
    //needs to be flipped horizontally (boolean X, boolean Y)
    rightArrowSpritePressed.flip(true, false);

    //sprite for the down arrow of GUI controls
    downArrowSprite = new Sprite(spriteSheet1, framePosition06X, framePosition06Y, frameSize, frameSize);
    //needs to be flipped vertically (boolean X, boolean Y)
    downArrowSprite.flip(false, true);
    //sprite for when the down arrow of GUI controls is pressed
    downArrowSpritePressed = new Sprite(spriteSheet1, framePosition08X, framePosition08Y, frameSize, frameSize);
    //needs to be flipped vertically (boolean X, boolean Y)
    downArrowSpritePressed.flip(false, true);

    //locating the second sprite sheet
    spriteSheet2 = new Texture(Gdx.files.internal("sprite_sheet_2.png"));
    //declaring each sprite, (what texture are they from, X-position, Y-position, X-size, Y-size);
    soundOnSprite = new Sprite(spriteSheet2, framePosition01X, framePosition01Y, frameSize, frameSize);
    soundOffSprite = new Sprite(spriteSheet2, framePosition02X, framePosition02Y, frameSize, frameSize);
    pauseBackgroundSprite = new Sprite(spriteSheet2, framePosition03X, framePosition03Y, frameSize, frameSize);
    exitButtonSprite = new Sprite(spriteSheet2, framePosition04X, framePosition04Y, frameSize, frameSize);
    doorSprite = new Sprite(spriteSheet2, framePosition05X, framePosition05Y, frameSize, frameSize);
    backButtonSprite = new Sprite(spriteSheet2, framePosition06X, framePosition06Y, frameSize, frameSize);
    doorButtonSprite = new Sprite(spriteSheet2, framePosition07X, framePosition07Y, frameSize, frameSize);
    doorButtonActiveSprite = new Sprite(spriteSheet2, framePosition08X, framePosition08Y, frameSize, frameSize);
    wallSprite1 = new Sprite(spriteSheet2, framePosition09X, framePosition09Y, frameSize, frameSize);
    wallSprite2 = new Sprite(spriteSheet2, framePosition10X, framePosition10Y, frameSize, frameSize);
    wallSprite3 = new Sprite(spriteSheet2, framePosition11X, framePosition11Y, frameSize, frameSize);
    wallSprite4 = new Sprite(spriteSheet2, framePosition12X, framePosition12Y, frameSize, frameSize);
    wallSprite5 = new Sprite(spriteSheet2, framePosition13X, framePosition13Y, frameSize, frameSize);

    //-----------------------------------Screen-bounds-rectangles---------------------------------------
    //rectange shape for screen boundaries (X-position, Y-position, X-width, Y-height)
    screenBounds_left = new Rectangle(-10, 0, 10, 1080);
    screenBounds_right = new Rectangle(1915, 0, 10, 1080);
    screenBounds_top = new Rectangle(0, 1080, 1925, 10);
    screenBounds_bottom = new Rectangle(0, 290, 1925, 10);

    //-------------------------------------Setting-up-fonts---------------------------------------------
    fontRobotoRegular = new BitmapFont(Gdx.files.internal("fonts/roboto_regular_bitmap.fnt"), false);
    fontRobotoRegular.setColor(Color.BLACK);
    fontRobotoRegular.getData().setScale(1f);

    fontRobotoThinBold = new BitmapFont(Gdx.files.internal("fonts/roboto_thin_bold_bitmap.fnt"), false);
    fontRobotoThinBold.setColor(Color.BLACK);
    fontRobotoThinBold.getData().setScale(1f);

    //----------------------------------Strings-used-by-the-game----------------------------------------
    trackTitle = "<---";
    trackArtist = "Please";
    trackAlbum = "Select";
    license = "a";
    licenseLink = "Music";
    changesMade = "Track";

    //---------------------------------Preferences-for-user-data----------------------------------------
    //create of load the preferences XML file
    prefs = Gdx.app.getPreferences(PAPERSCAPE_PREFERENCES);
    //if there is no value for completed level, then set it to 1
    if (!prefs.contains(MAX_LEVEL_COMPLETED)) {
        prefs.putInteger(MAX_LEVEL_COMPLETED, 1);
        //save the preferences file
        prefs.flush();
    }
    //if there is no value for volume being toggled, then set it to true
    if (!prefs.contains(SOUND_IS_TOGGLED)) {
        prefs.putBoolean(SOUND_IS_TOGGLED, true);
        //save the preferences file
        prefs.flush();
    }
    //if there is no value for the total amount of stars, set it to 0
    if (!prefs.contains(TOTAL_STARS_COLLECTED)) {
        prefs.putInteger(TOTAL_STARS_COLLECTED, 0);
        //save the preferences file
        prefs.flush();
    }
    //if there is no value for the current amount of stars, set it to 0
    if (!prefs.contains(CURRENT_AMOUNT_OF_STARS)) {
        prefs.putInteger(CURRENT_AMOUNT_OF_STARS, 0);
        //save the preferences file
        prefs.flush();
    }
    //if there is no value for the total amount of deaths, set it to 0
    if (!prefs.contains(TOTAL_DEATHS)) {
        prefs.putInteger(TOTAL_DEATHS, 0);
        //save the preferences file
        prefs.flush();
    }

    //----------------------------Loading Music and Sounds to assetManager--------------------
    assetManager = new AssetManager();
    //store a sound object in the assetManager
    assetManager.load("sounds/star_pickup.mp3", Sound.class);
    //load all of the music files used by game
    //menu music
    assetManager.load("sounds/dj.mp3", Music.class);
    //level music
    assetManager.load("sounds/acid_jazz.ogg", Music.class);
    //level complete music
    assetManager.load("sounds/new_hamra.mp3", Music.class);
    //captured music
    assetManager.load("sounds/autoguano.mp3", Music.class);
    //tell the assetManager that all loading is done
    assetManager.finishLoading();

    //output the current max level completed to the console
    Gdx.app.log(MAX_LEVEL_COMPLETED, Integer.toString(getMaxLevelCompleted()));
    //--------------------------------------------------------------------------------------------------
}

From source file:com.paperscape.game.MenuManager.java

public void draw(SpriteBatch batch) {

    //DeltaTime is the time in-between frames - the state time is being added to the delta time - true means isLooping
    stateTime += Gdx.graphics.getDeltaTime();
    GameAssets.starCurrentFrame = GameAssets.starAnim.getKeyFrame(stateTime, true);
    GameAssets.flagCurrentFrame = GameAssets.flagAnim.getKeyFrame(stateTime, true);

    //draw the background sprite from GameAssets Class onto the SpriteBatch. This makes it visible on screen
    batch.draw(GameAssets.paperBackgroundSprite, 0, 0, GameAssets.screenResolutionX,
            GameAssets.screenResolutionY);

    //if there are any level levelSelectMenuButtons in a screen, draw them
    for (int i = 0; i < levelButtonCount; i++) {
        levelButtons[i].draw(batch);//  w  ww . j a  v  a 2  s . co  m
    }

    //draw any levelSelectMenuButtons to the screen
    for (int i = 0; i < levelSelectMenuButtonCount; i++) {
        levelSelectMenuButtons[i].draw(batch);
    }

    //draw a back button to the screen
    for (int i = 0; i < backButtonCount; i++) {
        backButtons[i].draw(batch);
    }

    //draw any main buttons to the screen
    for (int i = 0; i < mainButtonCount; i++) {
        mainButtons[i].draw(batch);
    }

    //draw any sub buttons to the screen
    for (int i = 0; i < subButtonCount; i++) {
        subButtons[i].draw(batch);
    }

    //draw buttons to take user to credits screen
    for (int i = 0; i < creditsButtonCount; i++) {
        creditsButtons[i].draw(batch);
    }

    //draw any restart buttons to the screen
    for (int i = 0; i < restartButtonCount; i++) {
        restartButtons[i].draw(batch);
    }

    //find any toggle sound buttons if they exist
    for (int i = 0; i < toggleSoundButtonCount; i++) {

        //if the sound is currently turned on
        if (GameAssets.getToggleSoundState()) {
            //set the image of the toggle sound button to its 'on' image
            toggleSoundButtons[i].buttonImage = GameAssets.soundOnSprite;
        }
        //if the sound is not currently toggled on
        else if (!GameAssets.getToggleSoundState()) {
            //set the image of the toggle sound button to its 'off' image
            toggleSoundButtons[i].buttonImage = GameAssets.soundOffSprite;
        }

        //draw all of the toggle sound buttons to the batch
        toggleSoundButtons[i].draw(batch);
    }

    //draw any exit buttons to the screen
    for (int i = 0; i < exitButtonCount; i++) {
        exitButtons[i].draw(batch);
    }

    //draw all enemies to the screen
    for (int i = 0; i < newEnemyCount; i++) {
        newEnemies[i].draw(batch);
    }

    //draw any underlineFonts (includes underlines for titles etc.)
    for (int i = 0; i < underlineFontCount; i++) {
        underlineFonts[i].draw(batch);
    }

    //draw any stars to the screen
    for (int i = 0; i < starCount; i++) {
        stars[i].draw(batch);
    }

    //draw any exit flags present in a menu
    for (int i = 0; i < flagCount; i++) {
        flags[i].draw(batch);
    }

    //---------------------------------Extra Assets for Different Screens-------------------------------
    //check what screen to display
    switch (currentScreen) {

    //--------------------------------------------------------------------------------------------------
    case MAIN_MENU_SCREEN:

        //size of the chosen font
        GameAssets.fontRobotoRegular.getData().setScale(1f);
        GameAssets.fontRobotoRegular.draw(batch, "Paperscape", 420, 1050);

        for (int i = 0; i < mainButtonCount; i++) {
            GameAssets.fontRobotoThinBold.getData().setScale(0.9f);
            GameAssets.fontRobotoThinBold.draw(batch, "Start", mainButtons[0].buttonBounds.getX() + 128,
                    mainButtons[0].buttonBounds.getY() + 95);
        }

        for (int i = 0; i < exitButtonCount; i++) {
            GameAssets.fontRobotoThinBold.getData().setScale(.6f);
            GameAssets.fontRobotoThinBold.draw(batch, "Exit", exitButtons[i].buttonBounds.getX() + 100,
                    exitButtons[i].buttonBounds.getY() + 60);
        }

        for (int i = 0; i < creditsButtonCount; i++) {
            GameAssets.fontRobotoThinBold.getData().setScale(.45f);
            GameAssets.fontRobotoThinBold.draw(batch, "Credits", creditsButtons[i].buttonBounds.getX() + 13,
                    creditsButtons[i].buttonBounds.getY() + 75);
            GameAssets.fontRobotoThinBold.getData().setScale(.65f);
        }

        break;

    //--------------------------------------------------------------------------------------------------
    case LEVEL_SELECT_SCREEN:

        //size of the chosen font
        GameAssets.fontRobotoRegular.getData().setScale(1f);
        //drawing text to the screen
        GameAssets.fontRobotoRegular.draw(batch, "Level Select", 380, 225);
        //change font colour to white for levelSelectMenuButtons
        GameAssets.fontRobotoThinBold.setColor(Color.WHITE);
        //reduce the size of the font to fit on top of button
        GameAssets.fontRobotoThinBold.getData().setScale(.55f);
        //drawing the font for level numbers on level levelSelectMenuButtons
        //for loop to find each button
        for (int i = 0; i < levelButtonCount; i++) {
            //holds the text to display a level number
            String levelNumber;
            //level number is equal to 1 as arrays start at 0
            int j = 1;
            //level number is equal to 1 + array value
            j += i;
            //convert level number to a string
            levelNumber = Integer.toString(j);

            openLevelsTextPosition = new Vector2(levelButtons[i].buttonBounds.x + 35,
                    levelButtons[i].buttonBounds.y + 125);
            lockedLevelsTextPosition = new Vector2(levelButtons[i].buttonBounds.x + 35,
                    levelButtons[i].buttonBounds.y + 85);

            if (levelButtons[i].levelButtonValue <= GameAssets.getMaxLevelCompleted()) {

                //if the level button leads to a level that is less than level 10
                if (j < 10) {
                    //draw text on top of each button
                    GameAssets.fontRobotoThinBold.draw(batch, "Level 0" + levelNumber, openLevelsTextPosition.x,
                            openLevelsTextPosition.y);
                }

                //if the level button leads to a level between level 10 and level 100
                if (j >= 10 && j < 100) {
                    //draw text on top of each button
                    GameAssets.fontRobotoThinBold.draw(batch, "Level " + levelNumber, openLevelsTextPosition.x,
                            openLevelsTextPosition.y);
                }
            }
            //otherwise if the level that the button leads to is locked, draw the text in a different position
            else if (!(levelButtons[i].levelButtonValue <= GameAssets.getMaxLevelCompleted())) {
                //if the level button leads to a level that is less than level 10
                if (j < 10) {
                    //draw text on top of each button
                    GameAssets.fontRobotoThinBold.draw(batch, "Level 0" + levelNumber,
                            lockedLevelsTextPosition.x, lockedLevelsTextPosition.y);
                }
                //if the level button leads to a level between level 10 and level 100
                if (j >= 10 && j < 100) {
                    //draw text on top of each button
                    GameAssets.fontRobotoThinBold.draw(batch, "Level " + levelNumber,
                            lockedLevelsTextPosition.x, lockedLevelsTextPosition.y);
                }
            }

        }

        //change the font colour back to default black
        GameAssets.fontRobotoThinBold.setColor(Color.BLACK);
        //change the size of the font back to its original value
        GameAssets.fontRobotoThinBold.getData().setScale(.6f);

        break;

    //--------------------------------------------------------------------------------------------------
    case LEVEL_COMPLETE_SCREEN:

        //setting the size of the chosen font
        GameAssets.fontRobotoRegular.getData().setScale(.8f);
        GameAssets.fontRobotoRegular.draw(batch, "Level Complete", 430, 1042);
        GameAssets.fontRobotoRegular.getData().setScale(1f);

        //setting the size of the chosen font
        GameAssets.fontRobotoThinBold.getData().setScale(.6f);
        //displaying info about the total stars collected by interrogating the prefs file
        //draw to screen (SpriteBatch batch, String textToDisplay, int x, int y, int width, int textAlignment, boolean wrapText)
        GameAssets.fontRobotoThinBold.draw(batch,
                "Total Stars Collected: " + GameAssets.getTotalStarsCollected(),
                (GameAssets.screenBounds_right.getX() - 650), 350, 600, 1, true);

        break;

    //--------------------------------------------------------------------------------------------------
    case DEATH_SCREEN:

        GameAssets.fontRobotoRegular.setColor(Color.RED);
        //size of the chosen font
        GameAssets.fontRobotoRegular.getData().setScale(1f);
        GameAssets.fontRobotoRegular.draw(batch, "Captured!", 530, 1050);
        GameAssets.fontRobotoRegular.setColor(Color.BLACK);

        /*                GameAssets.fontRobotoThinBold.getData().setScale(.6f);
        GameAssets.fontRobotoThinBold.draw(batch, "Times Caught: " + GameAssets.getTotalDeaths(), 1220, 790);*/

        break;

    //--------------------------------------------------------------------------------------------------
    case CREDITS_SCREEN:
        GameAssets.fontRobotoRegular.getData().setScale(.75f);
        GameAssets.fontRobotoRegular.draw(batch, "Credits", GameAssets.screenBounds_right.getX() - 500,
                GameAssets.screenBounds_top.getY() - 40);
        GameAssets.fontRobotoRegular.getData().setScale(1);

        for (int i = 0; i < mainButtonCount; i++) {
            GameAssets.fontRobotoThinBold.draw(batch, "Back", mainButtons[0].buttonBounds.x + 135,
                    mainButtons[0].buttonBoundsYEnd - 40);
        }

        for (int i = 0; i < subButtonCount; i++) {
            GameAssets.fontRobotoThinBold.draw(batch, "Menu Music",
                    subButtons[0].buttonBounds.x + buttonTextWidth,
                    subButtons[0].buttonBoundsYEnd - buttonTextHeight);
            GameAssets.fontRobotoThinBold.draw(batch, "Level Music",
                    subButtons[1].buttonBounds.x + buttonTextWidth,
                    subButtons[1].buttonBoundsYEnd - buttonTextHeight);
            GameAssets.fontRobotoThinBold.draw(batch, "Goal Music",
                    subButtons[2].buttonBounds.x + (buttonTextWidth + 10),
                    subButtons[2].buttonBoundsYEnd - buttonTextHeight);
            GameAssets.fontRobotoThinBold.draw(batch, "Caught Music",
                    subButtons[3].buttonBounds.x + (buttonTextWidth - 20),
                    subButtons[3].buttonBoundsYEnd - buttonTextHeight);
        }

        GameAssets.fontRobotoThinBold.draw(batch, "Music:", GameAssets.screenBounds_left.getX() + 40,
                GameAssets.screenBounds_top.getY() - 60);
        GameAssets.fontRobotoThinBold.draw(batch, "Programming, Graphics & Sound Effects By:",
                GameAssets.screenBounds_left.getX() + 40, GameAssets.screenBounds_bottom.getY() + 100);

        GameAssets.fontRobotoThinBold.draw(batch, "Alex Clarke", GameAssets.screenBounds_right.getX() - 350,
                GameAssets.screenBounds_bottom.getY() + 85);

        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.trackTitle, infoTextX, infoTextY);
        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.trackArtist, infoTextX, infoTextY - 60);
        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.trackAlbum, infoTextX, infoTextY - 120);
        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.license, infoTextX, infoTextY - 180);
        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.licenseLink, infoTextX, infoTextY - 240);
        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.changesMade, infoTextX, infoTextY - 300);

        break;
    }
}

From source file:com.punchables.rainbowdad.RainbowDad.java

@Override
public void create() {
    Gdx.app.log("LOG", "Creating RainbowDad.java...");
    batch = new SpriteBatch();

    font = new BitmapFont();
    font.setColor(Color.BLACK);
    font.setScale(2, 2);/*from  w ww  .ja  va2  s .co m*/
    this.setScreen(new MainMenuScreen(this));

    //Gdx.input.setInputProcessor(this);

}