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

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

Introduction

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

Prototype

Color GREEN

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

Click Source Link

Usage

From source file:com.cometmebro.game.PlanetMenu.java

@Override
public void show() {
    skin.addRegions(atlas2);/*from ww  w .  j  av  a 2s.  co m*/

    blank = "   ";
    one = "o  ";
    two = "oo ";
    three = "ooo";

    currentDangerCount = 1;
    currentDurationCount = 1;
    currentResourcesCount = 1;

    currentDanger = blank;
    currentDuration = blank;
    currentResources = blank;

    sandPlanet = "Sand Planet";
    springPlanet = "Spring Planet";
    simplePlanet = "Grass Planet";
    holidayPlanet = "Winter Wonderland";
    waterPlanet = "Ocean Planet";
    icePlanet = "Ice Planet";
    lavaPlanet = "Lava Planet";
    candyPlanet = "Candy Planet";
    cityPlanet = "Suburban Planet";

    backButtonTex = new Texture(Gdx.files.internal("backbutton.png"));
    Button backButton = new Button(new SpriteDrawable(new Sprite(backButtonTex)));

    backButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            stage.addAction(
                    Actions.sequence(Actions.fadeOut(.25f), Actions.delay(.25f), Actions.run(new Runnable() {
                        @Override
                        public void run() {
                            MainMenu menu = new MainMenu(cmb);
                            cmb.setScreen(menu);
                        }
                    })));
        }
    });

    settings = new Texture(Gdx.files.internal("settingsbutton.png"));
    Button settingsButton = new Button(new SpriteDrawable(new Sprite(settings)));

    planetHudTex = new Texture(Gdx.files.internal("planethud.png"));
    SpriteDrawable planethud = new SpriteDrawable(new Sprite(planetHudTex));

    settingsButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            stage.addAction(
                    Actions.sequence(Actions.fadeOut(.25f), Actions.delay(.25f), Actions.run(new Runnable() {
                        @Override
                        public void run() {
                            SettingsMenu menu = new SettingsMenu(cmb);
                            cmb.setScreen(menu);
                        }
                    })));
        }
    });

    buttonUp = new Texture(Gdx.files.internal("roundplaybuttonalt.png"));
    buttonDown = new Texture(Gdx.files.internal("roundplaybuttonaltdown.png"));

    Button.ButtonStyle buttonStyle2 = new Button.ButtonStyle();
    buttonStyle2.up = new SpriteDrawable(new Sprite(buttonUp)).tint(Color.GREEN);
    buttonStyle2.down = new SpriteDrawable(new Sprite(buttonDown)).tint(Color.GREEN);
    play_button = new Button(buttonStyle2);

    play_button.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            PLAY_CLICKED++;
            if (!prefs.getString("type", "").equals("")) {
                stage.addAction(Actions.sequence(Actions.fadeOut(.25f), Actions.delay(.25f),
                        Actions.run(new Runnable() {
                            @Override
                            public void run() {
                                CometMeBro menu = new CometMeBro(cmb, currentDurationCount * 20,
                                        3 / currentDangerCount, currentResourcesCount * 10,
                                        prefs.getString("type", "sand"));
                                cmb.setScreen(menu);
                            }
                        })));
            }
        }
    });

    Button.ButtonStyle style1 = new Button.ButtonStyle();
    style1.up = skin.getDrawable("desert");
    style1.down = skin.getDrawable("desert");
    sand = new Button(style1);

    Button.ButtonStyle style2 = new Button.ButtonStyle();
    style2.up = skin.getDrawable("city");
    style2.down = skin.getDrawable("city");
    city = new Button(style2);

    Button.ButtonStyle style3 = new Button.ButtonStyle();
    style3.up = skin.getDrawable("ice");
    style3.down = skin.getDrawable("ice");
    ice = new Button(style3);

    Button.ButtonStyle style4 = new Button.ButtonStyle();
    style4.up = skin.getDrawable("grassland");
    style4.down = skin.getDrawable("grassland");
    grass = new Button(style4);

    Button.ButtonStyle style5 = new Button.ButtonStyle();
    style5.up = skin.getDrawable("ocean");
    style5.down = skin.getDrawable("ocean");
    ocean = new Button(style5);

    Button.ButtonStyle style6 = new Button.ButtonStyle();
    style6.up = skin.getDrawable("lava");
    style6.down = skin.getDrawable("lava");
    lava = new Button(style6);

    Button.ButtonStyle style7 = new Button.ButtonStyle();
    style7.up = skin.getDrawable("candy");
    style7.down = skin.getDrawable("candy");
    candy = new Button(style7);

    Button.ButtonStyle style8 = new Button.ButtonStyle();
    style8.up = skin.getDrawable("easter");
    style8.down = skin.getDrawable("easter");
    spring = new Button(style8);

    Button.ButtonStyle style9 = new Button.ButtonStyle();
    style9.up = skin.getDrawable("winter");
    style9.down = skin.getDrawable("winter");
    winter = new Button(style9);

    sand.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            prefs.putString("type", "sand");
            prefs.putString("title", sandPlanet);
            prefs.flush();
            currentDanger = one;
            currentDuration = two;
            currentResources = one;

            currentDangerCount = 1;
            currentDurationCount = 2;
            currentResourcesCount = 1;

        }
    });

    ice.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            prefs.putString("type", "ice");
            prefs.putString("title", icePlanet);
            prefs.flush();
            currentDanger = two;
            currentDuration = two;
            currentResources = two;

            currentDangerCount = 2;
            currentDurationCount = 2;
            currentResourcesCount = 2;
        }
    });

    candy.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            prefs.putString("type", "candy");
            prefs.putString("title", candyPlanet);
            prefs.flush();

            currentDanger = one;
            currentDuration = one;
            currentResources = one;

            currentDangerCount = 1;
            currentDurationCount = 1;
            currentResourcesCount = 1;
        }
    });

    spring.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            prefs.putString("type", "spring");
            prefs.putString("title", springPlanet);
            prefs.flush();
            currentDanger = one;
            currentDuration = two;
            currentResources = two;

            currentDangerCount = 1;
            currentDurationCount = 2;
            currentResourcesCount = 2;
        }
    });

    winter.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            prefs.putString("type", "christmas");
            prefs.putString("title", holidayPlanet);
            prefs.flush();
            currentDanger = two;
            currentDuration = one;
            currentResources = three;

            currentDangerCount = 2;
            currentDurationCount = 1;
            currentResourcesCount = 3;
        }
    });

    lava.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            prefs.putString("type", "lava");
            prefs.putString("title", lavaPlanet);
            prefs.flush();
            currentDanger = three;
            currentDuration = two;
            currentResources = three;

            currentDangerCount = 3;
            currentDurationCount = 2;
            currentResourcesCount = 3;
        }
    });

    ocean.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            prefs.putString("type", "water");
            prefs.putString("title", waterPlanet);
            prefs.flush();
            currentDanger = two;
            currentDuration = three;
            currentResources = two;

            currentDangerCount = 2;
            currentDurationCount = 3;
            currentResourcesCount = 2;
        }
    });

    grass.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            prefs.putString("type", "simple");
            prefs.putString("title", simplePlanet);
            prefs.flush();
            currentDanger = one;
            currentDuration = two;
            currentResources = one;

            currentDangerCount = 1;
            currentDurationCount = 2;
            currentResourcesCount = 1;
        }
    });

    city.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            prefs.putString("type", "city");
            prefs.putString("title", cityPlanet);
            prefs.flush();
            currentDanger = three;
            currentDuration = three;
            currentResources = two;

            currentDangerCount = 3;
            currentDurationCount = 3;
            currentResourcesCount = 2;
        }
    });

    Random rand = new Random();
    int planetRandom = rand.nextInt(8);
    switch (planetRandom) {
    case 0:
        planet1 = sand;
        planet2 = ice;
        planet3 = candy;
        break;
    case 1:
        planet1 = ocean;
        planet2 = ice;
        planet3 = spring;
        break;
    case 2:
        planet1 = lava;
        planet2 = city;
        planet3 = sand;
        break;
    case 3:
        planet1 = grass;
        planet2 = ocean;
        planet3 = spring;
        break;
    case 4:
        planet1 = ice;
        planet2 = lava;
        planet3 = candy;
        break;
    case 5:
        planet1 = sand;
        planet2 = spring;
        planet3 = ocean;
        break;
    case 6:
        planet1 = ice;
        planet2 = grass;
        planet3 = spring;
        break;
    case 7:
        planet1 = candy;
        planet2 = spring;
        planet3 = sand;
        break;

    }

    if (STYLE == 3) {
        table1.setTransform(true);
        table1.add(planet1).width(Value.percentHeight(.25f, table)).height(Value.percentHeight(.25f, table))
                .center().pad(10);
        table1.setX((stage.getWidth() / 4) * 3 - table1.getHeight() / 2);
        table1.setY(stage.getHeight() / 2 - table1.getHeight() / 2);
        table.addActor(table1);

        table2 = new Table();
        table2.setTransform(true);
        table2.add(planet2).width(Value.percentHeight(.15f, table)).height(Value.percentHeight(.15f, table))
                .center().pad(10);
        table2.setX((stage.getWidth() / 4) * 2 - table2.getWidth() / 2);
        table2.setY(stage.getHeight() / 2 - table2.getHeight() / 2);
        table.addActor(table2);

        table3 = new Table();
        table3.setTransform(true);
        table3.add(planet3).width(Value.percentHeight(.2f, table)).height(Value.percentHeight(.2f, table))
                .center().pad(10);
        table3.setX(stage.getWidth() / 4 - table3.getWidth() / 2);
        table3.setY(stage.getHeight() / 2 - table3.getHeight() / 2);
        table.addActor(table3);

    }

    space = new Texture("space16x9fourth.png");
    SpriteDrawable spaceDrawable = new SpriteDrawable(new Sprite(space));

    table.setBackground(spaceDrawable);
    table.setFillParent(true);

    Label resourceslbl = new Label("Resources: ", skin.get("label", Label.LabelStyle.class));
    resourcesDots = new Label(three, skin.get("label", Label.LabelStyle.class));
    Label dangerlbl = new Label("Danger: ", skin.get("label", Label.LabelStyle.class));
    dangerDots = new Label(two, skin.get("label", Label.LabelStyle.class));
    Label durationlbl = new Label("Duration: ", skin.get("label", Label.LabelStyle.class));
    durationDots = new Label(three, skin.get("label", Label.LabelStyle.class));

    pickPlanetLbl = new Label("", skin.get("label", Label.LabelStyle.class));

    crystalCountlbl = new Label(String.valueOf(prefs.getInteger("crystalCount", 0)),
            skin.get("labelblue", Label.LabelStyle.class));

    resourceslbl.setFontScale(.5f);
    dangerlbl.setFontScale(.5f);
    durationlbl.setFontScale(.5f);

    resourcesDots.setFontScale(.5f);
    dangerDots.setFontScale(.5f);
    durationDots.setFontScale(.5f);

    subtable.setBackground(planethud);
    crystaltable.setBackground(skin.getDrawable("bluecrystalhud"));

    subtable.row().colspan(2);
    subtable.add(dangerlbl).left().colspan(1).padBottom(-15).align(Align.right); //.padRight(Value.percentWidth(3.75f))
    subtable.add(dangerDots).left().colspan(1).padBottom(-15).align(Align.left)
            .padRight(subtable.getWidth() / 2);
    subtable.row();
    subtable.add(durationlbl).left().colspan(1).align(Align.right); //.padRight(Value.percentWidth(2.91f));
    subtable.add(durationDots).left().colspan(1).align(Align.left).padRight(subtable.getWidth() / 2);
    subtable.add(play_button).right().width(Value.percentHeight(.1f, table))
            .height(Value.percentHeight(.1f, table));
    subtable.row();
    subtable.add(resourceslbl).left().colspan(1).padTop(-15).align(Align.right); //.padRight(Value.percentWidth(2.6f));
    subtable.add(resourcesDots).left().colspan(1).padTop(-15).align(Align.left)
            .padRight(subtable.getWidth() / 2);

    subtable.setX(0);
    subtable.setY(0);
    subtable.setWidth(CMB.WIDTH);
    subtable.setHeight(CMB.HEIGHT / 4.5f);

    prefs.putString("type", "");
    prefs.putString("title", "");
    prefs.flush();

    planetName = prefs.getString("title", "");
    planet_name = new Label(planetName, skin.get("label", Label.LabelStyle.class));

    table.row();
    table.add(backButton).left().top().width(Value.percentWidth(1f)).height(Value.percentHeight(1f))
            .padBottom(20).padTop(70).padRight(1050);
    table.add(settingsButton).right().top().width(Value.percentWidth(1f)).height(Value.percentHeight(1f))
            .padTop(70);
    table.row();
    table.add(pickPlanetLbl).center().top().padBottom(240);
    table.row();
    table.add(crystaltable).left().bottom().width(Value.percentHeight(.24f, table))
            .height(Value.percentHeight(.187f, table)).padBottom(200).padLeft(-20);
    table.add(planet_name).center().bottom().padLeft(Value.percentWidth(-.9f, table)).padBottom(200);
    table.row();
    table.addActor(subtable);

    crystalCountlbl.setFontScale(.4f);
    crystaltable.row().colspan(1);
    crystaltable.add(crystalCountlbl).colspan(1).bottom().center().align(Align.center).padTop(70).padRight(10);

    stage.addActor(table);

    stage.addAction(Actions.sequence(Actions.fadeIn(1f)));

    Gdx.input.setInputProcessor(stage);
}

