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

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

Introduction

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

Prototype

public Color(Color color) 

Source Link

Document

Constructs a new color using the given color

Usage

From source file:com.jmolina.orb.widgets.ui.Stat.java

License:Open Source License

/**
 * Modifica el color del texto/*  w w w . ja  v  a  2  s.c  om*/
 *
 * @param color Color
 */
public void setLabelColor(int color) {
    nameStyle.fontColor = new Color(color);
    dataStyle.fontColor = new Color(color);
    name.setStyle(nameStyle);
    data.setStyle(dataStyle);
}

From source file:com.jmolina.orb.widgets.ui.SuccessTitle.java

License:Open Source License

/**
 * Constructor/*from w w  w .  j  av a 2 s.  com*/
 *
 * @param am AssetManager
 * @param title Titulo
 */
public SuccessTitle(AssetManager am, String title) {
    super(am);

    background = new Image(getAssetManager().get(Asset.UI_SUCCESS_TITLE_BACKGROUND, Texture.class));
    background.setPosition(0f, 0f);

    Label.LabelStyle style = new Label.LabelStyle();
    style.fontColor = new Color(Var.COLOR_WHITE);
    style.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_BOLD_45),
            findRegion(Atlas.FONT_ROBOTO_BOLD_45));

    label = new Label(title.toUpperCase(), style);
    label.setSize(Utils.cell(10), Utils.cell(1));
    label.setPosition(Utils.cell(0), Utils.cell(0));
    label.setAlignment(Align.center);

    addActor(background);
    addActor(label);

    setSize(Utils.cell(10), Utils.cell(1));
}

From source file:com.jmolina.orb.widgets.ui.Title.java

License:Open Source License

/**
 * Constructor/* www. ja  v a2 s .  c om*/
 *
 * @param am AssetManager
 * @param name Texto del titulo
 */
public Title(AssetManager am, String name) {
    super(am);

    Label.LabelStyle style = new Label.LabelStyle();
    style.fontColor = new Color(Var.COLOR_GREEN_DARK);
    style.font = new BitmapFont(Gdx.files.internal(Font.FONT_ROBOTO_BLACK_90),
            findRegion(Atlas.FONT_ROBOTO_BLACK_90));

    label = new Label(name, style);
    label.setTouchable(Touchable.disabled);
    label.setPosition(Utils.cell(3), 0f);
    label.setHeight(Utils.cell(2));
    label.setWidth(Utils.cell(7));
    label.setAlignment(Align.left);

    button = new com.jmolina.orb.widgets.ui.Back(getAssetManager());
    button.setPosition(0f, 0f);

    addActor(button);
    addActor(label);
}

From source file:com.kevlanche.threedeetest.ScalableObjLoader.java

License:Apache License

/** loads .mtl file */
public void load(FileHandle file) {
    String line;//from  w w w.  j  a  v a2s  .  c  o m
    String[] tokens;
    String curMatName = "default";
    Color difcolor = Color.WHITE;
    Color speccolor = Color.WHITE;
    float opacity = 1.f;
    float shininess = 0.f;
    String texFilename = null;

    if (file == null || file.exists() == false)
        return;

    BufferedReader reader = new BufferedReader(new InputStreamReader(file.read()), 4096);
    try {
        while ((line = reader.readLine()) != null) {

            if (line.length() > 0 && line.charAt(0) == '\t')
                line = line.substring(1).trim();

            tokens = line.split("\\s+");

            if (tokens[0].length() == 0) {
                continue;
            } else if (tokens[0].charAt(0) == '#')
                continue;
            else {
                final String key = tokens[0].toLowerCase();
                if (key.equals("newmtl")) {
                    ModelMaterial mat = new ModelMaterial();
                    mat.id = curMatName;
                    mat.diffuse = new Color(difcolor);
                    mat.specular = new Color(speccolor);
                    mat.opacity = opacity;
                    mat.shininess = shininess;
                    if (texFilename != null) {
                        ModelTexture tex = new ModelTexture();
                        tex.usage = ModelTexture.USAGE_DIFFUSE;
                        tex.fileName = new String(texFilename);
                        if (mat.textures == null)
                            mat.textures = new Array<ModelTexture>(1);
                        mat.textures.add(tex);
                    }
                    materials.add(mat);

                    if (tokens.length > 1) {
                        curMatName = tokens[1];
                        curMatName = curMatName.replace('.', '_');
                    } else
                        curMatName = "default";

                    difcolor = Color.WHITE;
                    speccolor = Color.WHITE;
                    opacity = 1.f;
                    shininess = 0.f;
                } else if (key.equals("kd") || key.equals("ks")) // diffuse or specular
                {
                    float r = Float.parseFloat(tokens[1]);
                    float g = Float.parseFloat(tokens[2]);
                    float b = Float.parseFloat(tokens[3]);
                    float a = 1;
                    if (tokens.length > 4)
                        a = Float.parseFloat(tokens[4]);

                    if (tokens[0].toLowerCase().equals("kd")) {
                        difcolor = new Color();
                        difcolor.set(r, g, b, a);
                    } else {
                        speccolor = new Color();
                        speccolor.set(r, g, b, a);
                    }
                } else if (key.equals("tr") || key.equals("d")) {
                    opacity = Float.parseFloat(tokens[1]);
                } else if (key.equals("ns")) {
                    shininess = Float.parseFloat(tokens[1]);
                } else if (key.equals("map_kd")) {
                    texFilename = file.parent().child(tokens[1]).path();
                }
            }
        }
        reader.close();
    } catch (IOException e) {
        return;
    }

    // last material
    ModelMaterial mat = new ModelMaterial();
    mat.id = curMatName;
    mat.diffuse = new Color(difcolor);
    mat.specular = new Color(speccolor);
    mat.opacity = opacity;
    mat.shininess = shininess;
    if (texFilename != null) {
        ModelTexture tex = new ModelTexture();
        tex.usage = ModelTexture.USAGE_DIFFUSE;
        tex.fileName = new String(texFilename);
        if (mat.textures == null)
            mat.textures = new Array<ModelTexture>(1);
        mat.textures.add(tex);
    }
    materials.add(mat);

    return;
}

