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.bladecoder.engine.ui.retro.RetroSceneScreen.java

License:Apache License

private void drawHotspots(SpriteBatch batch) {
    final World world = World.getInstance();
    for (BaseActor a : world.getCurrentScene().getActors().values()) {
        if (!(a instanceof InteractiveActor) || !a.isVisible() || a == world.getCurrentScene().getPlayer())
            continue;

        InteractiveActor ia = (InteractiveActor) a;

        if (!ia.canInteract())
            continue;

        Polygon p = a.getBBox();/*w w w .jav a 2 s  . c  om*/

        if (p == null) {
            EngineLogger.error("ERROR DRAWING HOTSPOT FOR: " + a.getId());
        }

        Rectangle r = a.getBBox().getBoundingRectangle();

        unprojectTmp.set(r.getX() + r.getWidth() / 2, r.getY() + r.getHeight() / 2, 0);
        world.getSceneCamera().scene2screen(worldViewport, unprojectTmp);

        if (world.getInventory().isVisible()) {
            // unprojectTmp.y += verbUI.getHeight();
        }

        if (ia.getDesc() == null) {

            float size = DPIUtils.ICON_SIZE * DPIUtils.getSizeMultiplier();

            Drawable drawable = ((TextureRegionDrawable) getUI().getSkin().getDrawable("circle"))
                    .tint(Color.RED);

            drawable.draw(batch, unprojectTmp.x - size / 2, unprojectTmp.y - size / 2, size, size);
        } else {
            BitmapFont font = getUI().getSkin().getFont("desc");
            String desc = ia.getDesc();
            if (desc.charAt(0) == I18N.PREFIX)
                desc = I18N.getString(desc.substring(1));

            textLayout.setText(font, desc);

            float textX = unprojectTmp.x - textLayout.width / 2;
            float textY = unprojectTmp.y + textLayout.height;

            RectangleRenderer.draw(batch, textX - 8, textY - textLayout.height - 8, textLayout.width + 16,
                    textLayout.height + 16, Color.BLACK);
            font.draw(batch, textLayout, textX, textY);
        }
    }
}

From source file:com.bladecoder.engine.ui.TextManagerUI.java

License:Apache License

@Override
public void act(float delta) {
    super.act(delta);

    Text currentSubtitle = World.getInstance().getTextManager().getCurrentText();

    if (subtitle != currentSubtitle) {
        subtitle = currentSubtitle;// w ww . ja va  2 s.c o  m

        if (currentSubtitle == null && isVisible()) {
            setVisible(false);
        } else if (currentSubtitle != null && !isVisible()) {
            setVisible(true);
        }

        if (isVisible()) {
            float posx = currentSubtitle.x;
            float posy = currentSubtitle.y;

            unprojectTmp.set(posx, posy, 0);
            World.getInstance().getSceneCamera().scene2screen(getStage().getViewport(), unprojectTmp);

            float maxWidth = currentSubtitle.type == Text.Type.TALK ? maxTalkWidth : maxRectangleWidth;

            final TextManagerUIStyle style = getStyle(currentSubtitle);

            Color color = currentSubtitle.color != null ? currentSubtitle.color : style.defaultColor;

            if (color == null)
                color = Color.BLACK;

            layout.setText(style.font, currentSubtitle.str, color, maxWidth, Align.center, true);

            if (posx == TextManager.POS_CENTER || posx == TextManager.POS_SUBTITLE) {
                posx = (getStage().getViewport().getScreenWidth() - layout.width) / 2;
                fontX = (getStage().getViewport().getScreenWidth() - maxWidth) / 2;
            } else {
                posx = unprojectTmp.x;
                fontX = unprojectTmp.x;
            }

            if (posy == TextManager.POS_CENTER) {
                posy = (getStage().getViewport().getScreenHeight() - layout.height) / 2;
            } else if (posy == TextManager.POS_SUBTITLE) {
                posy = getStage().getViewport().getScreenHeight() - layout.height
                        - DPIUtils.getMarginSize() * 4;
            } else {
                posy = unprojectTmp.y;
            }

            setPosition(posx - PADDING, posy - PADDING);
            setSize(layout.width + PADDING * 2, layout.height + PADDING * 2);

            if (currentSubtitle.type == Text.Type.TALK) {
                if (style.talkBubble != null) {
                    setY(getY() + DPIUtils.getTouchMinSize() / 3 + PADDING);
                }

                setX(getX() - layout.width / 2);

                fontX = posx - maxWidth / 2;

                // check if the text exits the screen
                if (getX() < 0 && getX() > -getWidth()) {
                    setX(0 + PADDING);
                    fontX = getX() + PADDING + (layout.width - maxWidth) / 2;
                } else if (getX() + getWidth() > getStage().getViewport().getScreenWidth()
                        && getX() + getWidth() < getStage().getViewport().getScreenWidth() + getWidth()) {
                    setX(getStage().getViewport().getScreenWidth() - getWidth());
                    fontX = getStage().getViewport().getScreenWidth() - layout.width / 2 - PADDING
                            - maxWidth / 2;
                }

                if (getY() + getHeight() > getStage().getViewport().getScreenHeight()) {
                    setY(getStage().getViewport().getScreenHeight() - getHeight() - PADDING);
                }
            }
        }
    }

}

