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

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

Introduction

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

Prototype

Color YELLOW

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

Click Source Link

Usage

From source file:mobi.shad.s3lib.gui.dialog.Editor2d.java

License:Apache License

public void create(Texture areaTexture, final float startX, final float startY, final float width,
        final float height, final ChangeListener changeListener) {

    super.create();

    backendWindow = GuiResource.windowBackend();
    backendWindow.setColor(1f, 1f, 1f, 0f);
    backendWindow.setVisible(false);//from  ww w  . j a v a  2  s.com
    S3.stage.addActor(backendWindow);

    mainWindow = GuiResource.window("WidgetBase", "WidgetBase");
    mainWindow.setColor(1f, 1f, 1f, 0f);
    mainWindow.setVisible(false);
    mainWindow.setModal(true);
    mainWindow.setMovable(false);

    this.currentX = startX;
    this.currentY = startY;
    this.currentWidth = width;
    this.currentHeight = height;
    //
    // Grid Layer
    //
    Pixmap pixmap = new Pixmap(10, 10, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    gridtextureLayer = new Texture(pixmap);

    gridLayer = new Widget() {

        @Override
        public void draw(Batch batch, float parentAlpha) {
            batch.setColor(0.8f, 0.8f, 0.8f, 0.3f);
            batch.draw(gridtextureLayer, 0, S3Constans.gridY1, S3Screen.width, 1);
            batch.draw(gridtextureLayer, 0, S3Constans.gridY2, S3Screen.width, 1);
            batch.draw(gridtextureLayer, 0, S3Constans.gridY3, S3Screen.width, 1);
            batch.draw(gridtextureLayer, 0, S3Constans.gridY4, S3Screen.width, 1);
            batch.draw(gridtextureLayer, 0, S3Constans.gridY5, S3Screen.width, 3);
            batch.draw(gridtextureLayer, 0, S3Constans.gridY6, S3Screen.width, 1);
            batch.draw(gridtextureLayer, 0, S3Constans.gridY7, S3Screen.width, 1);
            batch.draw(gridtextureLayer, 0, S3Constans.gridY8, S3Screen.width, 1);
            batch.draw(gridtextureLayer, 0, S3Constans.gridY9, S3Screen.width, 1);

            batch.draw(gridtextureLayer, S3Constans.gridX1, 0, 1, S3Screen.height);
            batch.draw(gridtextureLayer, S3Constans.gridX2, 0, 1, S3Screen.height);
            batch.draw(gridtextureLayer, S3Constans.gridX3, 0, 1, S3Screen.height);
            batch.draw(gridtextureLayer, S3Constans.gridX4, 0, 1, S3Screen.height);
            batch.draw(gridtextureLayer, S3Constans.gridX5, 0, 3, S3Screen.height);
            batch.draw(gridtextureLayer, S3Constans.gridX6, 0, 1, S3Screen.height);
            batch.draw(gridtextureLayer, S3Constans.gridX7, 0, 1, S3Screen.height);
            batch.draw(gridtextureLayer, S3Constans.gridX8, 0, 1, S3Screen.height);
            batch.draw(gridtextureLayer, S3Constans.gridX9, 0, 1, S3Screen.height);
        }
    };
    gridLayer.setX(0);
    gridLayer.setY(0);
    gridLayer.setWidth(S3Screen.width);
    gridLayer.setHeight(S3Screen.height);

    //
    //
    //
    final TextureRegion areaRegion = new TextureRegion(areaTexture);

    areaImage = new Widget() {

        @Override
        public void draw(Batch batch, float parentAlpha) {
            Color color = getColor();
            batch.setColor(color.r, color.g, color.b, parentAlpha);
            batch.draw(areaRegion, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(),
                    getScaleX(), getScaleY(), getRotation());
        }
    };
    areaImage.setX(currentX);
    areaImage.setY(currentY);
    areaImage.setWidth(currentWidth);
    areaImage.setHeight(currentHeight);

    //
    // Create texture
    //
    Pixmap redPixmap = new Pixmap(32, 32, Pixmap.Format.RGBA8888);
    redPixmap.setColor(Color.RED);
    redPixmap.fillCircle(16, 16, 14);
    Texture redTexture = new Texture(redPixmap);
    Pixmap yellowPixmap = new Pixmap(32, 32, Pixmap.Format.RGBA8888);
    yellowPixmap.setColor(Color.YELLOW);
    yellowPixmap.fillCircle(16, 16, 14);
    Texture yellowTexture = new Texture(yellowPixmap);
    Pixmap greenPixmap = new Pixmap(32, 32, Pixmap.Format.RGBA8888);
    greenPixmap.setColor(Color.GREEN);
    greenPixmap.fillCircle(16, 16, 14);
    Texture greenTexture = new Texture(greenPixmap);

    //
    //
    //
    TextButton textButtonOk = GuiResource.textButton("Save", "Save");
    TextButton textButtonFullScreen = GuiResource.textButton("Full", "Full");
    TextButton textButtonCenter = GuiResource.textButton("Center", "Center");
    TextButton textButtonCancel = GuiResource.textButton("Cancel", "Cancel");

    //
    //
    //
    textButtonOk.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            S3Log.log("Editor2d::textButtonOk::clicked", " event: " + event + " actor: " + actor.toString(), 2);
            hide();
            if (changeListener != null) {
                changeListener.changed(event, areaImage);
            }
        }
    });

    textButtonFullScreen.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            S3Log.log("Editor2d::textButtonFullScreen::clicked", " event: " + event + " x: " + x + " y: " + y,
                    2);
            currentX = 0;
            currentY = 0;
            currentWidth = S3Screen.width;
            currentHeight = S3Screen.height;
            setAreaPosistion();
            setTouchPosistion();
        }
    });

    textButtonCenter.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            S3Log.log("Editor2d::textButtonCenter::clicked", " event: " + event + " x: " + x + " y: " + y, 2);
            currentX = S3Screen.centerX - (float) S3Screen.centerX / 2;
            currentY = S3Screen.centerY - (float) S3Screen.centerY / 2;
            currentWidth = (float) S3Screen.centerX;
            currentHeight = (float) S3Screen.centerY;
            setAreaPosistion();
            setTouchPosistion();
        }
    });

    textButtonCancel.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            S3Log.log("Editor2d::textButtonCancel::clicked", " event: " + event + " x: " + x + " y: " + y, 2);
            currentX = startX;
            currentY = startY;
            currentWidth = width;
            currentHeight = height;
            hide();
        }
    });

    sizeElementLabel = GuiResource.label("X: Y: Width: Height:", "sizeElementLabel");
    mainWindow.row();
    mainWindow.add(textButtonOk);
    mainWindow.add(textButtonFullScreen);
    mainWindow.add(textButtonCenter);
    mainWindow.add(textButtonCancel);
    mainWindow.row();
    mainWindow.add(sizeElementLabel).colspan(4).left();
    GuiUtil.windowPosition(mainWindow, 0, 0);

    S3.stage.addActor(gridLayer);
    S3.stage.addActor(areaImage);

    //
    // Create AreaPlot
    //
    dotLeftImage = createAreaPoint("dotLeftImage", redTexture, (int) (currentX - 16),
            (int) (currentY + (currentHeight / 2) - 16));
    dotRightImage = createAreaPoint("dotRightImage", redTexture, (int) (currentX + currentWidth - 16),
            (int) (currentY + (currentHeight / 2) - 16));

    dotTopImage = createAreaPoint("dotTopImage", redTexture, (int) (currentX + (currentWidth / 2) - 16),
            (int) (currentY + currentHeight - 16));
    dotBottomImage = createAreaPoint("dotBottomImage", redTexture, (int) (currentX + (currentWidth / 2) - 16),
            (int) (currentY - 16));

    dotTopLeftImage = createAreaPoint("dotTopLeftImage", yellowTexture, (int) (currentX - 16),
            (int) (currentY + currentHeight - 16));
    dotTopRightImage = createAreaPoint("dotTopRightImage", yellowTexture, (int) (currentX + currentWidth - 16),
            (int) (currentY + currentHeight - 16));

    dotBottomLeftImage = createAreaPoint("dotBottomLeftImage", yellowTexture,
            (int) (currentX + currentWidth - 16), (int) (currentY - 16));
    dotBottomRightImage = createAreaPoint("dotBottomRightImage", yellowTexture,
            (int) (currentX + currentWidth - 16), (int) (currentY - 16));

    dotCenterImage = createAreaPoint("dotCenter", greenTexture, (int) (currentX + (currentWidth / 2) - 16),
            (int) (currentY + (currentHeight / 2) - 16));

    S3.stage.addActor(mainWindow);

    //
    // Assign Listener
    //
    mainWindow.addListener(new InputListener() {
        @Override
        public void touchDragged(InputEvent event, float x, float y, int pointer) {

            lastPointX = pointX;
            lastPointY = pointY;
            pointX = x;
            pointY = y;

            deltaX = pointX - lastPointX;
            deltaY = pointY - lastPointY;

            S3Log.log("dotCenterImage::touchDragged", " event: " + event + " x: " + x + " y: " + y
                    + " pointer: " + pointer + " deltaX: " + deltaX + " deltaY: " + deltaY, 3);

            if (pointClick != null) {
                S3Log.log("dotCenterImage::touchDragged",
                        " Point click: " + pointClickName + " aX: " + aspectRatioX + " aY: " + aspectRatioY, 2);
                if (pointClickName.equalsIgnoreCase("dotLeftImage")) {
                    if (currentX > 0 && deltaX < 0 && currentWidth >= 32) {
                        currentX += deltaX;
                        currentWidth -= deltaX;
                    } else if (currentX < S3Screen.width && deltaX > 0 && currentWidth > 32) {
                        currentX += deltaX;
                        currentWidth -= deltaX;
                    }
                    setAreaPosistion();
                    setTouchPosistion();
                } else if (pointClickName.equalsIgnoreCase("dotRightImage")) {
                    if (currentX + currentWidth > 0 && currentX + currentWidth < S3Screen.width
                            && currentWidth >= 32 && currentX > -1 && deltaX > 0) {
                        currentWidth += deltaX;
                    } else if (currentX + currentWidth > 0 && currentX + currentWidth <= S3Screen.width
                            && currentWidth >= 32 && currentX > -1 && deltaX < 0) {
                        currentWidth += deltaX;
                    }
                    setAreaPosistion();
                    setTouchPosistion();
                } else if (pointClickName.equalsIgnoreCase("dotTopImage")) {
                    if (currentY + currentHeight > 0 && currentY + currentHeight < S3Screen.height
                            && currentHeight >= 32 && currentY > -1 && deltaY > 0) {
                        currentHeight += deltaY;
                    } else if (currentY + currentHeight > 0 && currentY + currentHeight <= S3Screen.height
                            && currentHeight >= 32 && currentY > -1 && deltaY < 0) {
                        currentHeight += deltaY;
                    }
                    setAreaPosistion();
                    setTouchPosistion();
                } else if (pointClickName.equalsIgnoreCase("dotBottomImage")) {
                    if (currentY > 0 && deltaY < 0 && currentHeight >= 32) {
                        currentY += deltaY;
                        currentHeight -= deltaY;
                    } else if (currentY < S3Screen.height && deltaY > 0 && currentHeight > 32) {
                        currentY += deltaY;
                        currentHeight -= deltaY;
                    }
                    setAreaPosistion();
                    setTouchPosistion();
                } else if (pointClickName.equalsIgnoreCase("dotTopRightImage")) {
                    float delta = (deltaX + deltaY) / 2;
                    currentHeight += delta * aspectRatioY;
                    currentWidth += delta * aspectRatioX;
                    setAreaPosistion();
                    setTouchPosistion();
                } else if (pointClickName.equalsIgnoreCase("dotBottomLeftImage")) {
                    float delta = (deltaX + deltaY) / 2;
                    currentX += delta * aspectRatioX;
                    currentY += delta * aspectRatioY;
                    currentHeight -= delta * aspectRatioY;
                    currentWidth -= delta * aspectRatioX;
                    setAreaPosistion();
                    setTouchPosistion();
                } else if (pointClickName.equalsIgnoreCase("dotCenter")) {
                    currentX += deltaX;
                    currentY += deltaY;
                    setAreaPosistion();
                    setTouchPosistion();
                } else if (pointClickName.equalsIgnoreCase("dotTopLeftImage")) {
                    float delta = (deltaX - deltaY) / 2;
                    currentX += delta * aspectRatioY;
                    currentHeight -= delta * aspectRatioY;
                    currentWidth -= delta * aspectRatioY;
                    setAreaPosistion();
                    setTouchPosistion();
                } else if (pointClickName.equalsIgnoreCase("dotBottomRightImage")) {
                    float delta = (deltaX - deltaY) / 2;
                    currentY -= delta * aspectRatioY;
                    currentHeight += delta * aspectRatioY;
                    currentWidth += delta * aspectRatioY;
                    setAreaPosistion();
                    setTouchPosistion();
                }

                //
                // dotBottomRightImage

            } else if (isAreaImageClick) {
                currentX += deltaX;
                currentY += deltaY;
                setAreaPosistion();
                setTouchPosistion();
            }
        }

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            S3Log.log("dotCenterImage::touchDown", " event: " + event + " x: " + x + " y: " + y + " pointer: "
                    + pointer + " button: " + button, 3);

            pointX = x;
            pointY = y;
            lastPointX = x;
            lastPointY = y;

            isAreaImageClick = checkAreaClick(x, y);
            pointClick = checkPointClick(x, y);
            return true;
        }

        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            S3Log.log("dotCenterImage::touchUp", " event: " + event + " x: " + x + " y: " + y + " pointer: "
                    + pointer + " button: " + button, 2);
            isAreaImageClick = false;
            pointClick = null;
            pointClickName = "";
        }
    });

    setAreaPosistion();
    setTouchPosistion();
}

