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:io.lonelyrobot.empires.client.screens.overlay.ServerManageOverlay.java

License:Apache License

private void reinforce() {
    float width = Gdx.graphics.getWidth();
    float height = Gdx.graphics.getHeight();
    Vector2 start = new Vector2((width / 2) - 350, 0);
    Vector2 size = new Vector2(700, height);
    float alpha = 0.9f;
    Color color = new Color(Color.BLACK);
    super.addAdditionalAlpha(start, size, alpha, color);
}

From source file:it.alcacoop.backgammon.actors.Checker.java

License:Open Source License

public Checker(Board _board, int _color) {
    super();/*www .j  ava2  s  .  c o  m*/

    boardX = boardY = 0;
    color = _color;
    board = _board;

    TextureRegion region;

    if (color == 1) {//WHITE
        region = GnuBackgammon.atlas.findRegion("cw");
        LabelStyle styleBlack = new LabelStyle(GnuBackgammon.font, Color.BLACK);
        label = new Label("1", styleBlack);
        label.setColor(0, 0, 0, 1);
    } else {
        region = GnuBackgammon.atlas.findRegion("cb");
        LabelStyle styleWhite = new LabelStyle(GnuBackgammon.font, Color.WHITE);
        label = new Label("1", styleWhite);
        label.setColor(1, 1, 1, 1);
    }

    dr = new TextureRegionDrawable(region);
    img = new Image(dr);

    region = GnuBackgammon.atlas.findRegion("ch");
    imgh = new Image(region);
    imgh.setScaling(Scaling.none);
    imgh.addAction(Actions.forever(Actions.sequence(Actions.fadeIn(0.4f), Actions.fadeOut(0.2f))));

    addActor(img);
    addActor(label);
    addActor(imgh);
    label.setText("");
    label.setWrap(false);
    label.setAlignment(Align.bottom | Align.center);
}

From source file:ludowars.gui.HUDLayer.java

@Override
public void render(SpriteBatch batch, ShapeRenderer sr, float delta) {
    super.render(batch, sr, delta);

    // animated health display
    if (animationTime <= HEALTH_ANIMATION_TIME) {
        animationTime = Math.min(animationTime + delta, HEALTH_ANIMATION_TIME);
        currentHealth = oldHealth + (targetHealth - oldHealth)
                * Interpolation.exp5Out.apply(animationTime / HEALTH_ANIMATION_TIME);
        health = "" + (int) currentHealth;
    }/*from   w ww . j  ava2 s.co m*/

    float textHeight = font.getBounds("100").height;

    font.setColor(Color.BLACK);
    font.draw(batch, health, 20 + heart.getWidth() + 20 + 2, 20 + textHeight + 8 - 2);

    font.setColor(Color.WHITE);
    font.draw(batch, health, 20 + heart.getWidth() + 20, 20 + textHeight + 8);

    float lerp = 0.1f;
    float newX = backpack_open.getBounds().x + (backpackPosition.x - backpack_open.getBounds().x) * lerp;
    float newY = backpack_open.getBounds().y + (backpackPosition.y - backpack_open.getBounds().y) * lerp;
    backpack_open.setPosition(newX, newY);
}

From source file:managers.HealthBarManager.java

public void drawHealthBar(ShapeRenderer sr, World world, Camera camera) {
    for (Entity e : world.getEntities(PLAYER, ENEMY)) {
        float x = e.get(Position.class).getX();
        float y = e.get(Position.class).getY();
        int eHeight = e.get(Body.class).getHeight();

        sr.setColor(Color.BLACK);
        sr.begin(ShapeRenderer.ShapeType.Filled);
        sr.rect(x, y + eHeight + 9, (float) (e.get(Health.class).getMaxHp() / 2), 12);
        sr.setProjectionMatrix(camera.combined);
        sr.end();/*from   w w  w. j  a  va2s.com*/

        sr.setColor(Color.RED);
        sr.begin(ShapeRenderer.ShapeType.Filled);
        sr.rect(x, y + eHeight + 10, (float) (e.get(Health.class).getMaxHp() / 2), 10);
        sr.setProjectionMatrix(camera.combined);
        sr.end();

        sr.setColor(Color.GREEN);
        sr.begin(ShapeRenderer.ShapeType.Filled);
        sr.rect(x, y + eHeight + 10, e.get(Health.class).getHp() / 2, 10);
        sr.setProjectionMatrix(camera.combined);
        sr.end();
    }
}

From source file:match.GameText.java

/**
 * initializes GameText with the given parameters
 * @param text/*from ww  w .  j  a  v a2s  .  com*/
 * @param position 
 */
public GameText(String text, Point position) {
    //initialize fonts
    try {
        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
        FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
        parameter.size = 30;
        font = generator.generateFont(parameter); // font size 12 pixels
        font.setColor(Color.BLACK);
        generator.dispose(); // don't forget to dispose to avoid memory leaks!
    } catch (Exception e) {
    }

    this.text = text;
    this.position = position;
    this.lifeTime = -1;
}

From source file:match.GameText.java

public GameText(String text, Point position, int lifeTime) {
    //initialize fonts
    try {//from  ww  w.j av  a 2  s .c  o  m
        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/MunroSmall.ttf"));
        FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
        parameter.size = 30;
        font = generator.generateFont(parameter); // font size 12 pixels
        font.setColor(Color.BLACK);
        generator.dispose(); // don't forget to dispose to avoid memory leaks!
    } catch (Exception e) {
    }

    this.text = text;
    this.position = position;
    this.lifeTime = lifeTime;
}

