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

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

Introduction

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

Prototype

Color RED

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

Click Source Link

Usage

From source file:com.ygames.game.LevelSelect.java

public LevelSelect(final Game g, MainMenu m) {
    game = g;/* ww  w . j a  va  2s .com*/
    menu = m;
    camera = new OrthographicCamera();
    camera.setToOrtho(false, 800, 480);
    touch = new Vector3();
    image = new Texture("Images/LevelSelect.png");
    game.font.setColor(Color.RED);

}

From source file:core.september.morra.scoreboard.ScoreLevel.java

License:Apache License

public void renderColorized(SpriteBatch batch) {
    BitmapFont font = Assets.instance.font.defaultNormal;
    BitmapFont big = Assets.instance.font.defaultBig;

    boolean winner = win > loose;
    font.setColor(winner ? Color.YELLOW : Color.RED);
    font.draw(batch, String.format("YOU %s %s matches of %s!!!", winner ? "WIN" : "LOOSE", winner ? win : loose,
            matches), Constants.VIEWPORT_WIDTH / 16, Constants.VIEWPORT_HEIGHT / 2);

}

From source file:core.september.morra.win.WinLevel.java

License:Apache License

public void renderColorizedInfos(SpriteBatch batch) {
    BitmapFont font = Assets.instance.font.defaultBig;

    if (cpu + player == playerBound) {
        font.setColor(Color.YELLOW);
        font.draw(batch, String.valueOf(playerBound), Constants.VIEWPORT_WIDTH / 8,
                Constants.VIEWPORT_HEIGHT * 0.65f);

    }//  www  . j a v a2s  . com

    else {
        font.setColor(Color.RED);
        font.draw(batch, String.valueOf(cpuBound), (Constants.VIEWPORT_WIDTH / 8) * 7,
                Constants.VIEWPORT_HEIGHT * 0.65f);
    }

}

From source file:de.bitbrain.craft.ui.widgets.ElementWidget.java

License:Open Source License

private Actor generateRight(ElementData data) {
    VerticalGroup layout = new VerticalGroup();
    layout.align(Align.left);//from w  w w.  j a v  a2 s . c o  m
    layout.padLeft(15f);
    layout.padTop(15f);
    name.setColor(data.getRarity().getColor());
    name.setFontScale(0.85f);

    String textDescription = "Click to craft";
    Color colorDescription = Assets.CLR_INACTIVE;
    if (!craftable) {
        textDescription = "Can not craft";
        colorDescription = Color.RED;
    }
    Label description = new Label(textDescription, Styles.LBL_TEXT);
    description.setFontScale(0.7f);
    description.setColor(colorDescription);
    description.getColor().a = 0.5f;
    layout.addActor(name);
    VerticalGroup descContainer = new VerticalGroup();
    descContainer.addActor(description);
    descContainer.padTop(15f);
    layout.addActor(descContainer);
    return layout;
}

From source file:de.gebatzens.meteva.ScoreState.java

License:Open Source License

