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:CB_UI_Base.GL_UI.Activitys.ImageActivity.java

License:Open Source License

public ImageActivity(Image selectionImage) {
    super("ImageActivity");

    float wh = 30 * UI_Size_Base.that.getScale();
    deleteImage = new Image(this.getWidth() - wh, this.getHeight() - wh, wh, wh, "", false);
    deleteImage.setDrawable(new SpriteDrawable(Sprites.getSprite(IconName.closeIcon.name())));
    this.addChild(deleteImage);
    deleteImage.setOnClickListener(deleteClick);
    this.setClickable(true);

    this.setBackground(new ColorDrawable(new HSV_Color(Color.BLACK)));
    img = selectionImage;//w w w. j a  va 2 s.co  m
    mapIntHeight = (int) this.getHeight();
    screenCenterW.x = (long) (this.getHalfWidth());
    screenCenterW.y = (long) -(this.getHalfHeight()); //-(img.getImageLoader().getSpriteHeight() / 2);

    screenCenterT.x = 0;
    screenCenterT.y = 0;

    // initial Zoom Buttons
    zoomBtn = new ZoomButtons(GL_UISizes.ZoomBtn, this, "ZoomButtons");
    zoomBtn.setX(this.getWidth() - (zoomBtn.getWidth() + UI_Size_Base.that.getMargin()));
    zoomBtn.setMinimumFadeValue(0.3f);
    zoomBtn.setMaxZoom(MAX_MAP_ZOOM);
    zoomBtn.setMinZoom(0);
    zoomBtn.setZoom(0);

    zoomBtn.setOnClickListenerDown(new OnClickListener() {

        @Override
        public boolean onClick(GL_View_Base v, int x, int y, int pointer, int button) {
            kineticZoom = new KineticZoom(camera.zoom, getPosFactor(zoomBtn.getZoom()),
                    System.currentTimeMillis(), System.currentTimeMillis() + ZOOM_TIME);
            GL.that.addRenderView(ImageActivity.this, GL.FRAME_RATE_ACTION);
            GL.that.renderOnce();
            GL.that.renderOnce();

            return true;
        }
    });
    zoomBtn.setOnClickListenerUp(new OnClickListener() {
        @Override
        public boolean onClick(GL_View_Base v, int x, int y, int pointer, int button) {
            kineticZoom = new KineticZoom(camera.zoom, getPosFactor(zoomBtn.getZoom()),
                    System.currentTimeMillis(), System.currentTimeMillis() + ZOOM_TIME);
            GL.that.addRenderView(ImageActivity.this, GL.FRAME_RATE_ACTION);
            GL.that.renderOnce();
            GL.that.renderOnce();

            return true;
        }
    });
    this.addChild(zoomBtn);

    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    aktZoom = zoomBtn.getZoom();
    camera.zoom = getPosFactor(aktZoom);
    camera.position.set(0, 0, 0);

}

From source file:CB_UI_Base.GL_UI.Controls.html.HtmlView.java

License:Open Source License

private static float addTextBlog(CB_List<CB_View_Base> segmentViewList, Html_Segment_TextBlock seg,
        float innerWidth) {

    boolean markUp = !seg.hyperLinkList.isEmpty();

    BitmapFont font = FontCache.get(markUp, seg.getFontFamily(), seg.getFontStyle(), seg.getFontSize());
    GlyphLayout layout = new GlyphLayout(); // dont do this every frame!
    // Store it as member
    layout.setText(font, seg.formatedText, getColor(Color.BLACK), innerWidth - (margin * 2), Align.left, true);

    float segHeight = layout.height + (margin * 2);

    parseHyperLinks(seg, "http://");
    parseHyperLinks(seg, "www.");

    LinkLabel lbl = new LinkLabel("HtmlView" + " lbl", 0, 0, innerWidth - (margin * 2), segHeight);

    if (markUp) {
        lbl.setMarkupEnabled(true);/*from   www.j  av  a 2 s  .c  o  m*/
    }

    lbl.setTextColor(getColor(seg.getFontColor()));
    lbl.setFont(font).setHAlignment(seg.hAlignment);

    if (markUp) {
        lbl.addHyperlinks(seg.hyperLinkList);
    }

    lbl.setWrappedText(seg.formatedText);
    lbl.setUnderline(seg.underline);
    lbl.setStrikeout(seg.strikeOut);
    segmentViewList.add(lbl);

    return lbl.getHeight();
}