From source file:maze.maker.Cell.java

public void draw() {
    if (bVisited) {
        shape.begin(ShapeRenderer.ShapeType.Filled);
        shape.setColor(Color.GRAY);
        shape.rect(fDx, fDy, scl, scl);/*from   w ww. j  a  va 2s.  co m*/
        shape.end();
    }
    if (bMazeFinished) {
        if (bStart) {
            shape.begin(ShapeRenderer.ShapeType.Filled);
            shape.setColor(Color.BLUE);
            shape.rect(fDx, fDy, scl, scl);
            shape.end();
        } else if (bTarget) {
            shape.begin(ShapeRenderer.ShapeType.Filled);
            shape.setColor(Color.RED);
            shape.rect(fDx, fDy, scl, scl);
            shape.end();
        } else if (bHighlight) {
            shape.begin(ShapeRenderer.ShapeType.Filled);
            shape.setColor(Color.WHITE);
            shape.rect(fDx, fDy, scl, scl);
            //                shape.triangle(fDx, fDy, fDx, fDy + scl, fDx + scl, fDy + scl / 2);
            //                shape.circle(fDx + scl/2, fDy + scl/2, scl/2);
            shape.end();
        } else if (bChecked) {
            shape.begin(ShapeRenderer.ShapeType.Filled);
            shape.setColor(Color.BROWN);
            shape.rect(fDx, fDy, scl, scl);
            shape.end();
        }
    }
    shape.begin(ShapeRenderer.ShapeType.Line);
    shape.setColor(Color.BLACK);
    if (Sides[0]) {// top
        shape.rectLine(fDx, fDy + scl - fWidth, fDx + scl, fDy + scl + fWidth, fWidth * 2);
    }
    if (Sides[1]) {// bottom
        shape.rectLine(fDx, fDy - fWidth, fDx + scl, fDy + fWidth, fWidth * 2);
        //            shape.line(0, 0, w, h);
    }
    if (Sides[2]) {// left
        shape.rectLine(fDx - fWidth, fDy, fDx + fWidth, fDy + scl, fWidth * 2);
    }
    if (Sides[3]) {// right
        shape.rectLine(fDx + scl - fWidth, fDy, fDx + scl + fWidth, fDy + scl, fWidth * 2);
    }
    shape.end();
}

From source file:me.dumfing.gdxtools.GifDecoderOptimized.java

License:Open Source License

public Animation getAnimation(PlayMode playType) {
    int nrFrames = getFrameCount();

    //        if(nrFrames > 100)
    //        {/*from   w  w w. j  a  v  a 2s .c  om*/
    //           nrFrames=100;
    //        }

    advance();
    Pixmap frame = getNextFrame();

    int width = frame.getWidth();
    int height = frame.getHeight();
    int vzones = (int) Math.sqrt((double) nrFrames);
    int hzones = vzones;
    while (vzones * hzones < nrFrames)
        vzones++;
    int v, h;
    Pixmap target = new Pixmap(width * hzones, height * vzones, Pixmap.Format.RGBA8888);
    int frameCountCurrent = 0;
    for (h = 0; h < hzones; h++) {
        for (v = 0; v < vzones; v++) {

            if (frameCountCurrent < nrFrames) {
                frameCountCurrent++;
                advance();
                frame = getNextFrame();
                target.drawPixmap(frame, h * width, v * height);

                int pixelSize = (int) (frame.getWidth() * 0.025f);
                target.setColor(Color.BLACK);

                int xPos, yPos;
                xPos = h * width;
                yPos = v * height;

                //                    target.fillRectangle(xPos, yPos, frame.getWidth(), pixelSize);
                //                    target.fillRectangle(xPos + frame.getWidth()-pixelSize, yPos, pixelSize, frame.getHeight());
                //                    target.fillRectangle(xPos, yPos + frame.getHeight()-pixelSize, frame.getWidth(), pixelSize);
                //                    target.fillRectangle(xPos, yPos,pixelSize, frame.getHeight());
            }
        }
    }

    Texture texture = new Texture(target);
    target.dispose();
    target = null;

    Array<TextureRegion> texReg = new Array<TextureRegion>();
    TextureRegion tr = new TextureRegion(texture);
    for (h = 0; h < hzones; h++) {
        for (v = 0; v < vzones; v++) {
            int frameID = v + h * vzones;
            if (frameID < nrFrames) {
                tr = new TextureRegion(texture, h * width, v * height, width, height);
                texReg.add(tr);
            }
        }
    }

    float frameDuration = (float) getDelay(0);
    frameDuration /= 500; // convert milliseconds into seconds

    Animation result = new Animation(frameDuration, texReg, playType);

    texReg.clear();
    frames.clear();
    prefix = null;
    suffix = null;
    pixelStack = null;
    mainPixels = null;
    mainScratch = null;
    copyScratch = null;

    return result; //return animation object
}

From source file:me.scarlet.undertailor.gfx.MultiRenderer.java

License:Open Source License

public MultiRenderer() {
    this.batch = new SpriteBatch();
    this.renderer = new ShapeRenderer();
    this.setClearColor(Color.BLACK);
}

From source file:me.scarlet.undertailor.gfx.MultiRenderer.java

License:Open Source License

/**
 * Sets the {@link Color} used to clear the screen with
 * every frame.// w w  w .ja va2s. c  om
 * 
 * @param color the new Color to clear with
 */
public void setClearColor(Color color) {
    this.clearColor = (color == null ? Color.BLACK : color);
    Gdx.gl.glClearColor(clearColor.r, clearColor.g, clearColor.b, 1.0F);
}