From source file:mobi.shad.s3lib.gui.widget.HtmlView.java

License:Apache License

/**
 * @param node/*from   w  w w .jav  a  2s  .  c  o m*/
 * @return
 */
private CssStyle parseCssStyle(final Element node) {
    final CssStyle style = new CssStyle();

    //
    // Color
    //
    String color = node.getAttribute("color", "");
    if (color.equalsIgnoreCase("yellow")) {
        style.color = Color.YELLOW;
    } else if (color.equalsIgnoreCase("red")) {
        style.color = Color.RED;
    } else if (color.equalsIgnoreCase("green")) {
        style.color = Color.GREEN;
    } else if (color.equalsIgnoreCase("cyan")) {
        style.color = Color.CYAN;
    } else if (color.equalsIgnoreCase("blue")) {
        style.color = Color.BLUE;
    } else if (color.equalsIgnoreCase("gray")) {
        style.color = Color.GRAY;
    } else if (color.equalsIgnoreCase("light_gray")) {
        style.color = Color.LIGHT_GRAY;
    } else if (color.equalsIgnoreCase("dark_gray")) {
        style.color = Color.DARK_GRAY;
    } else if (color.equalsIgnoreCase("orange")) {
        style.color = Color.ORANGE;
    } else if (color.equalsIgnoreCase("magenta")) {
        style.color = Color.MAGENTA;
    } else if (color.equalsIgnoreCase("pink")) {
        style.color = Color.PINK;
    }

    //
    // Align
    //
    String align = node.getAttribute("align", "");
    if (align.equalsIgnoreCase("right")) {
        style.align = Align.right;
    } else if (align.equalsIgnoreCase("left")) {
        style.align = Align.left;
    } else if (align.equalsIgnoreCase("center")) {
        style.align = Align.center;
    } else {
        style.align = Align.left;
    }

    //
    // Font
    //
    String font = node.getAttribute("font", "");
    //      if (font.equalsIgnoreCase("sans12")){
    //         style.font="sans12";
    //      } else if (font.equalsIgnoreCase("sans13")){
    //         style.font="sans13";
    //      } else if (font.equalsIgnoreCase("sans14")){
    //         style.font="sans14";
    //      } else if (font.equalsIgnoreCase("sans15")){
    //         style.font="sans15";
    //      } else if (font.equalsIgnoreCase("droid14")){
    //         style.font="droid14";
    //      } else if (font.equalsIgnoreCase("droid15")){
    //         style.font="droid15";
    //      } else if (font.equalsIgnoreCase("droid16")){
    //         style.font="droid16";
    //      } else if (font.equalsIgnoreCase("droid17")){
    //         style.font="droid17";
    //      } else if (font.equalsIgnoreCase("droid18")){
    //         style.font="droid18";
    //      } else if (font.equalsIgnoreCase("droid22")){
    //         style.font="droid22";
    //      } else if (font.equalsIgnoreCase("droid24")){
    //         style.font="droid24";
    //      }

    //
    // CollSpan
    //
    int collSpan = node.getIntAttribute("collspan", 1);
    if (collSpan > 1) {
        style.collSpan = collSpan;
    }

    return style;
}