From source file:com.company.minery.utils.spine.SkeletonRendererDebug.java

License:Open Source License

public void draw(Skeleton skeleton) {
    float skeletonX = skeleton.getX();
    float skeletonY = skeleton.getY();

    Gdx.gl.glEnable(GL20.GL_BLEND);//from   w  ww  .java2 s .c o  m
    int srcFunc = premultipliedAlpha ? GL20.GL_ONE : GL20.GL_SRC_ALPHA;
    Gdx.gl.glBlendFunc(srcFunc, GL20.GL_ONE_MINUS_SRC_ALPHA);

    ShapeRenderer shapes = this.shapes;

    Array<Bone> bones = skeleton.getBones();
    if (drawBones) {
        shapes.setColor(boneLineColor);
        shapes.begin(ShapeType.Filled);
        for (int i = 0, n = bones.size; i < n; i++) {
            Bone bone = bones.get(i);
            if (bone.parent == null)
                continue;
            float x = skeletonX + bone.data.length * bone.m00 + bone.worldX;
            float y = skeletonY + bone.data.length * bone.m10 + bone.worldY;
            shapes.rectLine(skeletonX + bone.worldX, skeletonY + bone.worldY, x, y, boneWidth * scale);
        }
        shapes.end();
        shapes.begin(ShapeType.Line);
        shapes.x(skeletonX, skeletonY, 4 * scale);
    } else
        shapes.begin(ShapeType.Line);

    if (drawRegionAttachments) {
        shapes.setColor(attachmentLineColor);
        Array<Slot> slots = skeleton.getSlots();
        for (int i = 0, n = slots.size; i < n; i++) {
            Slot slot = slots.get(i);
            Attachment attachment = slot.attachment;
            if (attachment instanceof RegionAttachment) {
                RegionAttachment regionAttachment = (RegionAttachment) attachment;
                regionAttachment.updateWorldVertices(slot, false);
                float[] vertices = regionAttachment.getWorldVertices();
                shapes.line(vertices[X1], vertices[Y1], vertices[X2], vertices[Y2]);
                shapes.line(vertices[X2], vertices[Y2], vertices[X3], vertices[Y3]);
                shapes.line(vertices[X3], vertices[Y3], vertices[X4], vertices[Y4]);
                shapes.line(vertices[X4], vertices[Y4], vertices[X1], vertices[Y1]);
            }
        }
    }

    if (drawMeshHull || drawMeshTriangles) {
        Array<Slot> slots = skeleton.getSlots();
        for (int i = 0, n = slots.size; i < n; i++) {
            Slot slot = slots.get(i);
            Attachment attachment = slot.attachment;
            float[] vertices = null;
            short[] triangles = null;
            int hullLength = 0;
            if (attachment instanceof MeshAttachment) {
                MeshAttachment mesh = (MeshAttachment) attachment;
                mesh.updateWorldVertices(slot, false);
                vertices = mesh.getWorldVertices();
                triangles = mesh.getTriangles();
                hullLength = mesh.getHullLength();
            } else if (attachment instanceof SkinnedMeshAttachment) {
                SkinnedMeshAttachment mesh = (SkinnedMeshAttachment) attachment;
                mesh.updateWorldVertices(slot, false);
                vertices = mesh.getWorldVertices();
                triangles = mesh.getTriangles();
                hullLength = mesh.getHullLength();
            }
            if (vertices == null || triangles == null)
                continue;
            if (drawMeshTriangles) {
                shapes.setColor(triangleLineColor);
                for (int ii = 0, nn = triangles.length; ii < nn; ii += 3) {
                    int v1 = triangles[ii] * 5, v2 = triangles[ii + 1] * 5, v3 = triangles[ii + 2] * 5;
                    shapes.triangle(vertices[v1], vertices[v1 + 1], //
                            vertices[v2], vertices[v2 + 1], //
                            vertices[v3], vertices[v3 + 1] //
                    );
                }
            }
            if (drawMeshHull && hullLength > 0) {
                shapes.setColor(attachmentLineColor);
                hullLength = hullLength / 2 * 5;
                float lastX = vertices[hullLength - 5], lastY = vertices[hullLength - 4];
                for (int ii = 0, nn = hullLength; ii < nn; ii += 5) {
                    float x = vertices[ii], y = vertices[ii + 1];
                    shapes.line(x, y, lastX, lastY);
                    lastX = x;
                    lastY = y;
                }
            }
        }
    }

    if (drawBoundingBoxes) {
        SkeletonBounds bounds = this.bounds;
        bounds.update(skeleton, true);
        shapes.setColor(aabbColor);
        shapes.rect(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());
        shapes.setColor(boundingBoxColor);
        Array<FloatArray> polygons = bounds.getPolygons();
        for (int i = 0, n = polygons.size; i < n; i++) {
            FloatArray polygon = polygons.get(i);
            shapes.polygon(polygon.items, 0, polygon.size);
        }
    }

    shapes.end();
    shapes.begin(ShapeType.Filled);

    if (drawBones) {
        shapes.setColor(boneOriginColor);
        for (int i = 0, n = bones.size; i < n; i++) {
            Bone bone = bones.get(i);
            shapes.setColor(Color.GREEN);
            shapes.circle(skeletonX + bone.worldX, skeletonY + bone.worldY, 3 * scale, 8);
        }
    }

    shapes.end();
}

