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:vault.clockwork.controllers.EditorController.java

License:Open Source License

/**
 * Draw the editor elements.//  www  .  jav a  2s  .  c  o  m
 * @param batch
 */
public void draw(SpriteBatch batch) {
    // draw editor simple shapes
    gizmo.begin(ShapeRenderer.ShapeType.Line);

    // draw-up the editor props
    for (PropSerialized prop : propHolder.props) {
        // draw-up the prop bounds
        prop.draw(gizmo);

        // draw the prop indicator
        if (nearly == prop || selected == prop) {
            gizmo.setColor(Color.RED);
        } else {
            gizmo.setColor(Color.PINK);
        }
        gizmo.circle(prop.position.x, prop.position.y, 16.f);
    }
    gizmo.end();

    // draw-up the props names
    batch.setProjectionMatrix(Game.mainCamera.combined);
    batch.begin();
    font.setScale(Game.mainCamera.zoom);
    for (PropSerialized prop : propHolder.props) {
        // fetch for prop name
        String name = prop.getClass().getSimpleName() + ": " + prop.id;

        // layer name
        switch (prop.layer) {
        case 1:
            name += " (ACTION_1)";
            break;
        case 2:
            name += " (ACTION_2)";
            break;
        case 3:
            name += " (ACTION_3)";
            break;
        case 4:
            name += " (FOREGROUND)";
            break;
        case 5:
            name += " (GUI)";
            break;
        case 6:
            name += " (DEBUG)";
            break;
        default:
            name += " (BACKGROUND)";
        }

        // text bounds
        BitmapFont.TextBounds bounds = font.getBounds(name);

        // draw-up the prop name
        if (selected == prop) {
            font.setColor(Color.RED);
        } else {
            font.setColor(Color.WHITE);
        }
        font.draw(batch, name, prop.position.x - bounds.width / 2, prop.position.y + bounds.height + 24.f);
    }
    font.setScale(1);
    batch.end();
}

From source file:vault.clockwork.editor.gui.GUIFieldElement.java

License:Open Source License

/**
 * Draw the field input./*  www.  j  av a  2 s .co m*/
 * @param shape
 * @param batch 
 */
@Override
public void draw(ShapeRenderer shape, SpriteBatch batch) {
    text = value + (focused && ticks % 20 > 10 ? "|" : "");

    if (focused) {
        ticks++;
    }

    // calculate label text bounds
    Rectangle bounds = getBounds();

    // enable alpha channel usage
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    // draw the shape
    shape.begin(ShapeRenderer.ShapeType.Filled);
    shape.setColor(0, 0, 0, .5f);
    shape.rect(bounds.x - 2, bounds.y - 2, bounds.width + 4, bounds.height + 4);
    shape.end();

    // draw the label
    batch.begin();
    {
        font.setColor(!focused ? (overed ? Color.PINK : Color.WHITE) : Color.RED);
        font.draw(batch, field.getName() + ": " + text, bounds.x, bounds.y + bounds.height);
    }
    batch.end();
}

From source file:vault.clockwork.editor.gui.GUILabelElement.java

License:Open Source License

/**
 * Draw the label.//www  .  jav  a  2 s.c  o m
 * @param shape
 * @param batch 
 */
@Override
public void draw(ShapeRenderer shape, SpriteBatch batch) {
    // calculate label text bounds
    Rectangle bounds = getBounds();

    // enable alpha channel usage
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    // draw the shape
    shape.begin(ShapeRenderer.ShapeType.Filled);
    shape.setColor(0, 0, 0, .5f);
    shape.rect(bounds.x - 2, bounds.y - 2, bounds.width + 4, bounds.height + 4);
    shape.end();

    // draw the label
    batch.begin();
    {
        font.setColor(!focused ? (overed ? Color.PINK : Color.WHITE) : Color.RED);
        font.draw(batch, text, bounds.x, bounds.y + bounds.height);
    }
    batch.end();
}

From source file:vault.q_bounce.controllers.EditorController.java

License:Open Source License

/**
 * Draw the editor elements./*from  ww  w.j a va  2  s  . co m*/
 * @param batch
 */
