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.nebula2d.editor.framework.components.BoundingBox.java

License:Open Source License

@Override
public void render(GameObject selectedObject, SpriteBatch batcher, Camera cam) {
    if (gameObject != null && w > 0 && h > 0) {
        batcher.end();//from  ww w .j  ava 2 s .c  o  m

        ShapeRenderer shape = new ShapeRenderer();
        shape.setProjectionMatrix(cam.combined);
        shape.setColor(Color.RED);
        shape.begin(ShapeRenderer.ShapeType.Line);
        float halfw = w / 2.0f;
        float halfh = h / 2.0f;

        float x = gameObject.getPosition().x - halfw;
        float y = gameObject.getPosition().y - halfh;

        shape.rect(x, y, w, h);
        shape.end();
        batcher.begin();
    }
}

From source file:com.nebula2d.editor.framework.components.Circle.java

License:Open Source License

@Override
public void render(GameObject selectedObject, SpriteBatch batcher, Camera cam) {
    if (gameObject != null && r % 360 != 0) {
        batcher.end();//from www .j a  v a  2 s.  co  m
        ShapeRenderer shape = new ShapeRenderer();
        shape.setProjectionMatrix(cam.combined);
        shape.setColor(Color.RED);
        shape.begin(ShapeRenderer.ShapeType.Line);

        float x = gameObject.getPosition().x;
        float y = gameObject.getPosition().y;

        shape.circle(x, y, r);

        shape.end();
        batcher.begin();
    }
}

From source file:com.nicholaschirkevich.game.model.GearView.java

License:Apache License

public GearView(Rectangle bounds, String gearNumberText, final String achivesText) {
    this.bounds = bounds;
    this.achivesText = achivesText;
    gearText = new Label(gearNumberText, AssetsManager.getUiSkin());
    gearText.setBounds(GameRuners.WIDTH / 4 - gearText.getWidth() / 3, GameRuners.HEIGHT / 4 - (height / 2),
            width, height);/*from   ww w . j a  v a 2  s  . c om*/
    gearText.setFontScale(GEAR_TEXT_FONT_SCALE_X, GEAR_TEXT_FONT_SCALE_Y);

    gearText.setColor(Color.ORANGE);

    achiveLabel = new Label(achivesText, AssetsManager.getUiSkin());
    achiveLabel.setBounds(GameRuners.WIDTH / 4 - achiveLabel.getWidth() / 2 + 10,
            GameRuners.HEIGHT / 4 - (height / 2), width, height);
    achiveLabel.setFontScale(ACHIVE_LABEL_FONT_SCALE_X, ACHIVE_LABEL_FONT_SCALE_Y);

    achiveLabel.setColor(achiveLabel.getColor().r, achiveLabel.getColor().g, achiveLabel.getColor().b, 0f);

    SequenceAction sequenceAction = new SequenceAction();
    sequenceAction.addAction(Actions.delay(1.5f));
    sequenceAction.addAction(new ViewActionAlfa(gearText));
    sequenceAction.addAction(Actions.delay(0.5f));
    sequenceAction.addAction(new Action() {
        @Override
        public boolean act(float delta) {
            achiveLabel.setColor(gearText.getColor().r, gearText.getColor().g, gearText.getColor().b, 1f);
            achiveLabel.setColor(Color.RED);
            achiveLabel.setText(achivesText);
            return true;
        }
    });
    sequenceAction.addAction(Actions.delay(1.5f));
    sequenceAction.addAction(new ViewActionAlfa(achiveLabel));
    //
    sequenceAction.addAction(Actions.removeActor());
    addAction(sequenceAction);
    setWidth(bounds.width);
    setHeight(bounds.height);

}

From source file:com.nicholaschirkevich.game.model.GearView.java

License:Apache License