@Override
public void render() {
    //   Meteva.sbg.renderBackground();
    GScout.survivant.setColor(Color.WHITE);
    GScout.batch.setColor(Color.WHITE);

    float width = Gdx.graphics.getWidth() * 0.45f;
    if (width > highscoretitle.getRegionWidth())
        width = highscoretitle.getRegionWidth();
    GScout.batch.draw(highscoretitle, Gdx.graphics.getWidth() / 2f - width / 2f,
            Gdx.graphics.getHeight() * 0.88f, (int) width,
            (int) (((float) width / (float) highscoretitle.getRegionWidth())
                    * (float) highscoretitle.getRegionHeight()));

    GScout.batch.setColor(1, 1, 1, 0.1f);
    float t = GScout.width * 0.005f;
    GScout.batch.draw(GScout.whiteTexture, (float) (Gdx.graphics.getWidth() * 0.14f - t),
            (float) (Gdx.graphics.getHeight() * 0.85f), (int) (Gdx.graphics.getWidth() * 0.72f + 2 * t),
            (int) (t));
    GScout.batch.draw(GScout.whiteTexture, (float) (Gdx.graphics.getWidth() * 0.86f),
            (float) (Gdx.graphics.getHeight() * 0.15f), (int) t, (int) (Gdx.graphics.getHeight() * 0.7f));
    GScout.batch.draw(GScout.whiteTexture, (float) (Gdx.graphics.getWidth() * 0.14f - t),
            (float) (Gdx.graphics.getHeight() * 0.15f - t), (int) (Gdx.graphics.getWidth() * 0.72f + 2 * t),
            (int) (t));
    GScout.batch.draw(GScout.whiteTexture, (float) (Gdx.graphics.getWidth() * 0.14f - t),
            (float) (Gdx.graphics.getHeight() * 0.15f), (int) t, (int) (Gdx.graphics.getHeight() * 0.7f));

    GScout.batch.setColor(0.7f, 0.7f, 0.7f, 0.3f);
    GScout.batch.draw(GScout.whiteTexture, (float) (Gdx.graphics.getWidth() * 0.14f),
            (float) (Gdx.graphics.getHeight() * 0.15f), (int) (Gdx.graphics.getWidth() * 0.72f),
            (int) (Gdx.graphics.getHeight() * 0.7f));

    for (int i = 0; i < 11; i++) {
        Highscore h = fast.activated ? GScout.highscoref : GScout.highscoren;
        String player = h.players[i];
        if (player == null)
            break;
        int score = h.scores[i];

        if (GScout.lastHSR == i && h == GScout.lastHighscore)
            if (i == 0)
                GScout.survivant.setColor(blinkColor);
            else/*from w w  w.  j  a  v a 2  s.com*/
                GScout.survivant.setColor(Color.RED);
        else if (i == 0)
            GScout.survivant.setColor(1, 201f / 255f, 0, 1);
        else/* if(i % 2 == 0)*/
            GScout.survivant.setColor(0.5f, 0.5f, 0.5f, 1);
        /*else
           Meteva.survivant.setColor(0x1a / (float) 0xff, 0x73 / (float) 0xff, 0xa3 / (float) 0xff, 1);
        */

        if (i % 2 == 0) {
            if (i == 0)
                GScout.batch.setColor(0xff / (float) 0xff, 0x40 / (float) 0xff, 0x1e / (float) 0xff, 0.11f);
            else
                GScout.batch.setColor(0x00 / (float) 0xff, 0xa6 / (float) 0xff, 0xff / (float) 0xff, 0.11f);
            GScout.batch.draw(GScout.whiteTexture, GScout.width * 0.14f,
                    GScout.height * 0.83325f - (i + 1) * GScout.width * 0.034f, (int) (GScout.width * 0.72f),
                    (int) (GScout.width * 0.0325f));
        }

        GScout.setFontSize(Gdx.graphics.getWidth() * 0.028);

        GScout.drawText(player, (float) (Gdx.graphics.getWidth() * 0.2),
                (float) (Gdx.graphics.getHeight() * 0.84 - i * Gdx.graphics.getWidth() * 0.034), true);
        if (i == 0)
            GScout.survivant.setColor(0xfc / (float) 0xff, 0x81 / (float) 0xff, 0x06 / (float) 0xff, 0.7f);
        else
            GScout.survivant.setColor(0x1a / (float) 0xff, 0x6b / (float) 0xff, 0xdd / (float) 0xff, 0.7f);
        TextBounds bounds = GScout.survivant.getBounds((i + 1) + ".");
        GScout.drawText((i + 1) + ".", (float) (Gdx.graphics.getWidth() * 0.193 - bounds.width),
                (float) (Gdx.graphics.getHeight() * 0.84 - i * Gdx.graphics.getWidth() * 0.034), true);
        if (i == 0)
            GScout.survivant.setColor(0xfc / (float) 0xff, 0x81 / (float) 0xff, 0x06 / (float) 0xff, 0.6f);
        else
            GScout.survivant.setColor(0x53 / (float) 0xff, 0xd0 / (float) 0xff, 0xe3 / (float) 0xff, 0.6f);
        bounds = GScout.survivant.getBounds("" + score);
        GScout.drawText("" + score, (float) (Gdx.graphics.getWidth() * 0.84 - bounds.width),
                (float) (Gdx.graphics.getHeight() * 0.84 - i * Gdx.graphics.getWidth() * 0.034), true);

    }

    back.render();
    fast.render();
    normal.render();
    db.render();

    GScout.survivant.setColor(Color.WHITE);

}

From source file:DevRandEnginePkg.RenderEngine.java

public void renderUI(String m, int posX, int posY) {
    fontUI.setColor(Color.RED);
    fontUI.setScale(3f, 3f);//  w  w w . jav  a2  s  .  com
    batch.begin();
    fontUI.draw(batch, m, posX, posY);
    batch.end();
}

From source file:dk.four.group.gameengine.main.Game.java

