Java – Draw All Texture Flips?

Draw All Texture Flips?… here is a solution to the problem.

Draw All Texture Flips?

First, I couldn’t fit into the inverted Y axis due to my XNA background. So in LibGDX, I flipped the OrthographicCamera with cam.setToOrtho(true, width, height), but this obviously ended up turning all my textures upside down.

I can create sprites and TextureRegions from all my textures to flip each of them, but that requires a lot of extra code. So is there an effective way to make all my textures flip around the center?

I tried adding the flip matrix to the spritebatch transformMatrix, but this unflipped the orthogonal cam. I also tried creating a sprite to paint all my textures and flip them, but without success.

Solution

You can just use flip , like this.

textureRegion.flip(false, true);

For each TextureRegion you have.

Since sprites extend TextureRegions, this should also apply to them

Related Problems and Solutions