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

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

Introduction

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

Prototype

Color LIGHT_GRAY

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

Click Source Link

Usage

From source file:CB_UI.GL_UI.Activitys.MeasureCoordinate.java

License:Open Source License

private void repaintPreview() {
    if (inRepaint.get())
        return;//from w w  w  .ja v  a 2s . c o  m
    inRepaint.set(true);

    disposeTexture();

    CB_RectF panelRec = new CB_RectF(leftBorder, bOK.getMaxY(), innerWidth, innerWidth);

    int w = (int) panelRec.getWidth();
    int h = (int) panelRec.getHeight();

    drawingPixmap = new Pixmap(w, h, Pixmap.Format.RGBA8888);

    drawingPixmap.setColor(Color.LIGHT_GRAY);
    drawingPixmap.fillRectangle(0, 0, (int) panelRec.getWidth(), (int) panelRec.getHeight());

    int centerX = (int) panelRec.getHalfWidth();
    int centerY = (int) panelRec.getHalfHeight();

    float minPix = Math.min(panelRec.getWidth(), panelRec.getHeight());

    try {
        synchronized (mMeasureList) {

            if (mMeasureList.size() > 0) {
                // Gemittelter Punkt der GPS-Messungen
                double medianLat = MeasuredCoord.Referenz.getLatitude();
                double medianLon = MeasuredCoord.Referenz.getLongitude();

                MeasuredCoordList sortetdList = (MeasuredCoordList) mMeasureList.clone();
                sortetdList.sort();

                double peakLat = Math.max(Math.abs(sortetdList.get(0).getLatitude() - medianLat),
                        Math.abs(sortetdList.get(sortetdList.size() - 1).getLatitude() - medianLat));
                double peakLon = Math.max(Math.abs(sortetdList.get(0).getLongitude() - medianLon),
                        Math.abs(sortetdList.get(sortetdList.size() - 1).getLongitude() - medianLon));

                // Umrechnung in XY
                double medianX = Descriptor.LongitudeToTileX(projectionZoom, medianLon);
                double medianY = Descriptor.LatitudeToTileY(projectionZoom, medianLat);

                double extremeX = Descriptor.LongitudeToTileX(projectionZoom, peakLon + medianLon);
                double extremeY = Descriptor.LatitudeToTileY(projectionZoom, peakLat + medianLat);

                double peakX = Math.abs(extremeX - medianX);
                double peakY = Math.abs(extremeY - medianY);

                double maxPeak = Math.max(peakX, peakY);

                double factor = 1;
                if (maxPeak > 0)
                    factor = minPix / maxPeak;

                factor /= 2;

                int x = (int) centerX;
                int y = (int) centerY;

                // Track zeichnen

                for (int i = 1; i < mMeasureList.size(); i++) {

                    PointD lastDrawEntry = Descriptor.projectCoordinate(mMeasureList.get(i - 1).getLatitude(),
                            mMeasureList.get(i - 1).getLongitude(), projectionZoom);

                    int lastX = (int) (centerX + (lastDrawEntry.X - medianX) * factor);
                    int lastY = (int) (centerY - (lastDrawEntry.Y - medianY) * factor);

                    PointD thisDrawEntry = Descriptor.projectCoordinate(mMeasureList.get(i).getLatitude(),
                            mMeasureList.get(i).getLongitude(), projectionZoom);

                    x = (int) (centerX + (thisDrawEntry.X - medianX) * factor);
                    y = (int) (centerY - (thisDrawEntry.Y - medianY) * factor);

                    drawingPixmap.setColor(Color.RED);
                    drawingPixmap.drawLine(lastX, lastY, x, y);

                }

                drawingPixmap.setColor(Color.BLUE);
                drawingPixmap.drawCircle(x, y, 4);
            }
        }
        //
        int m2 = (int) ((4 * minPix) / metersPerTile);
        int m4 = m2 * 2;

        drawingPixmap.setColor(Color.BLACK);
        drawingPixmap.drawCircle(centerX, centerY, m2);
        drawingPixmap.drawCircle(centerX, centerY, m4);

        drawingPixmap.drawLine(centerX, 0, centerX, (int) panelRec.getHeight());
        drawingPixmap.drawLine(0, centerY, (int) panelRec.getWidth(), centerY);

        drawingTexture = new Texture(drawingPixmap);

        drawing = new Sprite(drawingTexture, (int) panelRec.getWidth(), (int) panelRec.getHeight());
        drawing.setX(leftBorder);
        drawing.setY(bOK.getMaxY() + this.getBottomHeight());

        inRepaint.set(false);
    } catch (Exception e) {
        e.printStackTrace();
    }

    redraw = false;

    GL.that.renderOnce();
}