public static void getView(int gear) {
    AssetsManager.playSound(Constants.SOUND_GEAR);
    ////  w  ww.j ava 2s. c o  m
    switch (gear) {
    case 1:
        ToastHelper.showCenterMessage(GameManager.getStrings().get(Constants.GAME_GEAR_2_LBL), X_2,
                Color.ORANGE, Color.RED, ToastLength.TOAST_LONG);
    case 2:
        ToastHelper.showCenterMessage(GameManager.getStrings().get(Constants.GAME_GEAR_3_LBL), X_3,
                Color.ORANGE, Color.RED, ToastLength.TOAST_LONG);

    case 3:
        ToastHelper.showCenterMessage(GameManager.getStrings().get(Constants.GAME_GEAR_4_LBL), X_4,
                Color.ORANGE, Color.RED, ToastLength.TOAST_LONG);

    case 4:
        ToastHelper.showCenterMessage(GameManager.getStrings().get(Constants.GAME_GEAR_5_LBL), X_5,
                Color.ORANGE, Color.RED, ToastLength.TOAST_LONG);

    case 5:
        ToastHelper.showCenterMessage(GameManager.getStrings().get(Constants.GAME_GEAR_6_LBL), X_6,
                Color.ORANGE, Color.RED, ToastLength.TOAST_LONG);

    }

}

From source file:com.o2d.pkayjava.editor.view.ui.dialog.ImportDialog.java

License:Apache License

ImportDialog() {
    super("Import Resources");
    setMovable(true);//  w ww.j  a  v  a2s  .  c o m
    setModal(false);
    addCloseButton();
    setStyle(VisUI.getSkin().get("box", WindowStyle.class));
    getTitleLabel().setAlignment(Align.left);

    setWidth(250);
    setHeight(100);

    facade = Overlap2DFacade.getInstance();

    fillTypeNames();

    mainTable = new VisTable();

    add(mainTable).fill().expand();

    setDroppingView();

    errorLabel = new VisLabel("File you selected was too sexy to import");
    errorLabel.setColor(Color.RED);
    addActor(errorLabel);
    errorLabel.getColor().a = 0;
    errorLabel.setTouchable(Touchable.disabled);
}

From source file:com.packtpub.libgdx.canyonbunny.screens.MenuScreen.java

License:Apache License

private Table buildOptWinDebug() {
    Table tbl = new Table();
    // + Title: "Debug"
    tbl.pad(10, 10, 0, 10);//from   w  w w.j a  v  a 2  s  . c o m
    tbl.add(new Label("Debug", skinLibgdx, "default-font", Color.RED)).colspan(3);
    tbl.row();
    tbl.columnDefaults(0).padRight(10);
    tbl.columnDefaults(1).padRight(10);
    // + Checkbox, "Show FPS Counter" label
    chkShowFpsCounter = new CheckBox("", skinLibgdx);
    tbl.add(new Label("Show FPS Counter", skinLibgdx));
    tbl.add(chkShowFpsCounter);
    tbl.row();
    return tbl;
}

From source file:com.paperscape.game.MenuManager.java