From source file:CB_UI_Base.GL_UI.Controls.html.Html_ListView_Bullet.java

License:Open Source License

public Html_ListView_Bullet(int idx, float width, float height, int bulletNumber) {
    super(width, height);
    this.idx = idx;

    if (bulletNumber == -1) {
        //ordet list (draw text)

        bulletDrawable = null;//from w  ww . j a  va2 s . c o m

        orderLabel = new Label(this.name + " orderLabel", this, String.valueOf(this.idx) + ".");
        orderLabel.setVAlignment(VAlignment.TOP);
        orderLabel.setY(-(HtmlView.margin / 2));
        this.addChild(orderLabel);
    } else {
        orderLabel = null;

        float pos = width / 2.6f;
        IGeometry geometry = null;

        switch (bulletNumber) {
        case 1:
            geometry = new Circle(this.getWidth() - pos, this.getHeight() - pos, pos / 2);
            break;
        case 2:
            geometry = new Ring(this.getWidth() - pos, this.getHeight() - pos, pos / 3f, pos / 2);
            break;
        case 3:
            float x = this.getWidth() - (pos);
            float y1 = this.getHeight() - pos;
            float y2 = this.getHeight();
            geometry = new Quadrangle(x, y1 - (pos / 2), x, y2 - (pos / 2), pos);
            break;
        default:
            //geometry = new Circle(this.getWidth() - pos, this.getHeight() - pos, pos / 2);
            break;
        }

        if (geometry != null) {
            GL_Paint paint = new GL_Paint();
            paint.setColor(Color.BLACK);
            bulletDrawable = new PolygonDrawable(geometry.getVertices(), geometry.getTriangles(), paint,
                    this.getWidth(), this.getHeight());
        } else
            bulletDrawable = null;
    }

}

From source file:CB_UI_Base.GL_UI.Controls.html.Html_Segment_HR.java

License:Open Source License

@Override
public void resolveAtributes() {

    /* TODO/*  w w  w.j ava2  s  . com*/
     * all priviose Attributes are ignored 
     * use only Tag attribute values 
     *   > noshade 
     *   > width="300" 
     *   > size="3" 
     *   > align="left"
     *   > color="#009900"
     */

    String color = null;
    for (Tag tag : tags) {
        if (!tag.getName().equals("font"))
            continue;
        List<Element> elements = tag.getAllElements();
        if (elements.isEmpty())
            elements.add(tag.getElement());
        for (Element ele : elements) {
            Attributes attributes = ele.getAttributes();
            for (Attribute attr : attributes) {
                if (attr.getKey().equals("color")) {
                    color = attr.getValue();
                }
            }
        }
    }
    if (color != null) {

        if (color.startsWith("#")) {
            try {
                this.color = new HSV_Color(color.replace("#", ""));
            } catch (Exception e) {
                this.color = new HSV_Color(Color.BLACK);
                throw new NotImplementedException("HTML Renderer Color <" + color + "> is not implemented");
            }
        } else {
            try {
                this.color = HTMLColors.getColor(color);
                if (this.color == null) {
                    this.color = new HSV_Color(Color.BLACK);
                    throw new NotImplementedException("HTML Renderer Color <" + color + "> is not implemented");
                }
            } catch (Exception e) {
                this.color = new HSV_Color(Color.BLACK);
                throw new NotImplementedException("HTML Renderer Color <" + color + "> is not implemented");
            }
        }

    }

    // resolve Font Size

    int size = 3;
    for (Tag tag : tags) {
        if (!tag.getName().toLowerCase().equals("font"))
            continue;
        List<Element> elements = tag.getAllElements();

        if (elements.isEmpty())
            elements.add(tag.getElement());

        for (Element ele : elements) {
            // tag.getElement().
            Attributes attributes = ele.getAttributes();
            for (Attribute attr : attributes) {
                if (attr.getKey().equals("size")) {

                    /*
                        * The following values are acceptable:
                       *
                       * 1, 2, 3, 4, 5, 6, 7
                       * +1, +2, +3, +4, +5, +6
                       * -1, -2, -3, -4, -5, -6
                        */

                    String value = attr.getValue();
                    if (value.startsWith("+")) {
                        int intSize = Integer.parseInt(value.replace("+", ""));
                        size += intSize;
                    } else if (value.startsWith("-")) {
                        int intSize = Integer.parseInt(value.replace("-", ""));
                        size -= intSize;
                    } else {
                        size = Integer.parseInt(value);
                    }

                }
            }
        }
    }
    if (size < 1)
        size = 1;
    if (size > 7)
        size = 7;

    this.hrsize = (Html_Segment_TextBlock.getFontPx(size) * UiSizes.that.getScale()
            * Html_Segment_TextBlock.DEFAULT_FONT_SIZE_FACTOR) / 10;
}