private void draw() {

    _shapeRenderer.setProjectionMatrix(cam.combined);
    //System.out.println(world.values().size());
    for (Entity entity : world.values()) {

        Asset a = entity.getAsset();//from  w  w w. ja va  2s. c om

        if (a == null) {
            continue;
        }

        if (_assetManager.isLoaded(a.getPath())) {

            sb.begin();

            Texture t = _assetManager.get(a.getPath(), Texture.class);
            Sprite s = new Sprite(t);

            if (null != entity.getType()) {
                switch (entity.getType()) {

                case PLAYER:

                    _shapeRenderer.begin(ShapeType.Line);
                    _shapeRenderer.setColor(Color.RED);
                    _shapeRenderer.circle(
                            entity.getEntityPosition().getX() + entity.getEntityBody().getWidth() / 2,
                            entity.getEntityPosition().getY() + entity.getEntityBody().getHeight() / 2,
                            entity.getRadius());
                    _shapeRenderer.rect(entity.getEntityPosition().getX(), entity.getEntityPosition().getY(),
                            entity.getEntityBody().getWidth(), entity.getEntityBody().getHeight());
                    x = entity.getEntityPosition().getX();
                    y = entity.getEntityPosition().getY();
                    s.setSize(s.getWidth(), s.getHeight());
                    //s.setRotation(entity.getRadians());
                    s.setOrigin(32, 32);
                    s.setRotation(entity.getRadians());
                    s.setPosition(entity.getEntityPosition().getX(), entity.getEntityPosition().getY());
                    //System.out.println(entity.getRadians());
                    break;

                case WEAPON:
                    s.setRotation(entity.getRadians());
                    s.setPosition(entity.getEntityPosition().getX(), entity.getEntityPosition().getY());

                    break;
                case MAP:
                    _shapeRenderer.begin(ShapeType.Line);
                    _shapeRenderer.setColor(Color.BLUE);

                    font.draw(sb, Long.toString((long) gameData.getScore()), 50, 900);
                    /*for (int i = 0; i < 16; i++) {
                        for (int j = 0; j < 16; j++) {
                            _shapeRenderer.rect(i * 64, j * 64, 64, 64);
                        }
                            
                    }*/
                    //score

                    s.setSize(entity.getSize(), entity.getSize());
                    s.setRotation(entity.getRadians());
                    s.setPosition(entity.getEntityPosition().getX(), entity.getEntityPosition().getY());

                    break;
                case BULLET:
                    s.setSize(entity.getSize(), entity.getSize());
                    s.setRotation(entity.getRadians() - 90);
                    //float newY = entity.getEntityPosition().getY() + (1000 * gameData.getDelta());
                    //System.out.println(newY);

                    s.setPosition(entity.getEntityPosition().getX(), entity.getEntityPosition().getY());

                    break;
                case ENEMY:

                    _shapeRenderer.begin(ShapeType.Line);
                    _shapeRenderer.setColor(Color.RED);
                    _shapeRenderer.circle(entity.getEntityPosition().getX() + 32,
                            entity.getEntityPosition().getY() + 32, entity.getRadius());
                    float angle = (float) Math.atan2(y - entity.getEntityPosition().getY(),
                            x - entity.getEntityPosition().getX());
                    angle = (float) (angle * (180 / Math.PI));
                    if (angle < 0) {
                        angle = 360 - (-angle);
                    }
                    s.setSize(entity.getSize(), entity.getSize());
                    s.setRotation(angle);
                    //float newY = entity.getEntityPosition().getY() + (1000 * gameData.getDelta());
                    //System.out.println(newY);

                    s.setPosition(entity.getEntityPosition().getX(), entity.getEntityPosition().getY());

                    break;

                default:

                    break;

                }
            }

            s.draw(sb);

            sb.end();

            _shapeRenderer.end();

        }

        if (entity.getType().equals(EntityType.PLAYER)) {

            _shapeRenderer.begin(ShapeType.Filled);
            _shapeRenderer.setColor(Color.GREEN);
            _shapeRenderer.rect(50, gameData.getDisplayHeight() - 50, gameData.getPlayer().getLife(), 20);
            _shapeRenderer.end();
        }
    }

}

From source file:dk.gruppeseks.bodtrd.engine.Game.java

