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

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

Introduction

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

Prototype

Color RED

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

Click Source Link

Usage

From source file:com.kotcrab.vis.editor.ui.dialog.NewProjectDialogLibGDX.java

License:Apache License

private void createUI() {
    projectRoot = new VisValidatableTextField("");
    chooseRootButton = new VisTextButton("Choose...");
    sourceLoc = new VisValidatableTextField("/core/src");
    assetsLoc = new VisValidatableTextField("/android/assets");

    errorLabel = new VisLabel();
    errorLabel.setColor(Color.RED);

    TableUtils.setSpacingDefaults(this);
    columnDefaults(0).left();/*from  w  w  w  .  j a  va2  s  .co  m*/
    columnDefaults(1).width(300);

    row().padTop(4);
    add(new VisLabel("Project root"));
    add(projectRoot);
    add(chooseRootButton);
    row();

    add(new VisLabel("Source folder"));
    add(sourceLoc).fill();
    row();

    add(new VisLabel("Assets folder"));
    add(assetsLoc).fill();
    row();

    add(new VisLabel("Assets folder is cleared on each export!")).colspan(3).row();

    VisTable buttonTable = new VisTable(true);
    buttonTable.defaults().minWidth(70);

    cancelButton = new VisTextButton("Cancel");
    createButton = new VisTextButton("Create");
    createButton.setDisabled(true);

    buttonTable.add(errorLabel).fill().expand();
    buttonTable.add(cancelButton);
    buttonTable.add(createButton);

    add(buttonTable).colspan(3).fillX().expandX();
}

From source file:com.kotcrab.vis.editor.ui.dialog.SpriterImportDialog.java

License:Apache License

public SpriterImportDialog(FileHandle animFolder, String relativePath) {
    super("Import Spriter Animation");
    this.animFolder = animFolder;

    visAnimFolder = animFolder.child(".vis");

    left();// w w w.  j  a  v  a2  s.  c  om
    defaults().left();

    setModal(true);
    addCloseButton();
    closeOnEscape();
    TableUtils.setSpacingDefaults(this);

    scaleField = new VisValidatableTextField("1.00");
    scaleField.setTextFieldFilter(new FloatDigitsOnlyFilter(false));
    image = new VisImage(Icons.QUESTION_BIG.drawable());
    new Tooltip(image, "If your images are too big you can use this to rescale source images");

    VisTable scaleRatioTable = new VisTable();

    scaleRatioTable.add(new VisLabel("Image Scale Ratio: "));
    scaleRatioTable.add(scaleField);
    scaleRatioTable.add(image).size(22);

    VisLabel helpLabel = new VisLabel(
            "Animation will be converted. Do not change files inside this directory after importing. To update animation go to "
                    + relativePath + "/.vis/update and paste new animation files there.");
    helpLabel.setWrap(true);

    VisTextButton cancelButton = new VisTextButton("Cancel");
    VisTextButton importButton = new VisTextButton("Import");

    VisLabel errorLabel = new VisLabel("", Color.RED);

    VisTable buttonTable = new VisTable(true);
    buttonTable.add(cancelButton);
    buttonTable.add(importButton);

    add(scaleRatioTable).expandX().fillX().colspan(2);
    row();
    add(helpLabel).expandX().fillX().colspan(2);
    row();
    add(errorLabel).expandX().fillX().minWidth(300);
    add(buttonTable).padBottom(3);

    pack();
    centerWindow();

    FormValidator formValidator = new FormValidator(importButton, errorLabel);
    formValidator.valueGreaterThan(scaleField, "Scale ratio must be greater than 0.01", 0.01f, true);
    formValidator.valueLesserThan(scaleField, "Scale ratio must be lesser than 1", 1f, true);

    cancelButton.addListener(new VisChangeListener((event, actor) -> fadeOut()));
    importButton.addListener(new VisChangeListener((event, actor) -> {
        try {
            checkSettings();
        } catch (EditorException e) {
            DialogUtils.showErrorDialog(getStage(), e.getMessage());
            return;
        }

        if (warnings.size > 0) {
            DialogUtils.showConfirmDialog(getStage(), "Warning", "Some problem were found during files check",
                    new String[] { "Details", "Import Anyway" }, new Integer[] { 0, 1 }, result -> {
                        if (result == 0) {
                            final StringBuilder warningMsg = new StringBuilder();
                            warnings.forEach(s -> warningMsg.append(s + "\n\n"));
                            getStage().addActor(new DetailsDialog("Some problem were found during files check",
                                    "Warning Details", warningMsg.toString()));
                        } else {
                            importAnimation();
                            fadeOut();
                        }
                    });
            return;
        }

        importAnimation();
        fadeOut();
    }));
}