From source file:mobi.shad.s3libTest.G2DSimpleShapes.java

License:Apache License

@Override
public void render(S3Gfx g) {
    g.clear(0.2f, 0.0f, 0.0f);/*  w  w w . j  a  v a  2 s . co  m*/

    g.setColor(Color.YELLOW);
    g.drawCircle(30, 30, 20);

    g.setColor(Color.GREEN);

    g.drawFilledRectangle(80, 30, 10, 10, 0, Color.RED);
    g.drawFilledRectangle(80, 30, 20, 20, 0, new Color(0.5f, 0.5f, 0.5f, 0.5f));
}

From source file:mobi.shad.s3libTest.Screen3Menu.java

License:Apache License

@Override
public void initalize() {

    main = GuiResource.table("mainTable");

    label = GuiResource.label("BIG TITLE", "label1");
    label.setColor(Color.YELLOW);
    label.setStyle(skin.get("default-title", Label.LabelStyle.class));

    playBtn = GuiResource.textButton("Play", "play");
    configBtn = GuiResource.textButton("Config", "config");
    exitBtn = GuiResource.textButton("Exit", "exit");

    playBtn.setStyle(skin.get("default-light", TextButton.TextButtonStyle.class));
    configBtn.setStyle(skin.get("default-light", TextButton.TextButtonStyle.class));
    exitBtn.setStyle(skin.get("default-light", TextButton.TextButtonStyle.class));

    main.row();//w ww . j  a  v  a 2s.  c  om
    main.add(label);

    main.row();
    main.add(playBtn).center().fillX();
    main.row();
    main.add(configBtn).center().fillX();
    main.row();
    main.add(exitBtn).center().fillX();

    GuiUtil.windowPosition(main, GuiUtil.Position.CENTER);
    S3.stage.addActor(main);
}