public void draw(SpriteBatch batch) {
    // draw editor simple shapes
    gizmo.begin(ShapeRenderer.ShapeType.Line);

    // draw-up the editor props
    for (PropSerialized prop : propHolder.props) {
        // draw-up the prop bounds
        prop.draw(gizmo);

        // draw the prop indicator
        if (nearly == prop || selected == prop) {
            gizmo.setColor(Color.RED);
        } else {
            gizmo.setColor(Color.PINK);
        }
        gizmo.circle(prop.position.x, prop.position.y, 16.f);
    }
    gizmo.end();

    // draw-up the props names
    batch.begin();
    font.setColor(Color.WHITE);
    font.setScale(Game.mainCamera.zoom);
    for (PropSerialized prop : propHolder.props) {
        // fetch for prop name
        String name = prop.getClass().getSimpleName() + ": " + prop.id;

        // layer name
        switch (prop.layer) {
        case 1:
            name += " (ACTION_1)";
            break;
        case 2:
            name += " (ACTION_2)";
            break;
        case 3:
            name += " (ACTION_3)";
            break;
        case 4:
            name += " (FOREGROUND)";
            break;
        case 5:
            name += " (GUI)";
            break;
        case 6:
            name += " (DEBUG)";
            break;
        default:
            name += " (BACKGROUND)";
        }

        // text bounds
        BitmapFont.TextBounds bounds = font.getBounds(name);

        // draw-up the prop name
        font.draw(batch, name, prop.position.x - bounds.width / 2, prop.position.y + bounds.height + 24.f);
    }
    font.setScale(1);
    batch.end();
}

From source file:vault.q_bounce.editor.props.BounceProp.java

License:Open Source License

/**
 * Draw the turret radius as bounds.//  w  ww .  j a  v a2  s.  com
 * @param gizmo 
 */
@Override
public void draw(ShapeRenderer gizmo) {
    gizmo.setColor(Color.RED);
    gizmo.circle(position.x, position.y, radius);
}

From source file:vault.q_bounce.screens.LoaderScreen.java

License:Open Source License

@Override
public void show() {
    machineTexture = new Texture(Gdx.files.internal("assets/load.png"));
    TextureRegion[][] tmp = TextureRegion.split(machineTexture, machineTexture.getWidth() / FRAME_COLS,
            machineTexture.getHeight() / FRAME_ROWS); // #10
    ballguy = new TextureRegion[FRAME_COLS * FRAME_ROWS];
    int index = 0;
    for (int i = 0; i < FRAME_ROWS; i++) {
        for (int j = 0; j < FRAME_COLS; j++) {
            ballguy[index++] = tmp[i][j];
        }//from w ww . java  2s  . c o  m
    }
    animation = new Animation(0.04f, ballguy);
    spriteBatch = new SpriteBatch();

    sound = Gdx.audio.newSound(Gdx.files.internal("assets/sound/menuloop.wav"));
    long idsound = sound.play(1.0f);
    sound.setLooping(idsound, true);

    spriteBatch = new SpriteBatch();
    font = new BitmapFont();
    font.setColor(Color.RED);

    if (this.clearAssets) {
        Game.assets.clear();
    }

    // prepare next screen to load
    if (this.next != null) {
        this.next.prepare();
    }
}

From source file:YOGOSec.core.gui.Button.java

License:LGPL

public Button(Rectanglef bounds, String text, IActionListener listener) {
    super(bounds);
    this.text = text;
    this.listener = listener;

    this.pixmap = new YUpPixmap(Game.INSTANCE.getRender().getWidth(), Game.INSTANCE.getRender().getHeight(),
            Pixmap.Format.RGBA8888);

    pixmap.setColor(Color.RED);
    pixmap.fillRectangle(this.bounds.getX().intValue(), this.bounds.getY().intValue(),
            this.bounds.getWidth().intValue(), this.bounds.getHeight().intValue());
    pixmap.setColor(Color.BLACK);
    Gdx.app.log("YOGOSec", "Created button: " + this.bounds);
    this.texture = new Texture(this.pixmap);
}

From source file:YOGOSec.core.gui.Button.java

License:LGPL

@Override
public void onGUIResized(int width, int height) {
    super.onGUIResized(width, height);
    this.pixmap.dispose();
    this.pixmap = new YUpPixmap(width, height, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.RED);
    pixmap.fillRectangle(this.bounds.getX().intValue(), this.bounds.getY().intValue(),
            this.bounds.getWidth().intValue(), this.bounds.getHeight().intValue());
    pixmap.setColor(Color.BLACK);
}