From source file:com.kotcrab.vis.editor.ui.scene.LayerSettingsDialog.java

License:Apache License

public LayerSettingsDialog(ModuleInjector injector, EditorScene scene) {
    super("Layer Settings");
    injector.injectModules(this);

    EditorLayer layer = scene.getActiveLayer();

    TableUtils.setSpacingDefaults(this);
    setModal(true);/*from ww w .  j a  v  a  2  s  . c o m*/
    addCloseButton();
    closeOnEscape();

    defaults().left();

    VisLabel idLabel = new VisLabel();
    idLabel.setColor(Color.GRAY);
    VisValidatableTextField nameField = new VisValidatableTextField();
    EnumSelectBox<LayerCordsSystem> cordsSelectBox = new EnumSelectBox<>(LayerCordsSystem.class,
            new PrettyEnumNameProvider<>());
    add(new VisLabel("Layer ID"), idLabel);
    row();
    add(new VisLabel("Name"), nameField);
    row();
    add(new VisLabel("Coordinates system"));
    add(cordsSelectBox).width(150);
    row();

    idLabel.setText(String.valueOf(layer.id));
    nameField.setText(layer.name);
    cordsSelectBox.setSelectedEnum(layer.cordsSystem);

    VisLabel errorLabel = new VisLabel();
    errorLabel.setColor(Color.RED);

    VisTextButton cancelButton = new VisTextButton("Cancel");
    VisTextButton applyButton = new VisTextButton("Apply");

    cancelButton.addListener(new VisChangeListener((event, actor) -> fadeOut()));
    applyButton.addListener(new VisChangeListener((event, actor) -> {
        undoModule.execute(
                new ChangeLayerProperties(scene, layer, nameField.getText(), cordsSelectBox.getSelectedEnum()));
        fadeOut();
    }));

    VisTable bottomTable = new VisTable();

    bottomTable.add(errorLabel).expandX().fillX();
    bottomTable.add(TableBuilder.build(cancelButton, applyButton)).padTop(2).padLeft(3).padBottom(3).right();

    add(bottomTable).colspan(2).expandX().fillX();

    FormValidator validator = new FormValidator(applyButton, errorLabel);
    validator.notEmpty(nameField, "Name cannot be empty");
    validator.custom(nameField, new FormInputValidator("This name is already used") {
        @Override
        protected boolean validate(String input) {
            if (input.equals(layer.name))
                return true;

            return scene.getLayerByName(input) == null;
        }
    });

    pack();
    centerWindow();
}

From source file:com.kotcrab.vis.editor.ui.scene.NewSceneDialog.java

License:Apache License

private void createUI() {
    nameTextField = new VisValidatableTextField();
    pathTextField = new VisValidatableTextField("/scene/");
    viewportModeSelectBox = new EnumSelectBox<>(SceneViewport.class, new PrettyEnumNameProvider<>());

    errorLabel = new VisLabel();
    errorLabel.setColor(Color.RED);

    TableUtils.setSpacingDefaults(this);
    columnDefaults(0).left();// ww  w  .j  a  v a2  s. com
    columnDefaults(1).width(300);

    row().padTop(4);

    VisTable fileFieldTable = new VisTable(true);
    fileFieldTable.add(nameTextField).expand().fill();
    fileFieldTable.add(new VisLabel(".scene"));

    add(new VisLabel("File name"));
    add(fileFieldTable);
    row();

    add(new VisLabel("Path"));
    add(pathTextField);
    row();

    add(new VisLabel("Viewport"));
    add(viewportModeSelectBox);
    row();

    pixelsPerUnitField = new VisValidatableTextField("100");
    pixelsPerUnitField.setTextFieldFilter(new DigitsOnlyFilter());

    add(new VisLabel("Pixels per unit"));
    add(pixelsPerUnitField).left().width(60);
    row();

    widthField = new VisValidatableTextField("12.8");
    heightField = new VisValidatableTextField("7.2");
    widthField.setTextFieldFilter(new FloatDigitsOnlyFilter(false));
    heightField.setTextFieldFilter(new FloatDigitsOnlyFilter(false));

    VisTable sizeTable = new VisTable(true);
    add(new VisLabel("Width"));
    sizeTable.add(widthField).width(60);
    sizeTable.add(new VisLabel("Height"));
    sizeTable.add(heightField).width(60);
    sizeTable.add(new VisLabel("units"));
    sizeTable.add().expand().fill();

    add(sizeTable).expand().fill();
    row();

    VisTable buttonTable = new VisTable(true);
    buttonTable.defaults().minWidth(70);

    cancelButton = new VisTextButton("Cancel");
    createButton = new VisTextButton("Create");
    createButton.setDisabled(true);

    buttonTable.add(errorLabel).fill().expand();
    buttonTable.add(cancelButton);
    buttonTable.add(createButton);

    add(buttonTable).colspan(2).fill().expand();
    padBottom(5);
}