From source file:mobi.shad.s3libTest.ScreenGameArea.java

License:Apache License

@Override
public void initalize() {

    main = GuiResource.table("mainTable");

    label = GuiResource.label("BIG TITLE", "label1");
    label.setColor(Color.YELLOW);
    label.setStyle(skin.get("default-title", Label.LabelStyle.class));

    playBtn = GuiResource.textButtonToggle("Play", "play");
    configBtn = GuiResource.textButton("Random", "random");
    exitBtn = GuiResource.textButton("Menu", "menu");

    speedSlider = GuiResource.slider(0, 10, 1, "Speed");
    gridSize = GuiResource.selectBox(new String[] { "32x32", "64x64", "128x128", "256x256", "512x512" },
            "GridSize");

    main.row();/*from w ww . ja  v a  2  s  .c o  m*/
    main.add(label).colspan(5).center();

    main.row();
    main.add("Grid");
    main.add(gridSize);

    main.row();
    main.add(speedSlider).colspan(2);
    main.add(playBtn);
    main.add(configBtn);
    main.add(exitBtn);

    main.row();
    main.add("Main").expandX().expandY().fillX().fillY();

    GuiUtil.windowPosition(main, GuiUtil.Position.TOP);
    stage.addActor(main);
}

From source file:mobi.shad.s3libTest.VirtualSpritePicking.java