From source file:com.bladecoder.engineeditor.scneditor.ScnWidget.java

License:Apache License

private void drawFakeDepthMarkers(SpriteBatch batch) {
    int margin = 5;

    Vector2 d = scn.getDepthVector();

    if (d == null)
        return;/*from  ww  w .ja  v  a2s  . co  m*/

    tmp2V2.x = 0;
    tmp2V2.y = d.y;
    worldToScreenCoords(tmp2V2);

    String s = "100%";

    textLayout.setText(defaultFont, s);

    float posx = tmp2V2.x - textLayout.width - 20;

    RectangleRenderer.draw((SpriteBatch) batch, posx, tmp2V2.y, textLayout.width + margin * 2,
            textLayout.height + margin * 2, Color.BLACK);
    RectangleRenderer.draw((SpriteBatch) batch, tmp2V2.x - 20, tmp2V2.y, 20, 2, Color.BLACK);

    defaultFont.draw(batch, textLayout, posx + margin, tmp2V2.y + textLayout.height + margin);

    tmp2V2.x = 0;
    tmp2V2.y = d.x;
    worldToScreenCoords(tmp2V2);
    s = "0%";

    textLayout.setText(defaultFont, s);

    posx = tmp2V2.x - textLayout.width - 20;

    RectangleRenderer.draw((SpriteBatch) batch, posx, tmp2V2.y, textLayout.width + margin * 2,
            textLayout.height + margin * 2, Color.BLACK);
    RectangleRenderer.draw((SpriteBatch) batch, tmp2V2.x - 20, tmp2V2.y, 20, 2, Color.BLACK);

    defaultFont.draw(batch, textLayout, posx + margin, tmp2V2.y + textLayout.height + margin);

}

From source file:com.bladecoder.engineeditor.scneditor.SpriteDrawer.java

License:Apache License

public void draw(SpriteBatch batch) {
    if (renderer != null && currentAnimation != null) {

        float width;

        if (renderer.getWidth() < renderer.getHeight())
            width = HEIGHT / renderer.getHeight() * renderer.getWidth();
        else/*  w ww.  j a  v a2s . c o  m*/
            width = HEIGHT / renderer.getWidth() * renderer.getHeight();

        RectangleRenderer.draw(batch, viewportW - width - 5, viewportH - HEIGHT - 55, width + 10, HEIGHT + 10,
                Color.BLACK);
        RectangleRenderer.draw(batch, viewportW - width, viewportH - HEIGHT - 50, width, HEIGHT, BG_COLOR);

        float scaleh = width / renderer.getWidth();
        renderer.draw(batch, viewportW - width / 2, viewportH - HEIGHT - 50, scaleh);

    }
}

From source file:com.bladecoder.engineeditor.utils.Message.java

License:Apache License