From source file:com.kotcrab.vis.editor.ui.scene.SceneSettingsDialog.java

License:Apache License

@Override
protected void createUI() {
    viewportModeSelectBox = new EnumSelectBox<>(SceneViewport.class, new PrettyEnumNameProvider<>());
    viewportModeSelectBox.setSelectedEnum(scene.viewport);

    //TODO error msg can't fit on window, for now we don't display it at all
    errorLabel = new VisLabel();
    errorLabel.setColor(Color.RED);

    TableUtils.setSpacingDefaults(this);
    columnDefaults(0).left();/*from www  .j a v  a 2s.c o m*/

    row().padTop(4);

    add(new VisLabel("Viewport"));
    add(viewportModeSelectBox).expand().fill();
    row();

    widthField = new VisValidatableTextField(String.valueOf(scene.width));
    heightField = new VisValidatableTextField(String.valueOf(scene.height));
    widthField.setTextFieldFilter(new FloatDigitsOnlyFilter(false));
    heightField.setTextFieldFilter(new FloatDigitsOnlyFilter(false));

    VisTable sizeTable = new VisTable(true);
    add(new VisLabel("Width"));
    sizeTable.add(widthField).width(60);
    sizeTable.add(new VisLabel("Height"));
    sizeTable.add(heightField).width(60);

    add(sizeTable).expand().fill();
    row();

    add(getButtonTable()).colspan(2).fill().expand();
    padBottom(5);
}

From source file:com.kotcrab.vis.plugin.spriter.ui.SpriterImportDialog.java

License:Apache License

public SpriterImportDialog(FileHandle animFolder, String relativePath) {
    super("Import Spriter Animation");
    this.animFolder = animFolder;

    visAnimFolder = animFolder.child(".vis");

    left();/*from www .  j  a va  2s .c  om*/
    defaults().left();

    setModal(true);
    addCloseButton();
    closeOnEscape();
    TableUtils.setSpacingDefaults(this);

    scaleField = new VisValidatableTextField("1.00");
    scaleField.setTextFieldFilter(new FloatDigitsOnlyFilter(false));
    image = new VisImage(Icons.QUESTION_BIG.drawable());
    new Tooltip.Builder("If your images are too big you can use this to rescale source images").target(image)
            .build();

    VisTable scaleRatioTable = new VisTable();

    scaleRatioTable.add(new VisLabel("Image Scale Ratio: "));
    scaleRatioTable.add(scaleField);
    scaleRatioTable.add(image).size(22);

    VisLabel helpLabel = new VisLabel(
            "Animation will be converted. Do not change files inside this directory after importing. To update animation go to "
                    + relativePath + "/.vis/update and paste new animation files there.");
    helpLabel.setWrap(true);

    VisTextButton cancelButton = new VisTextButton("Cancel");
    VisTextButton importButton = new VisTextButton("Import");

    VisLabel errorLabel = new VisLabel("", Color.RED);

    VisTable buttonTable = new VisTable(true);
    buttonTable.add(cancelButton);
    buttonTable.add(importButton);

    add(scaleRatioTable).expandX().fillX().colspan(2);
    row();
    add(helpLabel).expandX().fillX().colspan(2);
    row();
    add(errorLabel).expandX().fillX().minWidth(300);
    add(buttonTable).padBottom(3);

    pack();
    centerWindow();

    FormValidator formValidator = new FormValidator(importButton, errorLabel);
    formValidator.valueGreaterThan(scaleField, "Scale ratio must be greater than 0.01", 0.01f, true);
    formValidator.valueLesserThan(scaleField, "Scale ratio must be lesser than 1", 1f, true);

    cancelButton.addListener(new VisChangeListener((event, actor) -> fadeOut()));
    importButton.addListener(new VisChangeListener((event, actor) -> {
        try {
            checkSettings();
        } catch (EditorException e) {
            Dialogs.showErrorDialog(getStage(), e.getMessage());
            return;
        }

        if (warnings.size > 0) {
            Dialogs.showConfirmDialog(getStage(), "Warning", "Some problem were found during files check",
                    new String[] { "Details", "Import Anyway" }, new Integer[] { 0, 1 }, result -> {
                        if (result == 0) {
                            final StringBuilder warningMsg = new StringBuilder();
                            warnings.forEach(s -> warningMsg.append(s + "\n\n"));
                            getStage().addActor(new DetailsDialog("Some problem were found during files check",
                                    "Warning Details", warningMsg.toString()));
                        } else {
                            importAnimation();
                            fadeOut();
                        }
                    });
            return;
        }

        importAnimation();
        fadeOut();
    }));
}

