Example usage for com.badlogic.gdx.graphics.g2d Batch draw

List of usage examples for com.badlogic.gdx.graphics.g2d Batch draw

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d Batch draw.

Prototype

public void draw(Texture texture, float x, float y, float width, float height, float u, float v, float u2,
        float v2);

Source Link

Document

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels.

Usage

From source file:broken.shotgun.throwthemoon.actors.MoonChain.java

License:Open Source License

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    batch.setColor(getColor());//  www.  ja va  2s  .c  o  m
    batch.draw(texture, getX(), getY(), // x, y
            getWidth(), // width
            getHeight(), // height
            1, 0, // u, v
            0, TILE_COUNT); // u2, v2
    batch.setColor(Color.WHITE);
}

From source file:com.strategames.engine.gameobject.types.WallVertical.java

License:Open Source License

@Override
public void draw(Batch batch, float parentAlpha) {
    Color color = getColor();/*from w  w  w .  j  a  v a2 s.c o m*/
    batch.setColor(color);
    batch.draw(this.textures.bricksVertical, getX(), getY(), WIDTH, getLength(), 0, 0, -1, this.amountOfParts);
}

From source file:mobi.shad.s3lib.gfx.effect.Copper.java

License:Apache License

/**
 * Drawing bar//from  w  ww. j  ava 2s  .  com
 *
 * @param batch
 * @param parentAlpha
 */
@Override
public void render(Batch batch, float parentAlpha) {

    int offset, i;
    for (i = 0, offset = 0; i < count; ++i, offset = offset + 4) {
        batch.draw(copperTexture, positionBuffer[offset], positionBuffer[offset + 1],
                positionBuffer[offset + 2], positionBuffer[offset + 3], coordsBuffer[offset],
                coordsBuffer[offset + 1], coordsBuffer[offset + 2], coordsBuffer[offset + 3]);
    }

}

From source file:mobi.shad.s3lib.gfx.effect.Grid.java

License:Apache License

/**
 *
 * @param batch//from  w  w w.j  a  v  a2 s .  com
 * @param parentAlpha
 */
@Override
public void render(Batch batch, float parentAlpha) {
    int countDraw = gridX * gridY;
    for (int i = 0, idx = 0; i < countDraw; ++i, idx = idx + 8) {
        batch.draw(texture.getTexture(), positions[idx], positions[idx + 1], positions[idx + 2],
                positions[idx + 3], positions[idx + 4], positions[idx + 5], positions[idx + 6],
                positions[idx + 7]);
    }
}