From source file:com.kevlanche.threedeetest.ScalableObjLoader.java

License:Apache License

public ModelMaterial getMaterial(final String name) {
    for (final ModelMaterial m : materials)
        if (m.id.equals(name))
            return m;
    ModelMaterial mat = new ModelMaterial();
    mat.id = name;//from w  ww. j a  va 2  s .  co  m
    mat.diffuse = new Color(Color.WHITE);
    materials.add(mat);
    return mat;
}

From source file:com.kotcrab.vis.editor.serializer.ColorSerializer.java

License:Apache License

@Override
public Color copy(Kryo kryo, Color original) {
    return new Color(original);
}

From source file:com.kotcrab.vis.ui.widget.color.BasicColorPicker.java

License:Apache License

protected BasicColorPicker(ColorPickerWidgetStyle style, ColorPickerListener listener,
        boolean loadExtendedShaders) {
    this.listener = listener;
    this.style = style;
    this.sizes = VisUI.getSizes();

    oldColor = new Color(Color.BLACK);
    color = new Color(Color.BLACK);

    commons = new PickerCommons(style, sizes, loadExtendedShaders);

    createColorWidgets();/*from w w w.  ja  va2  s  .  c  o  m*/
    createUI();

    updateValuesFromCurrentColor();
    updateUI();
}

From source file:com.kotcrab.vis.ui.widget.color.BasicColorPicker.java

License:Apache License

public void restoreLastColor() {
    Color colorBeforeReset = new Color(color);
    setColor(oldColor);/*from www .java  2 s.c om*/
    if (listener != null)
        listener.reset(colorBeforeReset, color);
}

From source file:com.kotcrab.vis.ui.widget.color.BasicColorPicker.java

License:Apache License

protected void setColor(Color newColor, boolean updateCurrentColor) {
    if (updateCurrentColor) {
        currentColorImg.setColor(new Color(newColor));
        oldColor = new Color(newColor);
    }/*from   www .j a v  a2  s  .c om*/
    color = new Color(newColor);
    updateValuesFromCurrentColor();
    updateUI();
}

From source file:com.kotcrab.vis.ui.widget.color.BasicColorPicker.java

License:Apache License

/**
 * @param allowAlphaEdit if false this picker will have disabled editing color alpha channel. If current picker color
 * has alpha it will be reset to 1. If true alpha editing will be re-enabled. For better UX this should not be called
 * while ColorPicker is visible.//from  www  . j  a va  2s  .co m
 */
public void setAllowAlphaEdit(boolean allowAlphaEdit) {
    this.allowAlphaEdit = allowAlphaEdit;

    hexField.setMaxLength(allowAlphaEdit ? HEX_COLOR_LENGTH_WITH_ALPHA : HEX_COLOR_LENGTH);
    if (allowAlphaEdit == false) {
        setColor(new Color(color));
    }
}