From source file:CB_UI_Base.GL_UI.Controls.html.Html_Segment_TextBlock.java

License:Open Source License

@Override
public void resolveAtributes() {

    resolveHAlignment();/*  www.j av a  2  s . co  m*/

    // resolve Font Color
    String color = null;
    for (Tag tag : tags) {
        //       if (!tag.getName().equals("font") && !tag.getName().toLowerCase().equals("style"))
        //      continue;
        List<Element> elements = tag.getAllElements();
        if (elements.isEmpty())
            elements.add(tag.getElement());
        for (Element ele : elements) {
            Attributes attributes = ele.getAttributes();

            if (attributes != null) {
                for (Attribute attr : attributes) {
                    if (attr.getKey().equals("color")) {
                        color = attr.getValue();
                    }
                    if (attr.getKey().equals("style")) {
                        String[] values = attr.getValue().split(";");

                        for (String value : values) {
                            String[] paar = value.split(":");
                            if (paar[0].equals("color")) {
                                color = paar[1];
                            }
                        }
                    }
                }
            }
        }
    }
    if (color != null) {

        if (color.startsWith("#")) {
            try {
                this.fontColor = new HSV_Color(color.replace("#", ""));
            } catch (Exception e) {
                this.fontColor = Color.BLACK;
                //throw new NotImplementedException("HTML Renderer Color <" + color + "> is not implemented");
            }
        } else {
            try {
                this.fontColor = HTMLColors.getColor(color);
                if (this.fontColor == null) {
                    this.fontColor = Color.BLACK;
                    //throw new NotImplementedException("HTML Renderer Color <" + color + "> is not implemented");
                }
            } catch (Exception e) {
                this.fontColor = Color.BLACK;
                //throw new NotImplementedException("HTML Renderer Color <" + color + "> is not implemented");
            }
        }

    }

    // resolve Font Size

    int size = 2;
    for (Tag tag : tags) {
        //       if (!tag.getName().toLowerCase().equals("font") && !tag.getName().toLowerCase().equals("style"))
        //      continue;
        List<Element> elements = tag.getAllElements();

        if (elements.isEmpty())
            elements.add(tag.getElement());

        for (Element ele : elements) {
            // tag.getElement().
            Attributes attributes = ele.getAttributes();
            if (attributes != null) {
                for (Attribute attr : attributes) {
                    if (attr.getKey().equals("size")) {

                        String value = attr.getValue();

                        size = getFontSizeFromString(size, value);
                    }
                    if (attr.getKey().equals("style")) {
                        String[] values = attr.getValue().split(";");

                        for (String value : values) {
                            String[] paar = value.split(":");
                            if (paar[0].equals("font-size")) {
                                size = getFontSizeFromString(size, paar[1]);
                            }
                            if (paar[0].equals("text-decoration")) {
                                if (paar[1].equals("underline"))
                                    underline = true;
                            }
                        }
                    }
                }
            }
        }
    }
    if (size < 1)
        size = 1;
    if (size > 7)
        size = 7;

    this.scaledfontSize = getFontPx(size) * UiSizes.that.getScale() * DEFAULT_FONT_SIZE_FACTOR;

    //resolve underline
    for (Tag tag : tags) {
        if (tag.getName().toLowerCase().equals("u")) {
            underline = true;
        }
        if (tag.getName().toLowerCase().startsWith("h")) {
            String value = tag.getName().substring(1);
            try {
                int intValue = Integer.parseInt(value);
                switch (intValue) {
                case 1:
                    h = H.H1;
                    break;
                case 2:
                    h = H.H2;
                    break;
                case 3:
                    h = H.H3;
                    break;
                case 4:
                    h = H.H4;
                    break;
                case 5:
                    h = H.H5;
                    break;
                case 6:
                    h = H.H6;
                    break;
                default:
                    h = H.H0;
                    break;
                }
            } catch (NumberFormatException e) {

            }
        }

    }

    if (h != H.H0) {

        /* h1: 2em
           h2: 1.5em
           h3: 1.17em
           h4: 1em
           h5: 0.83em
           h6: 0.75em 
        */

        switch (h) {

        case H1:
            this.scaledfontSize *= 2;
            break;
        case H2:
            this.scaledfontSize *= 1.5f;
            break;
        case H3:
            this.scaledfontSize *= 1.17f;
            break;
        case H4:
            break;
        case H5:
            this.scaledfontSize *= 0.83f;
            break;
        case H6:
            this.scaledfontSize *= 0.75f;
            break;

        case H0:
            break;
        default:
            break;

        }
    }

    // resolve Font Style

    boolean BOOLD = false;
    boolean ITALIC = false;
    for (Tag tag : tags) {
        if (tag.getName().toLowerCase().equals("strong") || tag.getName().toLowerCase().equals("b")) {
            BOOLD = true;
        } else if (tag.getName().toLowerCase().equals("i")) {
            ITALIC = true;
        } else if (tag.getName().toLowerCase().equals("strike")) {
            strikeOut = true;
        }

    }

    if (h != H.H0)
        BOOLD = true;

    if (!BOOLD && !ITALIC)
        this.fontStyle = GL_FontStyle.NORMAL;
    if (BOOLD && !ITALIC)
        this.fontStyle = GL_FontStyle.BOLD;
    if (BOOLD && ITALIC)
        this.fontStyle = GL_FontStyle.BOLD_ITALIC;
    if (!BOOLD && ITALIC)
        this.fontStyle = GL_FontStyle.ITALIC;

    //   System.out.print(true);
}