License:Apache License

@Override
public void render(S3Gfx gfx) {
    S3Gfx.clear(0.2f, 0.0f, 0.0f);//from   w  ww .ja  v  a  2 s .c o m
    S3.spriteBatch.setProjectionMatrix(S3.fixedCamera.combined);
    S3.spriteBatch.begin();
    for (int i = 0; i < numSprite; i++) {
        sprites[i].setColor(Color.WHITE);
        boundingRectangle = sprites[i].getBoundingRectangle();
        if (boundingRectangle.contains(unprojectedVertex.x, unprojectedVertex.y)) {
            sprites[i].setColor(Color.YELLOW);
        }
        sprites[i].draw(S3.spriteBatch);
    }
    S3.spriteBatch.end();
}

From source file:name.herve.bastod.BASToD.java

License:Open Source License

private void initGUIResources(int sqs) {
    GUIResources r = GUIResources.getInstance();
    DecimalFormat blender = new DecimalFormat("0000");

    String set = "bricks";
    String view = "top";

    for (int a = 0; a < 360; a++) {
        r.addTexture("tank-red-" + a, new Texture(Gdx.files
                .internal(sqs + "/3d/" + set + "/" + view + "/tank/red/" + blender.format(a + 1) + ".png")));
        r.addTexture("tank-blue-" + a, new Texture(Gdx.files
                .internal(sqs + "/3d/" + set + "/" + view + "/tank/blue/" + blender.format(a + 1) + ".png")));

        r.addTexture("tower-red-" + a, new Texture(Gdx.files
                .internal(sqs + "/3d/" + set + "/" + view + "/tower/red/" + blender.format(a + 1) + ".png")));
        r.addTexture("tower-blue-" + a, new Texture(Gdx.files
                .internal(sqs + "/3d/" + set + "/" + view + "/tower/blue/" + blender.format(a + 1) + ".png")));
    }//from w ww  .  j  a  va 2s. co  m

    r.addTexture("tower-red", new Texture(
            Gdx.files.internal(sqs + "/3d/" + set + "/" + view + "/tower/red/" + blender.format(50) + ".png")));
    r.addTexture("tower-blue", new Texture(Gdx.files
            .internal(sqs + "/3d/" + set + "/" + view + "/tower/blue/" + blender.format(50) + ".png")));

    r.addTexture("factory-red", new Texture(Gdx.files
            .internal(sqs + "/3d/" + set + "/" + view + "/factory/red/" + blender.format(0) + ".png")));
    r.addTexture("factory-blue", new Texture(Gdx.files
            .internal(sqs + "/3d/" + set + "/" + view + "/factory/blue/" + blender.format(0) + ".png")));

    r.addTexture("target-red", new Texture(
            Gdx.files.internal(sqs + "/3d/" + set + "/" + view + "/target/red/" + blender.format(0) + ".png")));
    r.addTexture("target-blue", new Texture(Gdx.files
            .internal(sqs + "/3d/" + set + "/" + view + "/target/blue/" + blender.format(0) + ".png")));

    r.addTexture("wall", new Texture(
            Gdx.files.internal(sqs + "/3d/" + set + "/" + view + "/wall/" + blender.format(0) + ".png")));

    r.addTexture("shot-red", new Texture(Gdx.files.internal(sqs + "/shot-red.png")));
    r.addTexture("shot-blue", new Texture(Gdx.files.internal(sqs + "/shot-blue.png")));

    r.addTexture(ImprovementButton.IMPROVEMENT_BORDER,
            new Texture(Gdx.files.internal(sqs + "/improvement.png")));

    r.addTexture("noway", new Texture(Gdx.files.internal(sqs + "/noway.png")));
    r.addTexture("more_metal", new Texture(Gdx.files.internal(sqs + "/more_metal.png")));
    r.addTexture("increase_speed", new Texture(Gdx.files.internal(sqs + "/increase_speed.png")));
    r.addTexture("title", new Texture(Gdx.files.internal("title.png")));
    r.addTexture("background", new Texture(Gdx.files.internal("background.png")));

    r.addColor(Player.PLAYER_RED, Color.RED);
    r.addColor(Player.PLAYER_BLUE, Color.BLUE);

    r.addFont(Player.PLAYER_RED, GUIResources.createFont(GUIResources.DEFAULT_FONT,
            GUIResources.DEFAULT_FONT_SIZE, GUIResources.getInstance().getColor(Player.PLAYER_RED)));
    r.addFont(Player.PLAYER_BLUE, GUIResources.createFont(GUIResources.DEFAULT_FONT,
            GUIResources.DEFAULT_FONT_SIZE, GUIResources.getInstance().getColor(Player.PLAYER_BLUE)));
    r.addFont(UnitInfoBox.INFOBOX_FONT,
            GUIResources.createFont(GUIResources.DEFAULT_FONT, GUIResources.SMALL_FONT_SIZE, Color.YELLOW));
}