From source file:CB_UI.GL_UI.Controls.SatBarChart.java

License:Open Source License

private void setSatStrength() {
    float minH = (Sprites.bar.getBottomHeight() / 2) + Sprites.bar.getTopHeight();

    float w = (this.getWidth() / 14);
    boolean small = Sprites.bar.getMinWidth() > w * 1.2f;
    if (small) {/*from  w  w  w .j  a  v  a2  s . c  om*/
        w = (this.getWidth() / 12);
    }

    // calc Colors
    Color red = Color.RED.cpy();
    Color grn = Color.GREEN.cpy();
    Color gry = Color.LIGHT_GRAY.cpy();

    if (drawWithAlpha) {
        red.a = 0.4f;
        grn.a = 0.4f;
        gry.a = 0.4f;
    }

    if (balken == null) {

        float iniHeight = small ? Sprites.barSmall.getTopHeight() : Sprites.bar.getTopHeight();

        w += 1;
        balken = new Image[14];
        balken[0] = new Image(new CB_RectF(0, 0, w, iniHeight), "", false);
        balken[1] = new Image(new CB_RectF(balken[0].getMaxX() - 1, 0, w, iniHeight), "", false);
        balken[2] = new Image(new CB_RectF(balken[1].getMaxX() - 1, 0, w, iniHeight), "", false);
        balken[3] = new Image(new CB_RectF(balken[2].getMaxX() - 1, 0, w, iniHeight), "", false);
        balken[4] = new Image(new CB_RectF(balken[3].getMaxX() - 1, 0, w, iniHeight), "", false);
        balken[5] = new Image(new CB_RectF(balken[4].getMaxX() - 1, 0, w, iniHeight), "", false);
        balken[6] = new Image(new CB_RectF(balken[5].getMaxX() - 1, 0, w, iniHeight), "", false);
        balken[7] = new Image(new CB_RectF(balken[6].getMaxX() - 1, 0, w, iniHeight), "", false);
        balken[8] = new Image(new CB_RectF(balken[7].getMaxX() - 1, 0, w, iniHeight), "", false);
        balken[9] = new Image(new CB_RectF(balken[8].getMaxX() - 1, 0, w, iniHeight), "", false);
        balken[10] = new Image(new CB_RectF(balken[9].getMaxX() - 1, 0, w, iniHeight), "", false);
        balken[11] = new Image(new CB_RectF(balken[10].getMaxX() - 1, 0, w, iniHeight), "", false);
        if (!small)
            balken[12] = new Image(new CB_RectF(balken[11].getMaxX() - 1, 0, w, iniHeight), "", false);
        if (!small)
            balken[13] = new Image(new CB_RectF(balken[12].getMaxX() - 1, 0, w, iniHeight), "", false);

        for (Image tmp : balken) {
            if (tmp != null) {
                tmp.setDrawable(small ? Sprites.barSmall_0 : Sprites.bar_0);
                this.addChild(tmp);
            }
        }
    }

    int count = 0;
    if (GPS.getSatList() != null) {
        for (int i = 0, n = GPS.getSatList().size(); i < n; i++) {
            GpsStrength tmp;
            try {
                tmp = GPS.getSatList().get(i);
            } catch (Exception e) {
                break;
            }

            try {
                // balken hhe festlegen
                if (balken[count] != null) {
                    float barHeight = Math.min((tmp.getStrength() * 3 / 100) * this.getHeight(),
                            this.getHeight());

                    if (barHeight < minH) {
                        barHeight = small ? Sprites.barSmall.getTopHeight() : Sprites.bar.getTopHeight();
                        balken[count].setDrawable(small ? Sprites.barSmall_0 : Sprites.bar_0);
                    } else {
                        balken[count].setDrawable(small ? Sprites.barSmall : Sprites.bar);
                    }

                    balken[count].setHeight(barHeight);

                    // // balken farbe festlegen
                    if (tmp.getFixed()) {
                        balken[count].setColor(grn);
                    } else {
                        balken[count].setColor(red);
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }

            count++;
            if (count >= 13)
                break;
        }
    }

    // restliche balken ausschalten!
    if (count < 14) {
        for (int i = count; i <= 13; i++) {
            if (balken[i] != null)
                balken[i].setColor(gry);
        }
    }

    redraw = false;
    GL.that.renderOnce();

}

From source file:CB_UI.RouteOverlay.java

License:Open Source License

private static void initialColorField() {
    ColorField[0] = Color.RED;/*from  w w  w .  j  ava 2 s . co  m*/
    ColorField[1] = Color.YELLOW;
    ColorField[2] = Color.BLACK;
    ColorField[3] = Color.LIGHT_GRAY;
    ColorField[4] = Color.GREEN;
    ColorField[5] = Color.BLUE;
    ColorField[6] = Color.CYAN;
    ColorField[7] = Color.GRAY;
    ColorField[8] = Color.MAGENTA;
    ColorField[9] = Color.ORANGE;
    ColorField[10] = Color.DARK_GRAY;
    ColorField[11] = Color.PINK;
    ColorField[12] = Color.WHITE;
}

From source file:com.andgate.pokeadot.PlayResultsScreen.java

License:Open Source License

public PlayResultsScreen(PokeADot currentGame) {
    game = currentGame;/*from  w w w  .j  av  a2s  . co m*/
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);

    boolean newHighScore = false;
    if (game.mode == PokeADot.GameMode.PLAY) {
        HighScore currentHighScore = HighScoreService.get();
        if (game.gameTime >= currentHighScore.time) {
            HighScoreService.set(new HighScore(game.gameTime));
            newHighScore = true;
        }
    }

    // Retry and exit buttons
    final ImageButton nextButton = game.createIconButton(Constants.GO_ICON_LOCATION,
            Constants.GO_ICON_DOWN_LOCATION, new ClickListener() {
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    game.buttonPressedSound.play();
                    goMainMenu();
                }
            });

    final ImageButton replayButton = game.createIconButton(Constants.REPLAY_ICON_LOCATION,
            Constants.REPLAY_ICON_DOWN_LOCATION, new ClickListener() {
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    game.buttonPressedSound.play();
                    goReplay();
                }
            });

    // display information about the game depending on the currently selected mode.
    final Label.LabelStyle titleLabelStyle = new Label.LabelStyle(game.largeFont, Color.ORANGE);
    final Label.LabelStyle infoLabelStyle = new Label.LabelStyle(game.mediumSmallFont, Color.LIGHT_GRAY);
    final Label.LabelStyle newHighScoreLabelStyle = new Label.LabelStyle(game.mediumSmallFont, Color.RED);

    final Label resultsLabel = new Label("Result", titleLabelStyle);
    final Label timeLabel = new Label(String.format("Time: %.2f", game.gameTime) + " seconds", infoLabelStyle);
    final Label newHighScoreLabel = new Label("New high score!", newHighScoreLabelStyle);

    //table.debugAll();

    final Table resultsTable = new Table();
    resultsTable.add(resultsLabel).center().spaceBottom(25.0f).row();
    resultsTable.add(timeLabel).top().center().row();

    if (newHighScore) {
        resultsTable.add(newHighScoreLabel).top().center().row();
    }

    final Table buttonsTable = new Table();
    buttonsTable.add(replayButton).left();
    buttonsTable.add(nextButton).expandX().right();

    final Table table = new Table();
    table.setFillParent(true);
    table.add(resultsTable).top().center().spaceBottom(25.0f).row();
    //table.add(replayButton).left();
    //table.add(nextButton).right();
    table.add(buttonsTable).fill();

    stage.addActor(table);
}