From source file:com.dgzt.core.Map.java

License:Open Source License

/**
 * The constructor.//from w w  w .  j av a2 s  .  c  om
 * 
 * @param shader - The shader.
 * @param box2DWorld - The world of the Box2D.
 * @param box2DX - The x coordinate value in Box2D.
 * @param box2DY - The y coordinate value in Box2D.
 */
public Map(final ShaderProgram shader, final World box2DWorld, final float box2DX, final float box2DY) {
    super(shader, Color.GREEN);
    this.box2DX = box2DX;
    this.box2DY = box2DY;

    this.mapBorder = new RectangleBorderShape(shader, Color.WHITE);

    this.leftSector16 = new RectangleBorderShape(shader, Color.WHITE);
    this.rightSector16 = new RectangleBorderShape(shader, Color.WHITE);

    this.leftSector5 = new RectangleBorderShape(shader, Color.WHITE);
    this.rightSector5 = new RectangleBorderShape(shader, Color.WHITE);

    this.centerBigCircle = new CircleBorderShape(shader, Color.WHITE);

    this.centerLine = new LineShape(shader, Color.WHITE);

    this.centerSmallCircle = new FilledCircleShape(shader, Color.WHITE);

    this.leftSmallCircle = new FilledCircleShape(shader, Color.WHITE);

    this.rightSmallCircle = new FilledCircleShape(shader, Color.WHITE);

    this.topLeftSmallArc = new ArcShape(shader, 0, 90, Color.WHITE);

    this.topRightSmallArc = new ArcShape(shader, 270, 90, Color.WHITE);

    this.bottomRightSmallArc = new ArcShape(shader, 180, 90, Color.WHITE);

    this.bottomLeftSmallArc = new ArcShape(shader, 90, 90, Color.WHITE);

    this.leftBigArc = new ArcShape(shader, 37, 109, Color.WHITE);

    this.rightBigArc = new ArcShape(shader, 217, 109, Color.WHITE);

    addSensor(box2DWorld);
}