public void draw(SpriteBatch batch) {

    //DeltaTime is the time in-between frames - the state time is being added to the delta time - true means isLooping
    stateTime += Gdx.graphics.getDeltaTime();
    GameAssets.starCurrentFrame = GameAssets.starAnim.getKeyFrame(stateTime, true);
    GameAssets.flagCurrentFrame = GameAssets.flagAnim.getKeyFrame(stateTime, true);

    //draw the background sprite from GameAssets Class onto the SpriteBatch. This makes it visible on screen
    batch.draw(GameAssets.paperBackgroundSprite, 0, 0, GameAssets.screenResolutionX,
            GameAssets.screenResolutionY);

    //if there are any level levelSelectMenuButtons in a screen, draw them
    for (int i = 0; i < levelButtonCount; i++) {
        levelButtons[i].draw(batch);/*from  w  ww  .j a  v a  2s  .  com*/
    }

    //draw any levelSelectMenuButtons to the screen
    for (int i = 0; i < levelSelectMenuButtonCount; i++) {
        levelSelectMenuButtons[i].draw(batch);
    }

    //draw a back button to the screen
    for (int i = 0; i < backButtonCount; i++) {
        backButtons[i].draw(batch);
    }

    //draw any main buttons to the screen
    for (int i = 0; i < mainButtonCount; i++) {
        mainButtons[i].draw(batch);
    }

    //draw any sub buttons to the screen
    for (int i = 0; i < subButtonCount; i++) {
        subButtons[i].draw(batch);
    }

    //draw buttons to take user to credits screen
    for (int i = 0; i < creditsButtonCount; i++) {
        creditsButtons[i].draw(batch);
    }

    //draw any restart buttons to the screen
    for (int i = 0; i < restartButtonCount; i++) {
        restartButtons[i].draw(batch);
    }

    //find any toggle sound buttons if they exist
    for (int i = 0; i < toggleSoundButtonCount; i++) {

        //if the sound is currently turned on
        if (GameAssets.getToggleSoundState()) {
            //set the image of the toggle sound button to its 'on' image
            toggleSoundButtons[i].buttonImage = GameAssets.soundOnSprite;
        }
        //if the sound is not currently toggled on
        else if (!GameAssets.getToggleSoundState()) {
            //set the image of the toggle sound button to its 'off' image
            toggleSoundButtons[i].buttonImage = GameAssets.soundOffSprite;
        }

        //draw all of the toggle sound buttons to the batch
        toggleSoundButtons[i].draw(batch);
    }

    //draw any exit buttons to the screen
    for (int i = 0; i < exitButtonCount; i++) {
        exitButtons[i].draw(batch);
    }

    //draw all enemies to the screen
    for (int i = 0; i < newEnemyCount; i++) {
        newEnemies[i].draw(batch);
    }

    //draw any underlineFonts (includes underlines for titles etc.)
    for (int i = 0; i < underlineFontCount; i++) {
        underlineFonts[i].draw(batch);
    }

    //draw any stars to the screen
    for (int i = 0; i < starCount; i++) {
        stars[i].draw(batch);
    }

    //draw any exit flags present in a menu
    for (int i = 0; i < flagCount; i++) {
        flags[i].draw(batch);
    }

    //---------------------------------Extra Assets for Different Screens-------------------------------
    //check what screen to display
    switch (currentScreen) {

    //--------------------------------------------------------------------------------------------------
    case MAIN_MENU_SCREEN:

        //size of the chosen font
        GameAssets.fontRobotoRegular.getData().setScale(1f);
        GameAssets.fontRobotoRegular.draw(batch, "Paperscape", 420, 1050);

        for (int i = 0; i < mainButtonCount; i++) {
            GameAssets.fontRobotoThinBold.getData().setScale(0.9f);
            GameAssets.fontRobotoThinBold.draw(batch, "Start", mainButtons[0].buttonBounds.getX() + 128,
                    mainButtons[0].buttonBounds.getY() + 95);
        }

        for (int i = 0; i < exitButtonCount; i++) {
            GameAssets.fontRobotoThinBold.getData().setScale(.6f);
            GameAssets.fontRobotoThinBold.draw(batch, "Exit", exitButtons[i].buttonBounds.getX() + 100,
                    exitButtons[i].buttonBounds.getY() + 60);
        }

        for (int i = 0; i < creditsButtonCount; i++) {
            GameAssets.fontRobotoThinBold.getData().setScale(.45f);
            GameAssets.fontRobotoThinBold.draw(batch, "Credits", creditsButtons[i].buttonBounds.getX() + 13,
                    creditsButtons[i].buttonBounds.getY() + 75);
            GameAssets.fontRobotoThinBold.getData().setScale(.65f);
        }

        break;

    //--------------------------------------------------------------------------------------------------
    case LEVEL_SELECT_SCREEN:

        //size of the chosen font
        GameAssets.fontRobotoRegular.getData().setScale(1f);
        //drawing text to the screen
        GameAssets.fontRobotoRegular.draw(batch, "Level Select", 380, 225);
        //change font colour to white for levelSelectMenuButtons
        GameAssets.fontRobotoThinBold.setColor(Color.WHITE);
        //reduce the size of the font to fit on top of button
        GameAssets.fontRobotoThinBold.getData().setScale(.55f);
        //drawing the font for level numbers on level levelSelectMenuButtons
        //for loop to find each button
        for (int i = 0; i < levelButtonCount; i++) {
            //holds the text to display a level number
            String levelNumber;
            //level number is equal to 1 as arrays start at 0
            int j = 1;
            //level number is equal to 1 + array value
            j += i;
            //convert level number to a string
            levelNumber = Integer.toString(j);

            openLevelsTextPosition = new Vector2(levelButtons[i].buttonBounds.x + 35,
                    levelButtons[i].buttonBounds.y + 125);
            lockedLevelsTextPosition = new Vector2(levelButtons[i].buttonBounds.x + 35,
                    levelButtons[i].buttonBounds.y + 85);

            if (levelButtons[i].levelButtonValue <= GameAssets.getMaxLevelCompleted()) {

                //if the level button leads to a level that is less than level 10
                if (j < 10) {
                    //draw text on top of each button
                    GameAssets.fontRobotoThinBold.draw(batch, "Level 0" + levelNumber, openLevelsTextPosition.x,
                            openLevelsTextPosition.y);
                }

                //if the level button leads to a level between level 10 and level 100
                if (j >= 10 && j < 100) {
                    //draw text on top of each button
                    GameAssets.fontRobotoThinBold.draw(batch, "Level " + levelNumber, openLevelsTextPosition.x,
                            openLevelsTextPosition.y);
                }
            }
            //otherwise if the level that the button leads to is locked, draw the text in a different position
            else if (!(levelButtons[i].levelButtonValue <= GameAssets.getMaxLevelCompleted())) {
                //if the level button leads to a level that is less than level 10
                if (j < 10) {
                    //draw text on top of each button
                    GameAssets.fontRobotoThinBold.draw(batch, "Level 0" + levelNumber,
                            lockedLevelsTextPosition.x, lockedLevelsTextPosition.y);
                }
                //if the level button leads to a level between level 10 and level 100
                if (j >= 10 && j < 100) {
                    //draw text on top of each button
                    GameAssets.fontRobotoThinBold.draw(batch, "Level " + levelNumber,
                            lockedLevelsTextPosition.x, lockedLevelsTextPosition.y);
                }
            }

        }

        //change the font colour back to default black
        GameAssets.fontRobotoThinBold.setColor(Color.BLACK);
        //change the size of the font back to its original value
        GameAssets.fontRobotoThinBold.getData().setScale(.6f);

        break;

    //--------------------------------------------------------------------------------------------------
    case LEVEL_COMPLETE_SCREEN:

        //setting the size of the chosen font
        GameAssets.fontRobotoRegular.getData().setScale(.8f);
        GameAssets.fontRobotoRegular.draw(batch, "Level Complete", 430, 1042);
        GameAssets.fontRobotoRegular.getData().setScale(1f);

        //setting the size of the chosen font
        GameAssets.fontRobotoThinBold.getData().setScale(.6f);
        //displaying info about the total stars collected by interrogating the prefs file
        //draw to screen (SpriteBatch batch, String textToDisplay, int x, int y, int width, int textAlignment, boolean wrapText)
        GameAssets.fontRobotoThinBold.draw(batch,
                "Total Stars Collected: " + GameAssets.getTotalStarsCollected(),
                (GameAssets.screenBounds_right.getX() - 650), 350, 600, 1, true);

        break;

    //--------------------------------------------------------------------------------------------------
    case DEATH_SCREEN:

        GameAssets.fontRobotoRegular.setColor(Color.RED);
        //size of the chosen font
        GameAssets.fontRobotoRegular.getData().setScale(1f);
        GameAssets.fontRobotoRegular.draw(batch, "Captured!", 530, 1050);
        GameAssets.fontRobotoRegular.setColor(Color.BLACK);

        /*                GameAssets.fontRobotoThinBold.getData().setScale(.6f);
        GameAssets.fontRobotoThinBold.draw(batch, "Times Caught: " + GameAssets.getTotalDeaths(), 1220, 790);*/

        break;

    //--------------------------------------------------------------------------------------------------
    case CREDITS_SCREEN:
        GameAssets.fontRobotoRegular.getData().setScale(.75f);
        GameAssets.fontRobotoRegular.draw(batch, "Credits", GameAssets.screenBounds_right.getX() - 500,
                GameAssets.screenBounds_top.getY() - 40);
        GameAssets.fontRobotoRegular.getData().setScale(1);

        for (int i = 0; i < mainButtonCount; i++) {
            GameAssets.fontRobotoThinBold.draw(batch, "Back", mainButtons[0].buttonBounds.x + 135,
                    mainButtons[0].buttonBoundsYEnd - 40);
        }

        for (int i = 0; i < subButtonCount; i++) {
            GameAssets.fontRobotoThinBold.draw(batch, "Menu Music",
                    subButtons[0].buttonBounds.x + buttonTextWidth,
                    subButtons[0].buttonBoundsYEnd - buttonTextHeight);
            GameAssets.fontRobotoThinBold.draw(batch, "Level Music",
                    subButtons[1].buttonBounds.x + buttonTextWidth,
                    subButtons[1].buttonBoundsYEnd - buttonTextHeight);
            GameAssets.fontRobotoThinBold.draw(batch, "Goal Music",
                    subButtons[2].buttonBounds.x + (buttonTextWidth + 10),
                    subButtons[2].buttonBoundsYEnd - buttonTextHeight);
            GameAssets.fontRobotoThinBold.draw(batch, "Caught Music",
                    subButtons[3].buttonBounds.x + (buttonTextWidth - 20),
                    subButtons[3].buttonBoundsYEnd - buttonTextHeight);
        }

        GameAssets.fontRobotoThinBold.draw(batch, "Music:", GameAssets.screenBounds_left.getX() + 40,
                GameAssets.screenBounds_top.getY() - 60);
        GameAssets.fontRobotoThinBold.draw(batch, "Programming, Graphics & Sound Effects By:",
                GameAssets.screenBounds_left.getX() + 40, GameAssets.screenBounds_bottom.getY() + 100);

        GameAssets.fontRobotoThinBold.draw(batch, "Alex Clarke", GameAssets.screenBounds_right.getX() - 350,
                GameAssets.screenBounds_bottom.getY() + 85);

        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.trackTitle, infoTextX, infoTextY);
        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.trackArtist, infoTextX, infoTextY - 60);
        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.trackAlbum, infoTextX, infoTextY - 120);
        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.license, infoTextX, infoTextY - 180);
        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.licenseLink, infoTextX, infoTextY - 240);
        GameAssets.fontRobotoThinBold.draw(batch, GameAssets.changesMade, infoTextX, infoTextY - 300);

        break;
    }
}