From source file:com.andgate.pokeadot.PracticeResultsScreen.java

License:Open Source License

public PracticeResultsScreen(PokeADot currentGame) {
    game = currentGame;/*  w  w w. j  a v  a 2s  . c  o  m*/
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);

    // Retry and exit buttons
    ImageButton nextButton = game.createIconButton(Constants.GO_ICON_LOCATION, Constants.GO_ICON_DOWN_LOCATION,
            new ClickListener() {
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    game.buttonPressedSound.play();
                    goMainMenu();
                }
            });

    ImageButton replayButton = game.createIconButton(Constants.REPLAY_ICON_LOCATION,
            Constants.REPLAY_ICON_DOWN_LOCATION, new ClickListener() {
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    game.buttonPressedSound.play();
                    goReplay();
                }
            });

    // display information about the game depending on the currently selected mode.
    LabelStyle titleLabelStyle = new LabelStyle(game.largeFont, Color.ORANGE);
    LabelStyle infoLabelStyle = new LabelStyle(game.mediumSmallFont, Color.LIGHT_GRAY);

    Label resultsLabel = new Label("Results", titleLabelStyle);

    Label timeTitleLabel = new Label("Time: ", infoLabelStyle);
    Label timeLabel = new Label(doubleDecimal.format(game.gameTime) + " seconds", infoLabelStyle);

    Label hitsTitleLabel = new Label("Hit: ", infoLabelStyle);
    Label hitsLabel = new Label(((int) game.hits) + " p", infoLabelStyle);

    Label missedTitleLabel = new Label("Missed: ", infoLabelStyle);
    Label missedLabel = new Label(((int) game.missed) + " p", infoLabelStyle);

    String accuracyString;
    if (game.missed > 0) {
        float accuracy = (float) game.hits / (game.hits + game.missed);
        accuracyString = doubleDecimal.format(accuracy) + "%";
    } else {
        accuracyString = "-";
    }

    Label acurracyTitleLabel = new Label("Accuracy: ", infoLabelStyle);
    Label accuracyLabel = new Label(accuracyString, infoLabelStyle);

    Table table = new Table();
    //table.debugAll();

    table.add(resultsLabel).center().spaceBottom(25.0f).row();

    table.add(timeTitleLabel).top().left();
    table.add(timeLabel).expand().top().left().row();

    table.add(hitsTitleLabel).top().left();
    table.add(hitsLabel).expand().top().left().row();

    table.add(missedTitleLabel).top().left();
    table.add(missedLabel).expand().top().left().row();

    table.add(acurracyTitleLabel).top().left();
    table.add(accuracyLabel).expand().top().left().row();

    table.add(replayButton).bottom().center();
    table.add(nextButton).expand().bottom().center();

    table.setFillParent(true);

    stage.addActor(table);
}

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