From source file:com.eightpuzzle.game.EightPuzzle.java

License:Apache License

@Override
public void create() {
    gameFont = new BitmapFont();
    solvedFont = new BitmapFont();
    batch = new SpriteBatch();
    aspectRatio = (float) Gdx.graphics.getHeight() / (float) Gdx.graphics.getWidth();
    OrthographicCamera camera = new OrthographicCamera(GAME_WIDTH * aspectRatio, GAME_HEIGHT * aspectRatio);
    //camera.position.set(GAME_WIDTH/2, GAME_HEIGHT/2, 0)
    camera.setToOrtho(false, GAME_WIDTH * aspectRatio, GAME_HEIGHT * aspectRatio);
    //camera.setToOrtho(false,GAME_WIDTH,GAME_HEIGHT);
    stage = new Stage(new ExtendViewport(GAME_WIDTH * aspectRatio, GAME_HEIGHT * aspectRatio, camera));//Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), camera));
    Gdx.input.setInputProcessor(stage);/*w w  w  . j  av  a  2s .  c  o m*/

    // A skin can be loaded via JSON or defined programmatically, either is fine. Using a skin is optional but strongly
    // recommended solely for the convenience of getting a texture, region, etc as a drawable, tinted drawable, etc.
    skin = new Skin();

    // Generate a 1x1 white texture and store it in the skin named "white".
    Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    skin.add("white", new Texture(pixmap));

    // Store the default libgdx font under the name "default".
    skin.add("default", new BitmapFont());

    // Configure a TextButtonStyle and name it "default". Skin resources are stored by type, so this doesn't overwrite the font.
    TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
    //textButtonStyle.checked = skin.newDrawable("white", Color.BLUE);
    textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);
    textButtonStyle.font = skin.getFont("default");
    skin.add("default", textButtonStyle);

    Label.LabelStyle labelSty = new Label.LabelStyle();
    labelSty.font = skin.getFont("default");
    //labelSty.fontColor = Color.GREEN;
    skin.add("default", labelSty);

    WindowStyle ws = new Window.WindowStyle();
    ws.titleFont = new BitmapFont();
    ws.background = skin.newDrawable("white", Color.BLACK);
    skin.add("default", ws);

    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Zig.ttf"));

    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 25;
    gameFont = generator.generateFont(parameter);

    FreeTypeFontParameter parameter2 = new FreeTypeFontParameter();
    parameter2.size = 100;
    parameter2.color = Color.GREEN;
    solvedFont = generator.generateFont(parameter2);
    generator.dispose();

    FileHandle blue, n1, n2, n3, n4, n5, n6, n7, n8, solveUp, solveDown;
    if (Gdx.app.getType() == ApplicationType.Desktop) {
        blue = Gdx.files.internal("icons64px/blue-square.png");
        n1 = Gdx.files.internal("icons64px/Number-1-icon.png");
        n2 = Gdx.files.internal("icons64px/Number-2-icon.png");
        n3 = Gdx.files.internal("icons64px/Number-3-icon.png");
        n4 = Gdx.files.internal("icons64px/Number-4-icon.png");
        n5 = Gdx.files.internal("icons64px/Number-5-icon.png");
        n6 = Gdx.files.internal("icons64px/Number-6-icon.png");
        n7 = Gdx.files.internal("icons64px/Number-7-icon.png");
        n8 = Gdx.files.internal("icons64px/Number-8-icon.png");
        solveUp = blue;
        solveDown = blue;
    } else {
        blue = Gdx.files.internal("icons256px/blue-circle.png");
        n1 = Gdx.files.internal("icons256px/Number-1-icon.png");
        n2 = Gdx.files.internal("icons256px/Number-2-icon.png");
        n3 = Gdx.files.internal("icons256px/Number-3-icon.png");
        n4 = Gdx.files.internal("icons256px/Number-4-icon.png");
        n5 = Gdx.files.internal("icons256px/Number-5-icon.png");
        n6 = Gdx.files.internal("icons256px/Number-6-icon.png");
        n7 = Gdx.files.internal("icons256px/Number-7-icon.png");
        n8 = Gdx.files.internal("icons256px/Number-8-icon.png");
        solveUp = Gdx.files.internal("icons256px/Box_Green.png");
        solveDown = Gdx.files.internal("icons256px/rectangle_green.png");
    }
    Texture bSquare = new Texture(blue);
    Texture n1T = new Texture(n1);
    Texture n2T = new Texture(n2);
    Texture n3T = new Texture(n3);
    Texture n4T = new Texture(n4);
    Texture n5T = new Texture(n5);
    Texture n6T = new Texture(n6);
    Texture n7T = new Texture(n7);
    Texture n8T = new Texture(n8);

    TextureRegion bSquareReg = new TextureRegion(bSquare);
    TextureRegion n1Reg = new TextureRegion(n1T);
    TextureRegion n2Reg = new TextureRegion(n2T);
    TextureRegion n3Reg = new TextureRegion(n3T);
    TextureRegion n4Reg = new TextureRegion(n4T);
    TextureRegion n5Reg = new TextureRegion(n5T);
    TextureRegion n6Reg = new TextureRegion(n6T);
    TextureRegion n7Reg = new TextureRegion(n7T);
    TextureRegion n8Reg = new TextureRegion(n8T);

    TextureRegionDrawable solveDUp = new TextureRegionDrawable(new TextureRegion(new Texture(solveUp)));
    TextureRegionDrawable solveDDown = new TextureRegionDrawable(new TextureRegion(new Texture(solveDown)));
    ImageTextButton.ImageTextButtonStyle tbSty = new ImageTextButton.ImageTextButtonStyle(solveDUp, solveDDown,
            solveDUp, gameFont);
    skin.add("default", tbSty);

    ImageButtonStyle bSquareSty = new ImageButtonStyle();
    bSquareSty.imageUp = new TextureRegionDrawable(bSquareReg);
    bSquareSty.imageDown = new TextureRegionDrawable(bSquareReg);

    ImageButtonStyle n1Sty = new ImageButtonStyle();
    n1Sty.imageUp = new TextureRegionDrawable(n1Reg);
    n1Sty.imageDown = new TextureRegionDrawable(n1Reg);

    ImageButtonStyle n2Sty = new ImageButtonStyle();
    n2Sty.imageUp = new TextureRegionDrawable(n2Reg);
    n2Sty.imageDown = new TextureRegionDrawable(n2Reg);

    ImageButtonStyle n3Sty = new ImageButtonStyle();
    n3Sty.imageUp = new TextureRegionDrawable(n3Reg);
    n3Sty.imageDown = new TextureRegionDrawable(n3Reg);

    ImageButtonStyle n4Sty = new ImageButtonStyle();
    n4Sty.imageUp = new TextureRegionDrawable(n4Reg);
    n4Sty.imageDown = new TextureRegionDrawable(n4Reg);

    ImageButtonStyle n5Sty = new ImageButtonStyle();
    n5Sty.imageUp = new TextureRegionDrawable(n5Reg);
    n5Sty.imageDown = new TextureRegionDrawable(n5Reg);

    ImageButtonStyle n6Sty = new ImageButtonStyle();
    n6Sty.imageUp = new TextureRegionDrawable(n6Reg);
    n6Sty.imageDown = new TextureRegionDrawable(n6Reg);

    ImageButtonStyle n7Sty = new ImageButtonStyle();
    n7Sty.imageUp = new TextureRegionDrawable(n7Reg);
    n7Sty.imageDown = new TextureRegionDrawable(n7Reg);

    ImageButtonStyle n8Sty = new ImageButtonStyle();
    n8Sty.imageUp = new TextureRegionDrawable(n8Reg);
    n8Sty.imageDown = new TextureRegionDrawable(n8Reg);

    ImageButton b1 = new ImageButton(n1Sty);
    b1.addListener(new MyChangeListener(1));
    map.put(1, b1);

    ImageButton holeB = new ImageButton(bSquareSty);
    map.put(0, holeB);

    ImageButton ib = new ImageButton(n2Sty);
    ib.addListener(new MyChangeListener(2));
    map.put(2, ib);

    ImageButton b4 = new ImageButton(n3Sty);
    b4.addListener(new MyChangeListener(3));
    ImageButton b5 = new ImageButton(n4Sty);
    b5.addListener(new MyChangeListener(4));
    ImageButton b6 = new ImageButton(n5Sty);
    b6.addListener(new MyChangeListener(5));
    map.put(3, b4);
    map.put(4, b5);
    map.put(5, b6);

    ImageButton b7 = new ImageButton(n6Sty);
    b7.addListener(new MyChangeListener(6));
    ImageButton b8 = new ImageButton(n7Sty);
    b8.addListener(new MyChangeListener(7));
    ImageButton b9 = new ImageButton(n8Sty);
    b9.addListener(new MyChangeListener(8));
    map.put(6, b7);
    map.put(7, b8);
    map.put(8, b9);

    newGameB = new ImageTextButton("New Game", skin);
    newGameB.addListener(new NewGameListener());

    solveB = new ImageTextButton("Solve", skin);
    solveB.addListener(new MySolveListener());

    newGameBoard();

    //table.padTop(50);
    //table.padBottom(20);

    VerticalGroup vg = new VerticalGroup();
    //vg.padTop(50);
    vg.setFillParent(true);
    vg.addActor(newGameB);
    vg.addActor(table);
    vg.addActor(solveB);

    stage.addActor(vg);
}