private static void add(Stage stage, String text) {
    msg.clearActions();/*from   w  w  w  . ja  va 2 s.c o m*/

    msg.setText(text);

    GlyphLayout textLayout = new GlyphLayout();

    textLayout.setText(msg.getStyle().font, text, Color.BLACK, stage.getWidth() * .8f, Align.center, true);

    msg.setSize(textLayout.width + textLayout.height, textLayout.height + textLayout.height * 2);

    if (!stage.getActors().contains(msg, true))
        stage.addActor(msg);

    msg.setPosition(Math.round((stage.getWidth() - msg.getWidth()) / 2),
            Math.round((stage.getHeight() - msg.getHeight()) / 2));
    msg.invalidate();
}

From source file:com.bossletsplays.rr.screens.MainMenu.java

License:Apache License

@Override
public void show() {
    stage = new Stage();
    Util.setInput(stage);//from  ww w .  j  a  v a  2  s. c  om
    atlas = new TextureAtlas("ui/button.pack");
    skin = new Skin(atlas);
    table = new Table(skin);
    table.setBounds(0, 0, Util.getWidth(), Util.getHeight());
    buttonFont = Font.getFont("04b_08");
    headingFont = Font.getFont("terminal");

    TextButtonStyle buttonStyle = new TextButtonStyle();
    buttonStyle.up = skin.getDrawable("button.up");
    buttonStyle.down = skin.getDrawable("button.down");
    buttonStyle.pressedOffsetX = 1;
    buttonStyle.pressedOffsetY = -1;
    buttonStyle.font = buttonFont;
    buttonStyle.fontColor = Color.BLACK;

    play = new TextButton("Play", buttonStyle);
    play.pad(20);
    options = new TextButton("Options", buttonStyle);
    options.pad(20);
    exit = new TextButton("Exit", buttonStyle);
    exit.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Ragdoll.exit();
        }
    });
    exit.pad(20);

    LabelStyle headingStyle = new LabelStyle(headingFont, Color.WHITE);
    heading = new Label(Reference.TITLE, headingStyle);
    heading.setFontScale(3);

    addComponent(heading);
    addComponent(play);
    addComponent(options);
    table.add(exit);
    if (Reference.DEBUG)
        table.debug();
    stage.addActor(table);
}

From source file:com.bss.game.World.java

License:Apache License

private void updateClock() {
    tracker += TimeUtils.timeSinceMillis(prevTime);
    if (tracker > 1000l) {
        tracker = 0l;//from   w w w . jav  a  2s.c o m
        time -= 1;
        if (time < 0) {
            time = 10;
            sizeOfHealth -= 1f;
            checkEnd();
        }
        timeText = "" + time;
        layout.setText(Assets.font, timeText, Color.BLACK, 0f, 0, false);
    }
    prevTime = System.currentTimeMillis();
}

From source file:com.bss.game.World.java

License:Apache License