From source file:com.mbrlabs.mundus.editor.utils.UsefulMeshs.java

License:Apache License

public static Model createAxes() {
    final float GRID_MIN = -10f;
    final float GRID_MAX = 10f;
    final float GRID_STEP = 1f;
    ModelBuilder modelBuilder = new ModelBuilder();
    modelBuilder.begin();//from   w ww . j  a v  a  2s.co m
    MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES,
            VertexAttributes.Usage.Position | VertexAttributes.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,
            VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material());
    builder.setColor(Color.RED);
    builder.line(0, 0, 0, 100, 0, 0);
    builder.setColor(Color.GREEN);
    builder.line(0, 0, 0, 0, 100, 0);
    builder.setColor(Color.BLUE);
    builder.line(0, 0, 0, 0, 0, 100);
    return modelBuilder.end();
}

From source file:com.mbrlabs.mundus.utils.Compass.java

License:Apache License

public Compass(PerspectiveCamera worldCam) {
    this.worldCam = worldCam;
    this.ownCam = new PerspectiveCamera();

    ModelBuilder modelBuilder = new ModelBuilder();
    modelBuilder.begin();//w  ww.java2s . c  om

    MeshPartBuilder builder = modelBuilder.part("compass", GL20.GL_TRIANGLES,
            VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material());
    builder.setColor(Color.RED);
    builder.arrow(0, 0, 0, ARROW_LENGTH, 0, 0, ARROW_CAP_SIZE, ARROW_THIKNESS, ARROW_DIVISIONS);
    builder.setColor(Color.GREEN);
    builder.arrow(0, 0, 0, 0, ARROW_LENGTH, 0, ARROW_CAP_SIZE, ARROW_THIKNESS, ARROW_DIVISIONS);
    builder.setColor(Color.BLUE);
    builder.arrow(0, 0, 0, 0, 0, ARROW_LENGTH, ARROW_CAP_SIZE, ARROW_THIKNESS, ARROW_DIVISIONS);
    compassModel = modelBuilder.end();
    compassInstance = new ModelInstance(compassModel);

    // translate to top left corner
    compassInstance.transform.translate(0.93f, 0.94f, 0);
}

From source file:com.minekrash.game.Game.java