From source file:com.evoluzion.Organismo.java

License:Open Source License

public void verMarcado(ShapeRenderer sr, SpriteBatch sb, BitmapFont f) {
    if (marcado == -1) {
        sr.begin(ShapeType.Rectangle);

        sr.setColor(Color.GREEN);
        sr.rect(borde.x - 2, borde.y - 2, borde.width + 4, borde.height + 4);
        sr.end();//from  w  w  w . j  av  a2 s .  c o m

        sb.begin();
        f.setColor(Color.GREEN);
        f.draw(sb, nombre, posicion.x + ancho + 5, posicion.y + (alto) + 5);
        f.draw(sb, "" + format.format(energia), posicion.x + ancho + 5, posicion.y);
        sb.end();

    }
}

From source file:com.gdx.EndlessGame.UIElements.SignAnimation.java

public SignAnimation(boolean Visited, int Score, String numeroInter) {

    _draw = true;// w  ww .  j  a  v  a 2 s. c om
    if (Visited)
        _FontColor = Color.GREEN;
    else
        _FontColor = Color.YELLOW;
    Texture tempText = Main.MANAGER.get("sign.png", Texture.class);
    _display = "Score: " + Score + " Inter " + numeroInter;
    _font = new BitmapFont();
    _font.setColor(_FontColor);
    _font.setScale(0.6f);
    _region = new TextureRegion(tempText, 0, 0, tempText.getWidth(), tempText.getHeight());
    setPosition(0, 0);

}

