Xyz3R
Xyz3R

Reputation: 1074

SpriteBatch.draw libgdx shows nothing

I am trying to display a simple image in my program, but the function does not showing anything! The Code with some comments speaks for itself:

public void draw(SpriteBatch batch, float parentAlpha){
    batch.draw(plane, this.getX(), this.getY(), this.getWidth()/2, this.getHeight()/2, this.getWidth(), this.getHeight(), 0, 0,
            this.getRotation(), 0 , 0, plane.getWidth(), plane.getHeight(), false, false); //shows nothing
    //batch.draw(texture, x, y, originX, originY, width, height, scaleX, scaleY, rotation, srcX, srcY, srcWidth, srcHeight, flipX, flipY)
    batch.draw(plane, this.getX(), this.getY()); //shows the image at x, y (0, 0)
    //batch.draw(texture, x, y)
}

I hope you understand my problem. Thanks for your help

Upvotes: 0

Views: 461

Answers (1)

DannyMo
DannyMo

Reputation: 11984

I'm pretty sure the issue is that you're passing 0 for scaleX and scaleY. To draw the image at it's normal size, pass 1 instead.

Without any more information, this is the only thing that jumps out at me.

Upvotes: 3

Related Questions