From source file:com.prisonbreak.game.screens.GameScreen.java

public GameScreen(Game aGame) {
    game = aGame;//w  ww. j av  a  2 s  .c  om

    // import tiledMap
    map = new TmxMapLoader().load("tiledmap/map.tmx");
    mapRenderer = new MapControlRenderer(map); // create map-control renderer
    mapRenderer.setView(mapRenderer.getCamera()); // set camera using with the renderer

    // create new stage
    stage = new Stage(new ScreenViewport());

    // create label for displaying message, initialize to winning message
    label = new Label("CONGRATULATIONS\nYOU HAVE ESCAPED THE PRISON\nPress ESC to return to the Main Menu",
            PrisonBreakGame.gameSkin, "title-plain");
    label.setColor(Color.RED);
    label.setPosition(0, 0);
    label.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    label.setAlignment(Align.center);

    // create a Group container that contains the label and perform some actions
    labelContainer = new Group();
    labelContainer.addActor(label);
    labelContainer.setOrigin(label.getWidth() / 2, label.getHeight() / 2);
    stage.addActor(labelContainer);

    // initalize actions for winning state
    labelContainer.setScale(0);

    ParallelAction parallelAction = new ParallelAction();
    parallelAction.addAction(Actions.rotateBy(360, 2, Interpolation.smooth));
    parallelAction.addAction(Actions.scaleBy((float) 2, (float) 2, 3, Interpolation.smooth));
    parallelAction.addAction(Actions.fadeIn(1));

    labelContainer.addAction(parallelAction); // add actions to container

    executorService = Executors.newSingleThreadScheduledExecutor();
}