License:Apache License

@Override
public void show() {
    float size = DPIUtils.getPrefButtonSize();
    float margin = DPIUtils.getMarginSize();

    stage = new Stage(new ScreenViewport());

    table = new Table(ui.getSkin());
    table.setFillParent(true);/*  w  w w  .j a  va2 s.  c o  m*/
    table.left().top();
    table.pad(margin);

    table.addListener(new InputListener() {
        @Override
        public boolean keyUp(InputEvent event, int keycode) {
            if (keycode == Input.Keys.ESCAPE || keycode == Input.Keys.BACK)
                ui.setCurrentScreen(Screens.SCENE_SCREEN);
            return true;
        }
    });

    stage.setKeyboardFocus(table);

    Button back = new Button(ui.getSkin(), "back");

    back.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            ui.setCurrentScreen(Screens.SCENE_SCREEN);
        }
    });

    Label title = new Label("DEBUG SCREEN", ui.getSkin(), "title");

    Table header = new Table();
    header.padBottom(margin);
    Container<Button> cont = new Container<Button>(back);
    cont.size(size);
    header.add(cont);
    header.add(title).fillX().expandX().left();
    table.add(header).colspan(3).fillX().expandX().left();

    // ------------- SPEED
    speedText = new TextField(Float.toString(((SceneScreen) ui.getScreen(Screens.SCENE_SCREEN)).getSpeed()),
            ui.getSkin());
    TextButton speedButton = new TextButton("Set Speed", ui.getSkin());
    speedButton.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            SceneScreen scnScr = (SceneScreen) ui.getScreen(Screens.SCENE_SCREEN);
            scnScr.setSpeed(Float.parseFloat(speedText.getText()));
        }
    });

    speedButton.pad(2, 3, 2, 3);
    HorizontalGroup sGroup = new HorizontalGroup();
    sGroup.space(10);
    sGroup.addActor(speedText);
    sGroup.addActor(speedButton);

    table.row().pad(5).align(Align.left);
    table.add(new Label("Game Speed: ", ui.getSkin(), "debug"));
    table.add(sGroup);

    // ------------- RECORDING

    final Recorder r = ui.getRecorder();
    TextButton play = new TextButton(r.isPlaying() ? "Stop" : "Play", ui.getSkin());
    rec = new TextButton(r.isRecording() ? "Stop Rec" : "Rec", ui.getSkin());
    play.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            final Recorder r = ui.getRecorder();

            if (!r.isPlaying()) {
                r.setFilename(recordings.getSelected());
                r.load();
                r.setPlaying(true);
                ui.setCurrentScreen(Screens.SCENE_SCREEN);
            } else {
                r.setPlaying(false);
                ui.setCurrentScreen(Screens.SCENE_SCREEN);
            }
        }
    });

    rec.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            final Recorder r = ui.getRecorder();

            if (r.isPlaying()) {
                r.setPlaying(false);
            }

            if (!r.isRecording())
                r.setFilename(recFilename.getText());

            r.setRecording(!r.isRecording());
            rec.setText(r.isRecording() ? "Stop Rec" : "Rec");

            if (r.isRecording())
                ui.setCurrentScreen(Screens.SCENE_SCREEN);
        }
    });

    recordings = new SelectBox<String>(ui.getSkin());

    String[] testFiles = EngineAssetManager.getInstance().listAssetFiles("/tests");
    ArrayList<String> al = new ArrayList<String>();

    for (String file : testFiles)
        if (file.endsWith(Recorder.RECORD_EXT))
            al.add(file.substring(0, file.indexOf(Recorder.RECORD_EXT)));

    FileHandle[] testFiles2 = EngineAssetManager.getInstance().getUserFolder().list();

    for (FileHandle file : testFiles2)
        if (file.name().endsWith(Recorder.RECORD_EXT))
            al.add(file.name().substring(0, file.name().indexOf(Recorder.RECORD_EXT)));

    recordings.setItems(al.toArray(new String[al.size()]));

    play.pad(2, 3, 2, 3);
    rec.pad(2, 3, 2, 3);

    recFilename = new TextField(r.getFileName(), ui.getSkin());

    HorizontalGroup rGroup = new HorizontalGroup();
    rGroup.space(10);
    rGroup.addActor(recordings);
    rGroup.addActor(play);
    rGroup.addActor(new Label("Rec. Filename", ui.getSkin(), "debug"));
    rGroup.addActor(recFilename);
    rGroup.addActor(rec);

    table.row().pad(5).align(Align.left);
    table.add(new Label("Game Recording: ", ui.getSkin(), "debug"));
    table.add(rGroup);

    // ------------- SCENES
    TextButton go = new TextButton("Go", ui.getSkin());
    go.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            World.getInstance().resume();
            World.getInstance().setCutMode(false);
            World.getInstance().setCurrentScene(scenes.getSelected());
            ui.setCurrentScreen(Screens.SCENE_SCREEN);
        }
    });

    go.pad(2, 3, 2, 3);

    scenes = new SelectBox<String>(ui.getSkin());
    scenes.setItems(World.getInstance().getScenes().keySet()
            .toArray(new String[World.getInstance().getScenes().size()]));

    HorizontalGroup scGroup = new HorizontalGroup();
    scGroup.space(10);
    scGroup.addActor(scenes);
    scGroup.addActor(go);

    table.row().pad(5).align(Align.left);
    table.add(new Label("Go to Scene: ", ui.getSkin(), "debug"));
    table.add(scGroup);

    // ------------- TESTERBOT
    final TesterBot bot = ui.getTesterBot();

    TextButton runBot = new TextButton(bot.isEnabled() ? "Stop" : "Run", ui.getSkin());
    runBot.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            final TesterBot bot = ui.getTesterBot();

            bot.setMaxWaitInverval(Float.parseFloat(testerTimeConf.getText()));
            bot.setInSceneTime(Float.parseFloat(inSceneTimeConf.getText()));
            bot.setExcludeList(testerExcludeList.getText());
            bot.setEnabled(!bot.isEnabled());

            ui.setCurrentScreen(Screens.SCENE_SCREEN);
        }
    });

    runBot.pad(2, 3, 2, 3);

    testerTimeConf = new TextField(Float.toString(bot.getMaxWaitInverval()), ui.getSkin());
    inSceneTimeConf = new TextField(Float.toString(bot.getInSceneTime()), ui.getSkin());
    testerExcludeList = new TextField(bot.getExcludeList(), ui.getSkin());

    TextButton testerLeaveConf = new TextButton("Leave", ui.getSkin(), "toggle");
    testerLeaveConf.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            final TesterBot bot = ui.getTesterBot();

            bot.setRunLeaveVerbs(!bot.isRunLeaveVerbs());
        }
    });

    testerLeaveConf.setChecked(bot.isRunLeaveVerbs());

    TextButton testerGotoConf = new TextButton("Goto", ui.getSkin(), "toggle");
    testerGotoConf.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            final TesterBot bot = ui.getTesterBot();

            bot.setRunGoto(!bot.isRunGoto());
        }
    });

    testerGotoConf.setChecked(bot.isRunGoto());

    TextButton testerPassText = new TextButton("Pass Texts", ui.getSkin(), "toggle");
    testerPassText.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            final TesterBot bot = ui.getTesterBot();

            bot.setPassTexts(!bot.isPassTexts());
        }
    });

    testerPassText.setChecked(bot.isPassTexts());

    TextButton testerWaitWhenWalking = new TextButton("Wait When Walking", ui.getSkin(), "toggle");
    testerWaitWhenWalking.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            final TesterBot bot = ui.getTesterBot();

            bot.setWaitWhenWalking(!bot.isWaitWhenWalking());
        }
    });

    testerWaitWhenWalking.setChecked(bot.isWaitWhenWalking());

    HorizontalGroup botGroup = new HorizontalGroup();
    botGroup.space(10);

    botGroup.addActor(testerLeaveConf);
    botGroup.addActor(testerGotoConf);
    botGroup.addActor(testerPassText);
    botGroup.addActor(testerWaitWhenWalking);

    HorizontalGroup botGroup2 = new HorizontalGroup();
    botGroup2.space(10);

    botGroup2.addActor(new Label("Excl. List: ", ui.getSkin(), "debug"));
    botGroup2.addActor(testerExcludeList);
    botGroup2.addActor(new Label("Interval: ", ui.getSkin(), "debug"));
    botGroup2.addActor(testerTimeConf);
    botGroup2.addActor(new Label("Scn Time: ", ui.getSkin(), "debug"));
    botGroup2.addActor(inSceneTimeConf);
    botGroup2.addActor(runBot);

    table.row().pad(5).align(Align.left);
    table.add(new Label("Tester Bot: ", ui.getSkin(), "debug"));
    table.add(botGroup);
    table.row().pad(5).align(Align.left);
    table.add();
    table.add(botGroup2);

    // ------------- VERSION LABEL NOT IN TABLE
    String versionString = Config.getProperty(Config.TITLE_PROP, "title unspecified") + " v"
            + Config.getProperty(Config.VERSION_PROP, "unspecified") + "\n" + "Blade Engine: v"
            + Config.getProperty("bladeEngineVersion", "unspecified") + "\n" + "libGdx: v"
            + Config.getProperty("gdxVersion", "unspecified") + "\n" + "RoboVM: v"
            + Config.getProperty("roboVMVersion", "unspecified") + "\n";
    //             + "Gdx.app.getVersion: " + Gdx.app.getVersion();

    Label version = new Label(versionString, ui.getSkin(), "debug");
    version.setColor(Color.LIGHT_GRAY);
    Table versionStack = new Table();
    versionStack.defaults().pad(DPIUtils.getSpacing());
    versionStack.pad(0);
    versionStack.add(version);
    versionStack.bottom().left();
    versionStack.setFillParent(true);
    versionStack.pack();
    table.row();
    table.add(versionStack).colspan(3).left();

    table.pack();

    ScrollPane scrollPane = new ScrollPane(table);
    scrollPane.setFillParent(true);
    stage.addActor(scrollPane);

    pointer = new Pointer(ui.getSkin());
    stage.addActor(pointer);

    Gdx.input.setInputProcessor(stage);
}