public void render(SpriteBatch g) {
    if (isInitGame) {
        for (int i = 0; i < 14; i++) {
            paint.drawImage(g, fondo, fondoX, (fondoY * i) + deltaYfondo - (HEIGHT / 2) - fondoY);
        }//from  w ww.ja va 2  s  .c om

        vagon.draw(g);

        for (int i = 0; i < plataforma.length; i++) {
            plataforma[i].draw(g);
        }

        paint.drawImage(g, brilloLava, fondoX, -(HEIGHT / 2));

        //Textos
        switch (ESTADO_GAME) {
        case READY:
            paint.drawText(g, fuenteGrande, Define.LISTO[Define.Lenguaje], Color.WHITE, 0,
                    fuenteGrande.getCapHeight() * 2, BitmapFont.HAlignment.CENTER, alphaText);
            break;
        case RUN:
            //Flechas
            paint.drawImageFlip(g, flechas, (WIDTH / 2) - flechas.getWidth(), -(HEIGHT / 2), false,
                    controller.pressRight);
            paint.drawImageFlip(g, flechas, -(WIDTH / 2) + flechas.getWidth(), -(HEIGHT / 2), true,
                    controller.pressLeft);
            //Marcador de metros
            paint.drawImage(g, barraMetros, -(barraMetros.getWidth() / 2),
                    (HEIGHT / 2) - barraMetros.getHeight());
            paint.drawText(g, fuente, Define.METROS[Define.Lenguaje] + (int) metros, Color.WHITE, 0,
                    ((HEIGHT / 2) * ESCALA_METROS) - (fuente.getCapHeight() * 1.5f),
                    BitmapFont.HAlignment.CENTER, 1f);
            break;
        case GAME_OVER:
            paint.drawText(g, fuenteGrande, Define.GAME_OVER, Color.WHITE, 0, fuenteGrande.getCapHeight() * 3,
                    BitmapFont.HAlignment.CENTER, alphaText);
            if (metros > maxMetros) {
                paint.drawText(g, fuente, Define.NUEVO_RECORD[Define.Lenguaje], Color.RED, 0,
                        -fuente.getCapHeight() * 3, BitmapFont.HAlignment.CENTER, alphaText);
            }
            paint.drawText(g, fuente,
                    Define.LOGRO_1[Define.Lenguaje] + (int) metros + Define.LOGRO_2[Define.Lenguaje], Color.RED,
                    0, -fuente.getCapHeight() * 5, BitmapFont.HAlignment.CENTER, alphaText);
            break;
        }
    }
}

From source file:com.mknsri.drunktoss.GameScreen.java

License:Open Source License

public void render() {
    batch.begin();//www . j  a va  2  s  .c o m

    bg.drawBackground(this);
    factory.drawList(this);
    ilpo.render(this);

    batch.end();

    // Camera
    batch.setProjectionMatrix(ebingeimi.camera.combined);
    hudBatch.setProjectionMatrix(ebingeimi.hudCamera.combined);
    ebingeimi.camera.position.set(ilpo.x + 100, ilpo.y + 50, 0);

    // HUD drawing
    hudBatch.begin();

    // Tutorial drawing
    if (tutorialPos < 2) {
        if (tutorialPos == 0) {
            drawSpriteOnHUD(Art.tut1, 0, 0, 0);
        } else if (tutorialPos == 1) {
            drawSpriteOnHUD(Art.tut2, 0, 0, 0);
        }
    } else {
        // Distance
        drawStringOnHUD("Distance: " + Math.round(ilpo.getPoints() / 20) + "m", Color.YELLOW, 10,
                DrunkToss.VIEWPORT_HEIGHT - 10);

        // Game over
        if (gameOver == true) {
            int endPoints = (int) (ilpo.getPoints() / 20);
            drawSpriteOnHUD(Art.hiScoreScreen, 70, 40, 0);
            drawStringOnHUD(endPoints + "m", Color.YELLOW, 100, 160);
            int highScore = DrunkToss.prefs.getInteger("hiscore", 0);
            // New high score
            if (endPoints > highScore) {
                DrunkToss.prefs.putInteger("hiscore", endPoints);
                DrunkToss.prefs.flush();
                highScore = endPoints;
                drawStringOnHUD("(NEW!)", Color.YELLOW, 180, 100);
            }
            drawStringOnHUD(highScore + "m", Color.YELLOW, 100, 100);
            // Draw upload button
            drawSpriteOnHUD(uploadHiScoreBtn.bg, uploadHiScoreBtn.x, uploadHiScoreBtn.y, 0);
            drawSpriteOnHUD(Art.okB, 100, 50, 0);
            if (scoresUploaded == true) {
                drawStringOnHUD("Done!", Color.GREEN, 175, 100);
            }
        }

        // Game running
        else {

            // Start position
            if (!ilpo.launched) {
                drawSpriteOnHUD(Art.angle, 10, 90, launcher.getAngle() * 0.1f);
            } else {
            }
            // Fighting
            if (ilpo.fighting) {
                Color fc = Color.RED;
                if (ilpo.fightHealth < 30) {
                    fc = Color.RED;
                } else if (ilpo.fightHealth < 60) {
                    fc = Color.YELLOW;
                } else if (ilpo.fightHealth < 100) {
                    fc = Color.GREEN;
                }
                drawStringOnHUDCenter("TAP TO WIN THE FIGHT!", fc);
            }
        }
    }
    hudBatch.end();

}