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(TextureRegion region, float x, float y, float originX, float originY, float width,
        float height, float scaleX, float scaleY, float rotation, boolean clockwise);

Source Link

Document

Draws a rectangle with the texture coordinates rotated 90 degrees.

Usage

From source file:de.bitbrain.craft.graphics.UIRenderer.java

License:Open Source License

@Override
public void draw(Batch batch, float delta) {
    if (isOverlayMode() || overlay.getColor().a > 0) {
        batch.draw(buffer.getColorBufferTexture(), 0, 0, buffer.getWidth(), buffer.getHeight(), 0, 0,
                buffer.getWidth(), buffer.getHeight(), false, true);
        overlay.setBounds(0, 0, buffer.getWidth(), buffer.getHeight());
        overlay.draw(batch);/*  ww  w.j  av  a2 s .  com*/
    }
}

From source file:DungeonCleanerGame.CharacterPkg.Enemy.java

@Override
public void draw(Batch batch, float alpha) {

    texture = super.UpdateCharacter(Gdx.graphics.getDeltaTime());
    batch.draw(texture, body.getPosition().x - ((float) this.getWidth() / 2f),
            body.getPosition().y - ((float) this.getHeight() / 2f), this.getOriginX(), this.getOriginY(),
            this.getWidth(), this.getHeight(), this.getScaleX(), this.getScaleY(), this.getRotation(), false);

    if (bulletbody != null) {
        batch.draw(Bullet, bulletbody.getPosition().x - 0.07f, bulletbody.getPosition().y - 0.07f, 0.16f,
                0.16f);/*from  w ww .  j a  v  a2s .com*/
    }

}

From source file:DungeonCleanerGame.CharacterPkg.GameCharacter.java

@Override
public void draw(Batch batch, float alpha) {

    texture = UpdateCharacter(Gdx.graphics.getDeltaTime());
    batch.draw(texture, body.getPosition().x - ((float) this.getWidth() / 2f),
            body.getPosition().y - ((float) this.getHeight() / 2f), this.getOriginX(), this.getOriginY(),
            this.getWidth(), this.getHeight(), this.getScaleX(), this.getScaleY(), this.getRotation(), false);
}

From source file:es.eucm.ead.editor.view.drawables.TextureDrawable.java

License:Open Source License

@Override
public void draw(Batch batch, float x, float y, float width, float height) {
    if (texture != null) {
        if (region == null) {
            Vector2 fill = Scaling.fit.apply(width, height, texture.getWidth(), texture.getHeight());
            region = new Region((texture.getWidth() - fill.x) * .5f, (texture.getHeight() - fill.y) * .5f,
                    fill.x, fill.y);/*from   ww w  . java  2s .  co  m*/
        }

        batch.draw(texture, x, y, width, height, region.x, region.y, region.w, region.h, false, false);
    }
}

From source file:GameObjects.PrizeField.ProtectiveLayerParticle.java

public void draw(Batch batch, float parentAlpha) {
    if (isVisible) {
        //       batch.draw(sprite, getX(), getY(), getWidth(), getHeight());
        batch.draw(sprite, getX(), getY(), this.getWidth(), this.getHeight(), spriteXPos, spriteYPos,
                (int) this.getWidth(), (int) this.getHeight(), true, false);
    }//from  ww  w  .  ja v  a 2 s . co m
}

From source file:GameObjects.Scroll.java

public void draw(Batch batch, float parentAlpha) {
    //?  ,  ? ?  ????, ?  - 
    //   batch.draw(backSprite, getX(), getY(), getWidth(), getHeight());
    batch.draw(valueSprite, getX(), getY(), (float) (getWidth() * value), getHeight(), 0, 0,
            (int) (valueSprite.getWidth() * value), valueSprite.getHeight(), false, false);
}

From source file:GameWorld.Game.Objects.Ground.java

public void draw(Batch batch, float parentAlpha) {
    if (delete()) {
        batch.draw(groundTexture, getX() - getWidth() / 2, getY() - getHeight() / 2, getWidth(), getHeight(), 0,
                0, 64, 64, true, false);

    }/*from ww w  . j av  a2s. com*/
}

From source file:GameWorld.Game.Objects.Pinguin.java

private void drawPower(Batch batch) {
    batch.draw(AssetLoader.textureBtnNormal, getX() - getHeight(), getY() - getHeight() / 2, getHeight(),
            getWidth() * (getPower() / 100.0f), 0,
            (int) (AssetLoader.textureBtnNormal.getHeight() * (1.0f - getPower() / 100.0f)),
            (int) AssetLoader.textureBtnNormal.getWidth(),
            (int) (AssetLoader.textureBtnNormal.getHeight() * (getPower() / 100.0f)), false, false);
}