From source file:com.bladecoder.engine.util.Utils3D.java

License:Apache License

private static void createAxes() {
    ModelBuilder modelBuilder = new ModelBuilder();
    modelBuilder.begin();/*from   w  w  w .  j  av  a  2 s  .c  om*/
    MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES, Usage.Position | Usage.ColorUnpacked,
            new Material());
    builder.setColor(Color.LIGHT_GRAY);
    for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) {
        builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX);
        builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t);
    }
    builder = modelBuilder.part("axes", GL20.GL_LINES, Usage.Position | Usage.ColorUnpacked, new Material());
    builder.setColor(Color.RED);
    builder.line(0, 0, 0, 10, 0, 0);
    builder.setColor(Color.GREEN);
    builder.line(0, 0, 0, 0, 10, 0);
    builder.setColor(Color.BLUE);
    builder.line(0, 0, 0, 0, 0, 10);
    axesModel = modelBuilder.end();
    axesInstance = new ModelInstance(axesModel);
}

From source file:com.centergame.starttrack.graphics.actors.TabView.java

/**
 * @param names tab headers// www  .ja  v  a2s  . c  o m
 */
public TabView(String[] names) {

    this.headerHeight = StartTrackApp.dp2px(32);
    this.separatorHeight = StartTrackApp.dp2px(1);
    this.separatorPadding = StartTrackApp.dp2px(12);
    this.underlineHeight = StartTrackApp.dp2px(2);

    this.selectedTextColor = Color.valueOf("202020");
    this.unselectedTextColor = Color.valueOf("666666");
    this.separatorColor = Color.LIGHT_GRAY;
    this.underlineColor = Color.DARK_GRAY;

    this.tabIndex = -1;
    this.headers = new ArrayList<Text>();
    this.contents = new ArrayList<Group>();

    int i = 0;
    for (String name : names) {
        final int ii = i;
        LabelStyle s = StartTrackApp.getResources().getLabelStyle("tabs_header");
        s.fontColor = unselectedTextColor;
        Text t = new Text(name.toUpperCase(), s);
        t.setAlignment(Align.center);
        t.addListener(new ActorGestureListener() {
            public void tap(InputEvent event, float x, float y, int count, int button) {
                selectTab(ii);
            }
        });
        headers.add(t);
        addActor(t);

        Group g = new Group() {
            @Override
            public void addActor(Actor actor) {
                super.addActor(actor);
                this.setHeight(actor.getHeight());
                actor.setPosition(0, 0);
            }
        };
        g.setVisible(false);
        contents.add(g);
        addActor(g);

        i++;
    }

    this.separator = new IdpColorPixmap(separatorColor).buildActor();
    addActor(separator);

    this.underline = new IdpColorPixmap(underlineColor).buildActor();
    addActor(underline);

    setBackgroundColor(Color.valueOf("fafafa"));
    setBorder(StartTrackApp.dp2px(1), 0, StartTrackApp.dp2px(1), 0);
    setBorderColor(Color.LIGHT_GRAY);
    layout();
}

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);//from   ww  w.j  a v  a 2  s.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.finalproject.MainGame.EndScreen.java