From source file:name.herve.bastod.gui.components.UnitInfoBox.java

License:Open Source License

public UnitInfoBox(Unit u) {
    super(u.getName() + "-InfoBox", -1, -1, 200, 100);
    this.unit = u;

    setNeedUpdate(false);/*from   w  w w .j  a  v  a2s  .c o  m*/
    font = GUIResources.getInstance().getFont(INFOBOX_FONT);

    moveTo(u.getPositionOnBoard().getXInt(), u.getPositionOnBoard().getYInt());

    Blending bck = Pixmap.getBlending();
    Pixmap.setBlending(Blending.None);

    Pixmap p = new Pixmap(getWidth(), getHeight(), Pixmap.Format.RGBA8888);
    Color c1 = Color.YELLOW;
    c1.a = 1f;
    p.setColor(c1);

    p.drawRectangle(0, 0, getWidth(), getHeight());

    c1 = Color.BLACK;
    c1.a = 0.5f;
    p.setColor(c1);

    p.fillRectangle(1, 1, getWidth() - 2, getHeight() - 2);

    setBackground(new Texture(p));
    p.dispose();
    Pixmap.setBlending(bck);
}

From source file:name.herve.bastod.gui.screen.game.SpriteManager.java

License:Open Source License

private void renderPath(Mobile m) {
    if (!pathTextures.containsKey(m)) {
        Dimension dimB = engine.getBoardDimension();

        Blending bck = Pixmap.getBlending();
        Pixmap.setBlending(Blending.None);

        Pixmap p = new Pixmap(dimB.getW() + 1, dimB.getH() + 1, Pixmap.Format.RGBA8888);

        Color c = Color.GREEN.cpy();
        p.setColor(c);//from   w  w w . j  a  va  2s . com
        Vector current = m.getPlayer().getStartPositionOnBoard();
        for (Vector next : m.getUnsmoothedPath()) {
            p.drawLine(current.getXInt(), dimB.getH() - current.getYInt(), next.getXInt(),
                    dimB.getH() - next.getYInt());
            current = next;
        }

        c = Color.YELLOW.cpy();
        p.setColor(c);
        current = m.getPlayer().getStartPositionOnBoard();
        for (Vector next : m.getPath()) {
            p.drawLine(current.getXInt(), dimB.getH() - current.getYInt(), next.getXInt(),
                    dimB.getH() - next.getYInt());
            current = next;
        }

        pathTextures.put(m, new Texture(p));
        p.dispose();
        Pixmap.setBlending(bck);
    }

    draw(pathTextures.get(m), Engine._SP_SIDE, Engine._SP_BOTTOM);

    // tPath.dispose();
}

