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

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

Introduction

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

Prototype

Color WHITE

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

Click Source Link

Usage

From source file:com.badlogic.invaders.Renderer.java

License:Apache License

private void renderBackground() {
    viewMatrix.setToOrtho2D(0, 0, 400, 320);
    spriteBatch.setProjectionMatrix(viewMatrix);
    spriteBatch.begin();//w ww .j a  va  2 s. com
    spriteBatch.disableBlending();
    spriteBatch.setColor(Color.WHITE);
    spriteBatch.draw(backgroundTexture, 0, 0, 480, 320, 0, 0, 512, 512, false, false);
    spriteBatch.end();
}

From source file:com.badlogic.invaders.screens.GameOver.java

License:Apache License

@Override
public void draw(float delta) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    viewMatrix.setToOrtho2D(0, 0, 480, 320);
    spriteBatch.setProjectionMatrix(viewMatrix);
    spriteBatch.setTransformMatrix(transformMatrix);
    spriteBatch.begin();//from w  w  w  .  j  a  v  a2s .c  o  m
    spriteBatch.disableBlending();
    spriteBatch.setColor(Color.WHITE);
    spriteBatch.draw(background, 0, 0, 480, 320, 0, 0, 512, 512, false, false);
    spriteBatch.enableBlending();
    spriteBatch.draw(logo, 0, 320 - 128, 480, 128, 0, 256, 512, 256, false, false);
    String text = "It is the end my friend.\nTouch to continue!";
    TextBounds bounds = font.getMultiLineBounds(text);
    spriteBatch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
    font.drawMultiLine(spriteBatch, text, 0, 160 + bounds.height / 2, 480, HAlignment.CENTER);
    spriteBatch.end();
}

From source file:com.badlogic.invaders.screens.MainMenu.java

License:Apache License

@Override
public void draw(float delta) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    viewMatrix.setToOrtho2D(0, 0, 480, 320);
    spriteBatch.setProjectionMatrix(viewMatrix);
    spriteBatch.setTransformMatrix(transformMatrix);
    spriteBatch.begin();// www . jav a2  s  . co  m
    spriteBatch.disableBlending();
    spriteBatch.setColor(Color.WHITE);
    spriteBatch.draw(background, 0, 0, 480, 320, 0, 0, 512, 512, false, false);
    spriteBatch.enableBlending();
    spriteBatch.draw(logo, 0, 320 - 128, 480, 128, 0, 0, 512, 256, false, false);
    spriteBatch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
    String text = "Touch screen to start!";
    float width = font.getBounds(text).width;
    font.draw(spriteBatch, text, 240 - width / 2, 128);
    if (Gdx.app.getType() == ApplicationType.WebGL) {
        text = "Press Enter for Fullscreen Mode";
        width = font.getBounds(text).width;
        font.draw(spriteBatch, "Press Enter for Fullscreen Mode", 240 - width / 2, 128 - font.getLineHeight());
    }
    spriteBatch.end();
}

From source file:com.badlydrawngames.general.SimpleButton.java

License:Apache License

public void draw(SpriteBatch spriteBatch) {
    Color oldColor = font.getColor();
    if (down) {//from w  w w  .j  a v  a 2  s  .co  m
        spriteBatch.setColor(Color.RED);
    } else {
        spriteBatch.setColor(Color.BLUE);
    }
    spriteBatch.draw(Assets.pureWhiteTextureRegion, x, y, w, h);
    spriteBatch.setColor(Color.WHITE);
    if (down) {
        font.setColor(oldColor.r / 2, oldColor.g / 2, oldColor.b / 2, oldColor.a);
    }
    float textX = x;
    float textY = y + h;
    textY -= (h - textHeight) / 2;
    font.drawWrapped(spriteBatch, text, textX, textY, w, alignment);
    font.setColor(oldColor);
}

From source file:com.badlydrawngames.veryangryrobots.MainMenuScreen.java

License:Apache License

@Override
public void render(float delta) {
    updateButtons(delta);//  ww  w.  ja  v a 2s .  com

    if (playButton.wasPressed()) {
        playButtonSound();
        startGame();
    } else if (game.canShowScores() && scoresButton.wasPressed()) {
        playButtonSound();
        showScores();
    } else {
        Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        spriteBatch.begin();
        Assets.scoreFont.setColor(Color.WHITE);
        float y = VIRTUAL_HEIGHT - Assets.scoreFont.getCapHeight() / 2.0f;
        Assets.scoreFont.drawWrapped(spriteBatch, TITLE, 0, y, VIRTUAL_WIDTH, HAlignment.CENTER);
        Assets.textFont.drawWrapped(spriteBatch, JIBBER_JABBER, VIRTUAL_WIDTH / 8, 3 * VIRTUAL_HEIGHT / 4,
                3 * VIRTUAL_WIDTH / 4, HAlignment.CENTER);
        drawButtons();
        spriteBatch.end();
    }
}

From source file:com.badlydrawngames.veryangryrobots.ParticleAdapter.java

License:Apache License

@Override
public void onPlayerHit() {
    Player player = world.getPlayer();//  w ww.  j a va  2s . co m
    float x = player.x + player.width / 2;
    float y = player.y + player.height / 2;
    particleManager.add(x, y, 2 * PARTICLES, Color.WHITE);
}

From source file:com.badlydrawngames.veryangryrobots.ScoresScreen.java

License:Apache License

