简体   繁体   中英

Libgdx batch draw invisible texture

I have the following code:

batch.draw(this.getTexture(), getX(), getY(), getOriginX(), getOriginY(),
                getWidth(), getHeight(), 1, 1, this.getRotation(),
                getRegionX(), getRegionY(), getRegionWidth(), getRegionHeight(),
                false, false);

which should the texture, it is definitely not null, however it's invisible.

Because it is drawing the player i don't think it is outside of the view.

Your regionWidth and regionHeight may be 0 . Try the code below

batch.draw(this.getTexture(), getX(), getY(), getOriginX(), getOriginY(), 
    getWidth(), getHeight(), 1, 1, this.getRotation(), 
    getRegionX(),getRegionY(), getWidth(), getHeight(), false, false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM