简体   繁体   中英

Flipping a Texture in Libgdx Java

I am trying to figure out how to flip a Texture in libgdx using Java. I can't find any methods of doing this and I can't just do some code to flip the Texture itself. Is there any way that I can flip the texture some way in libgdx?

You can make a Sprite object and when you initialize it, you can pass in the Texture object. Then you can call methods such as rotate, flip, etc. Here is a code example

    Texture tex = new Texture("path");
    Sprite sprite = new Sprite(tex);
    sprite.flip(true, false);

true as the first parameter for flipping over x-axis and false for y-axis, which is what you are looking for in your specific example.

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