From source file:net.bplaced.therefactory.voraciousviper.screens.TitleScreen.java

License:Open Source License

private void renderScoreTable() {
    float xOffsetScoreTable = (spriteTitle.getX() - rectangleTitleScoreTable.x);

    font.setColor(Color.YELLOW);
    font.draw(stage.getBatch(), VoraciousViper.getInstance().getBundle().get(I18NKeys.ViviTopScoreTable),
            xOffsetScoreTable + 240, viewport.getWorldHeight() - 20);

    font.setColor(Color.LIGHT_GRAY);
    font.draw(stage.getBatch(), VoraciousViper.getInstance().getBundle().get(I18NKeys.Name),
            xOffsetScoreTable + 46, viewport.getWorldHeight() - 40);
    font.draw(stage.getBatch(), VoraciousViper.getInstance().getBundle().get(I18NKeys.Date),
            xOffsetScoreTable + 240, viewport.getWorldHeight() - 40);
    font.draw(stage.getBatch(), VoraciousViper.getInstance().getBundle().get(I18NKeys.Steps),
            xOffsetScoreTable + 390, viewport.getWorldHeight() - 40);
    font.draw(stage.getBatch(), VoraciousViper.getInstance().getBundle().get(I18NKeys.Level),
            xOffsetScoreTable + 460, viewport.getWorldHeight() - 40);
    font.draw(stage.getBatch(), VoraciousViper.getInstance().getBundle().get(I18NKeys.Score),
            xOffsetScoreTable + 510, viewport.getWorldHeight() - 40);

    font.setColor(Color.WHITE);//from ww  w  .  j av a 2s. c  om
    if (scoreEntries != null) {
        for (int i = 0; i < scoreEntries.length; i++) {
            if (scoreEntries[i] == null) {
                continue;
            }
            font.setColor(scoreEntries[i].getId().equals(SettingsManager.getInstance().getPlayerId())
                    ? new Color(0, 1, 0, fetching ? .5f : 1)
                    : new Color(1, 1, 1, fetching ? .5f : 1));
            float y = (scrollbarMaximumY - i * Config.LINE_HEIGHT_HIGHSCORES + inputHandler.getDeltaY());
            if (y > 0 && y <= scrollbarMaximumY) { // lines disappear when having y above topY and below 0

                // name
                stringBuilder.append(Utils.padLeft(i + 1, 3)).append(". ")
                        .append(scoreEntries[i].getName().trim().length() == 0
                                ? VoraciousViper.getInstance().getBundle().get(I18NKeys.Unknown)
                                : scoreEntries[i].getName());
                font.draw(stage.getBatch(), stringBuilder, xOffsetScoreTable + 10, y);
                stringBuilder.setLength(0);

                // date
                font.draw(stage.getBatch(), scoreEntries[i].getDate(), xOffsetScoreTable + 240, y);

                // numSteps
                font.draw(stage.getBatch(), scoreEntries[i].getNumSteps() + "", xOffsetScoreTable + 390, y);

                // level
                font.draw(stage.getBatch(), stringBuilder.append(scoreEntries[i].getLevel()),
                        xOffsetScoreTable + 460, y);
                stringBuilder.setLength(0);

                // score
                font.draw(stage.getBatch(), stringBuilder.append(scoreEntries[i].getScore()),
                        xOffsetScoreTable + 510, y);

                stringBuilder.setLength(0);
            }
        }
    } else {
        font.draw(stage.getBatch(), customHighscoreText, xOffsetScoreTable + 10, scrollbarMaximumY);
    }
    if (fetching) {
        font.setColor(Color.WHITE);
        String fetching = VoraciousViper.getInstance().getBundle().get(I18NKeys.Fetching) + "...";
        font.draw(stage.getBatch(), fetching,
                viewport.getWorldWidth() / 2 - Utils.getFontWidth(fetching, font) / 2 + xOffsetScoreTable,
                viewport.getWorldHeight() / 2 - Utils.getFontHeight(fetching, font) / 2);
    }
}