From source file:CB_UI_Base.graphics.GL_Paint.java

License:Open Source License

public GL_Paint() {
    this.cap = GL_Cap.BUTT;
    this.join = Join.MITER;
    this.color = new HSV_Color(com.badlogic.gdx.graphics.Color.BLACK);
    this.style = GL_Style.FILL;
}

From source file:com.aia.hichef.ui.n.MyDialog.java

License:Apache License

/**
 * Adds a label to the content table. The dialog must have been constructed
 * with a skin to use this method./*from www.  ja va 2 s  .c  o  m*/
 */
public MyDialog text(String text) {
    return text(text, new LabelStyle(Assets.instance.fontFactory.getLight20(), Color.BLACK));
}

From source file:com.andgate.ikou.view.FloorSelectScreen.java

License:Open Source License

public void buildStage() {
    stage.clear();//from  www  .  j ava2s. c om
    stage.getViewport().setWorldSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    stage.getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);

    final Label.LabelStyle titleLabelStyle = new Label.LabelStyle(game.menuTitleFont, Color.CYAN);
    final ShaderLabel titleLabel = new ShaderLabel(SELECT_FLOOR_TEXT, titleLabelStyle, game.fontShader);

    final Label.LabelStyle floorOptionLabelStyle = new Label.LabelStyle(game.menuOptionFont, Color.BLACK);
    final Label.LabelStyle lockedFloorOptionLabelStyle = new Label.LabelStyle(game.menuOptionFont, Color.GRAY);
    Table floorOptionsTable = new Table();

    float padding = 0.5f * game.ppm;
    float actorLength = (float) Gdx.graphics.getWidth() / COLUMNS - padding * 2.0f;

    for (int floorNumber = 1; floorNumber <= levelData.totalFloors; floorNumber++) {
        ShaderLabel floorLabel = null;
        if (floorNumber <= levelData.completedFloors + 1) {
            floorLabel = new ShaderLabel("" + floorNumber, floorOptionLabelStyle, game.fontShader);
            floorLabel.addListener(new FloorOptionClickListener(game, this, levelData, floorNumber));
        } else {
            floorLabel = new ShaderLabel("?", lockedFloorOptionLabelStyle, game.fontShader);
        }

        floorOptionsTable.add(floorLabel).pad(padding).width(actorLength).height(actorLength).center();

        if (floorNumber % COLUMNS == 0) {
            floorOptionsTable.row();
        }
    }

    ScrollPane scrollPane = new ScrollPane(floorOptionsTable);

    Table table = new Table();

    table.add(titleLabel).center().top().row();
    table.add(scrollPane).fill().expand().top().left();

    table.setFillParent(true);

    stage.addActor(table);
    stage.setDebugAll(true);
}