From source file:com.github.skittishSloth.openSkies.maps.terrains.TerrainTile.java

private static Color buildLatitudeColor(final Latitude latitude) {
    final Color baseColor;
    switch (latitude) {
    case POLAR:/*ww w. java2  s .c om*/
        baseColor = Color.WHITE;
        break;
    case TEMPERATE:
        baseColor = Color.GREEN;
        break;
    case TROPICAL:
        baseColor = Color.GREEN.cpy().sub(0.5f, 0.5f, 0.5f, 0);
        break;
    default:
        throw new UnsupportedOperationException("Unknown latitude: " + latitude);
    }

    return baseColor;
}

From source file:com.github.ykrasik.jerminal.libgdx.impl.LibGdxTerminal.java

License:Apache License

private Color translateColor(TerminalColor color) {
    switch (color) {
    case BLACK:/*  ww w .j  a  va 2  s  . c o m*/
        return Color.BLACK;
    case WHITE:
        return Color.WHITE;
    case GRAY:
        return Color.DARK_GRAY;
    case RED:
        return Color.PINK;
    case ORANGE:
        return Color.ORANGE;
    case YELLOW:
        return Color.YELLOW;
    case GREEN:
        return Color.GREEN;
    case BLUE:
        return BLUE;
    case VIOLET:
        return Color.MAGENTA;
    default:
        throw new IllegalArgumentException("Invalid color: " + color);
    }
}