private void draw() {
    Entity p = _world.getGameData().getPlayer();
    if (p != null) {
        Position pPosition = p.get(Position.class);
        Body pBody = p.get(Body.class);
        _gameCamera.position.x = (float) (pPosition.getX() + pBody.getWidth() / 2);
        _gameCamera.position.y = (float) (pPosition.getY() + pBody.getHeight() / 2);
    }/*from w  ww  . ja  v  a  2s. c  om*/

    _gameCamera.update();
    _polyBatch.setProjectionMatrix(_gameCamera.combined);
    _batch.setProjectionMatrix(_gameCamera.combined);
    _shapeRenderer.setProjectionMatrix(_gameCamera.combined);
    _batch.begin();
    tryInitiliazeBackground();
    if (background != null) {
        int backgroundWidth = background.getWidth();
        int backgroundHeight = background.getHeight();
        int backgroundRepeatWidth = _world.getMap().getWidth() / backgroundWidth;
        int backgroundRepeatHeight = _world.getMap().getHeight() / backgroundHeight;
        _batch.draw(background, 0, 0, backgroundWidth * backgroundRepeatWidth,
                backgroundHeight * backgroundRepeatHeight, 0, backgroundRepeatHeight, backgroundRepeatWidth, 0);
    }

    _batch.end();
    for (Entity e : _world.entities()) {
        View view = e.get(View.class);
        Velocity vel = e.get(Velocity.class);
        Body body = e.get(Body.class);
        Position pos = e.get(Position.class);
        Health health = e.get(Health.class);

        if (body == null || pos == null || view == null) {
            continue;
        }
        if (_assetManager.isLoaded(view.getImageFilePath())) {
            _batch.begin();
            Texture texture = _assetManager.get(view.getImageFilePath(), Texture.class);
            if (view.isRepeat()) {
                texture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);

                int textureWidth = texture.getWidth();
                int textureHeight = texture.getHeight();
                int textureRepeatWidth = body.getWidth() / textureWidth;
                int textureRepeatHeight = body.getHeight() / textureWidth;

                _batch.draw(texture, (float) pos.getX(), (float) pos.getY(), textureWidth * textureRepeatWidth,
                        textureHeight * textureRepeatHeight, 0, textureRepeatHeight, textureRepeatWidth, 0);

            } else {
                _batch.draw(texture, (float) pos.getX(), (float) pos.getY(), (float) body.getWidth(),
                        (float) body.getHeight());
            }
            _batch.end();
            if (health != null) {
                _batch.begin();
                _shapeRenderer.begin(ShapeType.Filled);
                double centerX = pos.getX() + (body.getWidth() / 2);
                double upperY = pos.getY() + (body.getHeight());

                float healthPerc = (float) health.getHp() / (float) health.getMaxHp() * 100;

                _shapeRenderer.setColor(Color.RED);
                _shapeRenderer.rect((float) centerX - 25, (float) upperY + 10, 50, 10);
                _shapeRenderer.setColor(Color.GREEN);
                _shapeRenderer.rect((float) centerX - 25, (float) upperY + 10, healthPerc / 2, 10);

                _shapeRenderer.end();

                _batch.end();
            }
        }
        AIData aiData = e.get(AIData.class);
        if (aiData != null) {
            if (aiData.getFoVShape() != null) {
                drawFoV(aiData.getFoVShape());
            }
            if (aiData.getLastKnownPosition() != null && vel.getVector().getMagnitude() > 0) {
                drawLastKnown(aiData.getLastKnownPosition());
            }

        }
    }
    if (p != null) {
        drawHUD(p);
    }
}

From source file:dla_franctal.GameWorldController.java

License:Open Source License

@Override
public void render(Graphics g) {
    theModel.drawModel(g);//  www.j a  v  a 2s.  co m
    if (theModel.yMax - theModel.yMin > 0 && theModel.xMax - theModel.xMin > 0) {
        /*switch color to red to draw the bounding box perimeter...*/
        g.setColor(Color.RED);
        g.drawRect(theModel.yMin, theModel.xMin, theModel.yMax - theModel.yMin + 1,
                theModel.xMax - theModel.xMin + 1);
        /*...switching back to white*/
        g.setColor(Color.WHITE);
    }
}

From source file:edu.franklin.practicum.f15.strategygame.StrategyGame.java

@Override
public void create() {
    AssetManager assetManager = new AssetManager();

    assets.init(assetManager);// w  w w . j  a v  a 2  s  .c om

    batch = new SpriteBatch();
    font = new BitmapFont();
    font.setColor(Color.RED);

    loadConfiguration();

    Gdx.graphics.setDisplayMode(WinWidth, WinHeight, false);

    Logger.logMsg(String.format("game width: %d, game height: %d", Gdx.graphics.getWidth(),
            Gdx.graphics.getHeight()));

    initSkin();

    initScreens();
}