From source file:com.andgate.ikou.view.GameScreen.java

License:Open Source License

private void renderOverlay() {
    controlsMenu.render();//from   w  w w  .  ja  v a 2  s . c o m

    String fpsString = "FPS: " + Gdx.graphics.getFramesPerSecond();
    float font_height = game.menuOptionFont.getCapHeight() * game.menuOptionFont.getScale();
    float font_y = Gdx.graphics.getHeight() - font_height;

    batch.begin();
    batch.setShader(game.fontShader);
    game.menuOptionFont.setColor(Color.BLACK);
    game.menuOptionFont.draw(batch, fpsString, game.ppm, font_y);
    batch.setShader(null);
    batch.end();
}

From source file:com.badlogic.gdx.tests.bullet.OcclusionBuffer.java

License:Apache License

/** Draw the depth buffer to a texture. Slow, should only be used for debugging purposes.
 *
 * @return Region of debug texture */
public TextureRegion drawDebugTexture() {
    if (debugPixmap == null) {
        debugPixmap = new Pixmap(bufferWidth, bufferHeight, Pixmap.Format.RGBA8888);
        debugTexture = new Texture(debugPixmap);
        debugTextureRegion = new TextureRegion(debugTexture);
        debugTextureRegion.flip(false, true);
    }/*  www. j  a  va  2s  . c o m*/
    debugPixmap.setColor(Color.BLACK);
    debugPixmap.fill();
    // Find min/max depth values in buffer
    float minDepth = Float.POSITIVE_INFINITY;
    float maxDepth = Float.NEGATIVE_INFINITY;
    buffer.clear();
    while (buffer.position() < buffer.capacity()) {
        float depth = MathUtils.clamp(buffer.get(), 0, Float.POSITIVE_INFINITY);
        minDepth = Math.min(depth, minDepth);
        maxDepth = Math.max(depth, maxDepth);
    }
    float extent = 1 / (maxDepth - minDepth);
    buffer.clear();
    // Draw to pixmap
    for (int x = 0; x < bufferWidth; x++) {
        for (int y = 0; y < bufferHeight; y++) {
            float depth = MathUtils.clamp(buffer.get(x + y * bufferWidth), 0, Float.POSITIVE_INFINITY);
            float c = depth * extent;
            debugPixmap.drawPixel(x, y, Color.rgba8888(c, c, c, 1));
        }
    }
    debugTexture.draw(debugPixmap, 0, 0);
    return debugTextureRegion;
}