public void create() {
    batch = new SpriteBatch();
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);/* ww  w . jav a 2  s  .  c o  m*/

    skin = new Skin();
    // Generate a 1x1 white texture and store it in the skin named "black".                
    Pixmap pixmap = new Pixmap(100, 75, Format.RGBA8888);
    pixmap.setColor(Color.BLACK);
    pixmap.fill();

    skin.add("black", new Texture(pixmap));

    BitmapFont bfont = new BitmapFont();
    BitmapFont titleFont = new BitmapFont();
    titleFont.getData().setScale(1);
    bfont.getData().setScale(1);
    skin.add("default", bfont);

    TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("black", Color.DARK_GRAY);
    textButtonStyle.down = skin.newDrawable("black", Color.DARK_GRAY);
    textButtonStyle.checked = skin.newDrawable("black", Color.BLUE);
    textButtonStyle.over = skin.newDrawable("black", Color.LIGHT_GRAY);
    LabelStyle textLabelStyle = new LabelStyle();
    textLabelStyle.font = skin.getFont("default");

    textButtonStyle.font = skin.getFont("default");
    // Import the fonts for the Loose label
    skin.add("default", textButtonStyle);
    skin.add("default", textLabelStyle);

    // Add the end screen label
    final Label title = new Label("  Y o u  L o s e !  ", textLabelStyle);
    title.setPosition(265, 300);
    stage.addActor(title);
}