@Override
public void render(float delta) {
    stateTime += delta;/*from   w  ww.  ja  va  2  s . c  o  m*/
    if (Gdx.input.justTouched()) {
        touched = true;
    } else if (touched && !Gdx.input.isTouched()) {
        touched = false;
        game.setScreen(game.mainMenuScreen);
    } else {
        Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        spriteBatch.begin();
        Assets.scoreFont.setColor(Color.WHITE);
        TextBounds b = Assets.scoreFont.getBounds(LAST_SCORE);
        float w = b.width + Assets.scoreFont.getSpaceWidth();
        b = Assets.scoreFont.getBounds(scoreString);
        float w2 = b.width;
        float x = (VIRTUAL_WIDTH - (w + w2)) / 2.0f;
        float y = 3 * VIRTUAL_HEIGHT / 4.0f;
        Assets.scoreFont.setColor(Color.WHITE);
        Assets.scoreFont.draw(spriteBatch, TOP_SCORE, x, y);
        Assets.scoreFont.draw(spriteBatch, topScoreString, x + w, y);

        b = Assets.scoreFont.getBounds(TOP_SCORE);
        w = b.width + Assets.scoreFont.getSpaceWidth();
        b = Assets.scoreFont.getBounds(topScoreString);
        w2 = b.width;
        x = (VIRTUAL_WIDTH - (w + w2)) / 2.0f;
        y += 2 * b.height;
        Assets.scoreFont.draw(spriteBatch, LAST_SCORE, x, y);
        Assets.scoreFont.draw(spriteBatch, scoreString, x + w, y);

        if (stateTime % 1.0f < 0.5f) {
            Assets.textFont.setColor(Color.WHITE);
            Assets.textFont.drawWrapped(spriteBatch, TAP_TO_CONTINUE, 0, VIRTUAL_HEIGHT / 4, VIRTUAL_WIDTH,
                    HAlignment.CENTER);
        }
        spriteBatch.end();
    }
}

From source file:com.badlydrawngames.veryangryrobots.WorldView.java

License:Apache License

private void drawMobiles() {
    spriteBatch.setProjectionMatrix(worldCam.combined);
    spriteBatch.begin();//from  ww w  .  ja v  a2s  . co m
    spriteBatch.setColor(Color.WHITE);
    drawPlayersShots();
    drawRobotsShots();
    drawRobots();
    drawCaptain();
    drawPlayer();
    drawParticles();
    drawFlyups();
    spriteBatch.end();
}

From source file:com.badlydrawngames.veryangryrobots.WorldView.java

License:Apache License

private void drawRobots() {
    spriteBatch.setColor(world.getRobotColor());
    for (Robot robot : world.getRobots()) {
        drawRobot(robot);/*from ww  w.ja  v  a2  s .co  m*/
    }
    spriteBatch.setColor(Color.WHITE);
}

From source file:com.blackboxgaming.engine.factories.LayerFactory.java

public static Layer createLevelAndHealthLayer() {
    Stage stage = new Stage(new StretchViewport(486, 864));
    Skin skin = new Skin();
    Table table = new Table();
    table.top().pad(10);/*ww w .j a v a2s.  co m*/

    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(
            Gdx.files.internal("ui/fonts/Century Gothic Bold.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 40;
    parameter.borderColor = Color.BLACK;
    parameter.borderWidth = 3;
    BitmapFont font = generator.generateFont(parameter);
    generator.dispose();
    Label.LabelStyle labelStyle = new Label.LabelStyle(font, Color.WHITE);

    skin.add("star", new Texture("ui/icons/star.png"));
    skin.add("shield", new Texture("ui/icons/shield.png"));
    skin.add("brick", new Texture("ui/icons/brick.png"));
    skin.add("swipe128", new Texture("ui/icons/swipe128.png"));

    float padding = 10;
    Image icon = new Image(skin.getDrawable("star"));
    if (Global.debugLevelUp) {
        icon.addListener(new ClickListener() {
            @Override
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                if (Engine.systemManager.has(LevelProgressionSystem.class)) {
                    for (Entity entity : Engine.systemManager.get(LevelProgressionSystem.class).entities) {
                        Engine.garbageManager.markForDeletion(entity);
                    }
                }
                super.touchUp(event, x, y, pointer, button);
            }
        });
    }
    table.add(icon).pad(padding);
    Label levelLabel = new Label("", labelStyle);
    table.add(levelLabel).pad(padding);
    icon = new Image(skin.getDrawable("shield"));
    table.add(icon).pad(padding);
    Label healthLabel = new Label("", labelStyle);
    table.add(healthLabel).pad(padding);
    icon = new Image(skin.getDrawable("brick"));
    table.add(icon).pad(padding);
    Label brickLabel = new Label("", labelStyle);
    table.add(brickLabel).pad(padding);

    table.row();

    // swipe
    if (Engine.systemManager.has(LevelProgressionSystem.class)) {
        if (Engine.systemManager.get(LevelProgressionSystem.class).level < 5) {
            icon = new Image(skin.getDrawable("swipe128"));
            table.add(icon).padTop(350).colspan(6);
            Global.swipeIcon = icon;

        }
    }

    //        table.setDebug(true);
    table.setFillParent(true);
    stage.addActor(table);

    Global.LEVEL_LABEL = levelLabel;
    Global.HEALTH_LABEL = healthLabel;
    Global.BRICK_LABEL = brickLabel;

    if (Engine.systemManager.has(LevelProgressionSystem.class)) {
        Global.LEVEL_LABEL.setText("" + Engine.systemManager.get(LevelProgressionSystem.class).level);
        Global.HEALTH_LABEL.setText("" + Engine.systemManager.get(LevelProgressionSystem.class).health);
        Global.BRICK_LABEL.setText("" + Engine.systemManager.get(LevelProgressionSystem.class).nrOfBricks);
    }

    Engine.inputManager.add(stage);
    return new Layer("topLayer", stage, table);
}