From source file:com.quadbits.gdxhelper.actors.AutomaticScrollingActor.java

License:Apache License

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);

    if (this.debug) {
        if (this.debugAccelMillis == 0) {
            return;
        }/*w  ww . j  av a2 s  .  com*/

        Color lineColor;
        if (this.debugBraking) {
            lineColor = Color.RED;
        } else {
            lineColor = Color.GREEN;
        }

        float lineLength = this.debugAccelMillis * this.debugLineLengthMultiplier;

        batch.end();

        this.shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        this.shapeRenderer.setColor(lineColor);
        float cx = Gdx.graphics.getWidth() / 2;
        float cy = Gdx.graphics.getHeight() / 2;
        this.shapeRenderer.line(cx, cy, cx, cy + lineLength);
        this.shapeRenderer.end();

        batch.begin();
    }
}

From source file:com.ray3k.skincomposer.dialog.DialogColorPicker.java

License:Open Source License

public DialogColorPicker(Main main, String style, ColorListener listener, Color previousColor) {
    super("", main.getSkin(), style);

    if (previousColor == null) {
        selectedColor = new Color(Color.RED);
    } else {// w  ww  .j  ava2 s .c om
        this.previousColor = new Color(previousColor);
        selectedColor = new Color(previousColor);
    }

    this.skin = main.getSkin();
    this.main = main;
    this.listener = listener;

    spinnerStyle = new Spinner.SpinnerStyle(skin.get("spinner-minus-h", Button.ButtonStyle.class),
            skin.get("spinner-plus-h", Button.ButtonStyle.class),
            skin.get("default", TextField.TextFieldStyle.class));

    gradientAlpha = new GradientDrawable(new Color(1.0f, 0, 0, 0), new Color(1.0f, 0, 0, 0), Color.RED,
            Color.RED);
    Vector3 v = rgbToHsb(selectedColor.r, selectedColor.g, selectedColor.b);
    Color temp = hsbToRgb(v.x * 360.0f, 1.0f, 1.0f);
    gradientS = new GradientDrawable(Color.WHITE, temp, temp, Color.WHITE);
    gradientB = new GradientDrawable(Color.BLACK, Color.BLACK, Color.CLEAR, Color.CLEAR);
    gradientSB = new StackedDrawable(gradientS, gradientB);

    hueGradient = new Array<>();
    hueGradient.add(new GradientDrawable(Color.MAGENTA, Color.MAGENTA, Color.RED, Color.RED));
    hueGradient.add(new GradientDrawable(Color.BLUE, Color.BLUE, Color.MAGENTA, Color.MAGENTA));
    hueGradient.add(new GradientDrawable(Color.CYAN, Color.CYAN, Color.BLUE, Color.BLUE));
    hueGradient.add(new GradientDrawable(Color.GREEN, Color.GREEN, Color.CYAN, Color.CYAN));
    hueGradient.add(new GradientDrawable(Color.YELLOW, Color.YELLOW, Color.GREEN, Color.GREEN));
    hueGradient.add(new GradientDrawable(Color.RED, Color.RED, Color.YELLOW, Color.YELLOW));

    Drawable tinted = ((TextureRegionDrawable) skin.getDrawable("white")).tint(Color.LIGHT_GRAY);
    checker = new CheckerDrawable(skin.getDrawable("white"), tinted, 10.0f, 10.0f);
    alphaStack = new StackedDrawable(checker, gradientAlpha);

    Table root = getContentTable();
    Label label = new Label("Choose a Color", skin, "title");
    label.setAlignment(Align.center);
    root.add(label).growX();

    root.row();
    content = new Table(skin);
    root.add(content);

    addListener(new InputListener() {
        @Override
        public boolean keyDown(InputEvent event, int keycode) {
            if (keycode == Keys.ESCAPE) {
                if (listener != null) {
                    listener.handle(new ColorListener.ColorEvent(null));
                }
                hide();
            }
            return false;
        }
    });

    populate();
}