public void clearHookedFish() {
    if (hookedFish == 1) {
        time = 10;/*from   w  w  w.  j a  v a 2s.c o  m*/
        tracker = 0l;
        timeText = "" + time;
        layout.setText(Assets.font, timeText, Color.BLACK, 0f, 0, false);
        prevTime = System.currentTimeMillis();
        //need health stuff here
        hookedFish = 0;
        for (int i = 0; i < hookedEnemies.size(); i++) {
            if (hookedEnemies.get(i).badFish) {
                sizeOfHealth -= 1f;
                checkEnd();
            }
        }
        hookedEnemies.removeAll(hookedEnemies);
    } else if (hookedFish == 2) {
        time = 10;
        tracker = 0l;
        timeText = "" + time;
        layout.setText(Assets.font, timeText, Color.BLACK, 0f, 0, false);
        prevTime = System.currentTimeMillis();
        //need health stuff here
        hookedFish = 0;
        int c = 0;
        for (int i = 0; i < hookedEnemies.size(); i++) {
            if (hookedEnemies.get(i).badFish) {
                sizeOfHealth -= 1f;
                checkEnd();
            } else {
                c++;
            }
        }
        if (c == 2) {
            sizeOfHealth += 1f;
        }
        hookedEnemies.removeAll(hookedEnemies);
    } else if (hookedFish == 3) {
        time = 10;
        tracker = 0l;
        timeText = "" + time;
        layout.setText(Assets.font, timeText, Color.BLACK, 0f, 0, false);
        prevTime = System.currentTimeMillis();
        //need health stuff here
        hookedFish = 0;
        int c = 0;
        for (int i = 0; i < hookedEnemies.size(); i++) {
            if (hookedEnemies.get(i).badFish) {
                sizeOfHealth -= 1f;
                checkEnd();
            } else {
                c++;
            }
        }
        if (c == 3) {
            sizeOfHealth += 2f;
        } else if (c == 2) {
            sizeOfHealth += 1f;
        }
        hookedEnemies.removeAll(hookedEnemies);
    } else if (hookedFish == 4) {
        time = 10;
        tracker = 0l;
        timeText = "" + time;
        layout.setText(Assets.font, timeText, Color.BLACK, 0f, 0, false);
        prevTime = System.currentTimeMillis();
        //need health stuff here
        hookedFish = 0;
        int c = 0;
        for (int i = 0; i < hookedEnemies.size(); i++) {
            if (hookedEnemies.get(i).badFish) {
                sizeOfHealth -= 1f;
                checkEnd();
            } else {
                c++;
            }
        }
        if (c == 4) {
            sizeOfHealth += 3f;
        } else if (c == 3) {
            sizeOfHealth += 2f;
        } else if (c == 2) {
            sizeOfHealth += 1f;
        }
        hookedEnemies.removeAll(hookedEnemies);
    }
}

From source file:com.bss.game.WorldRenderer.java

License:Apache License

private void renderLine() {
    switch (world.hook.state) {
    case Hook.HOOKING:
        //batch.draw(Assets.line, world.slappy.position.x + 100f, world.slappy.position.y + 170f, 5f, 0f, 10f, (world.hook.position.y - world.slappy.position.y) + (world.hook.position.x - world.slappy.position.x) -90f, 1, 1, world.hook.rotation -135f);
        shapeRender.begin(ShapeRenderer.ShapeType.Line);
        shapeRender.setColor(Color.BLACK);
        location = hook.getVertices()[batch.X2];
        location2 = hook.getVertices()[batch.Y2];
        shapeRender.line(world.slappy.position.x + 100f, world.slappy.position.y + 180f,
                world.hook.position.x - world.offsetX, world.hook.position.y - world.offsetY);
        break;/*from www . ja v a 2 s.c om*/
    }
}

From source file:com.codefiddler.libgdx.tetris.WorldRenderer.java

License:Apache License

private void renderScore() {
    font.setScale(7, 7);//from  w w  w.  ja va 2s.  co  m
    font.setColor(Color.BLACK);
    spriteBatch.begin();
    //      spriteBatch.setProjectionMatrix(camera.combined);
    font.draw(spriteBatch, "SCORE", 1100, VIEWPORT_HEIGHT);
    font.draw(spriteBatch, "" + controller.getScore(), 1100, VIEWPORT_HEIGHT - FONT_HEIGHT);

    font.draw(spriteBatch, "LEVEL", 1100, VIEWPORT_HEIGHT - FONT_HEIGHT * 3);
    font.draw(spriteBatch, "" + controller.getLevel(), 1100, VIEWPORT_HEIGHT - FONT_HEIGHT * 4);

    Tetrimino nextShape = controller.getNextShape();
    nextShape.setPosition(new Vector2(11f, 16 - 10f));
    nextShape.forEachBlock(new RenderBlock() {
        public void renderBlock(float x, float y, Color color) {
            render(x, y, color);
        }
    });

    if (!controller.isGameRunning()) {
        font.setColor(Color.RED);

        font.setScale(12, 12);
        font.draw(spriteBatch, "GAME OVER", VIEWPORT_WIDTH / 4, (VIEWPORT_HEIGHT) / 2);

    }

    spriteBatch.end();

}