From source file:com.hindelid.ld.thirtyfour.HUDDisplay.java

License:Apache License

public void render(int aPoints) {
    mHUDCamera.update();/*w  w  w.jav a  2s. co m*/
    mBatch.setProjectionMatrix(mHUDCamera.combined);

    mBatch.begin();
    mFont.getData().setScale(1f);
    mFont.draw(mBatch, "high score:" + mHighScore, 330f, 40f);
    mFont.draw(mBatch, "score:" + aPoints, 330f, 20f);
    mBatch.end();

    mShapeRenderer.setProjectionMatrix(mHUDCamera.combined);
    if (mHealth > 0) {
        mShapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
        mShapeRenderer.setColor(Color.RED);
        mShapeRenderer.rect(0f, 20f, 200f, 20f);
        mShapeRenderer.setColor(Color.GREEN);
        mShapeRenderer.rect(0f, 20f, mHealth * 40f, 20f);
        mShapeRenderer.end();
    }
}

From source file:com.hindelid.ld.thirtyfour.Main.java

License:Apache License

@Override
public void render() {

    long before = TimeUtils.nanoTime();
    tick();//from   w ww . ja  v a 2s. c o m
    if (TreeBranch.sGlobal.y < 1000f) {
        Gdx.gl.glClearColor(0, 0, TreeBranch.sGlobal.y / 1000f, 1);
    } else if (TreeBranch.sGlobal.y < 2000f) {
        Gdx.gl.glClearColor((TreeBranch.sGlobal.y - 1000f) / 1000f, 0, 1, 1);
    } else {
        Gdx.gl.glClearColor((3000f - TreeBranch.sGlobal.y) / 1000f, 0, (3000f - TreeBranch.sGlobal.y) / 1000f,
                1);
    }

    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    mShapeRenderer.setProjectionMatrix(mCamera.combined);

    mShapeRenderer.begin(ShapeRenderer.ShapeType.Line);
    mShapeRenderer.setColor(Color.BROWN);
    mRoot.render(mShapeRenderer);

    mShapeRenderer.setColor(Color.GREEN);
    mRoot.renderLeefs(mShapeRenderer);

    mShapeRenderer.setColor(Color.WHITE);
    for (Fish f : mFishes) {
        f.render(mShapeRenderer);
    }
    for (Octopus o : mOctopuses) {
        o.render(mShapeRenderer);
    }

    mShapeRenderer.end();

    mHUDDisplay.render((int) mTotalPoints);

    long after = TimeUtils.nanoTime();

    //System.out.println("speed:" + mSpeed + " y:" + TreeBranch.sGlobal.y + " Time:" + (after - before) / 1000); //TODO remove

    if (TreeBranch.sGlobal.y < 15f) {
        mHUDDisplay.renderStartScreen();
    }
    if (mDead) {
        if (mHUDDisplay.renderGameOver((int) mTotalPoints)) {
            resetGame();
        }
    }

    if (Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)) {
        Gdx.app.exit();
    }
}