Reputation: 2838
I want the Texture to set visible or not. So that I can show one texture when other is hidden or set false on visible.. how do I do it? In render method.
Something like:
Texture tex = new Texture(Gdx.files.internal("and.jpg");
tex.show or tex.hide
Or tell me a method to flip an image horizontally in render method..
Upvotes: 0
Views: 1826
Reputation: 5495
Make a texture region of it and flip it.
TextureRegion tr=new TextureRegion(tex);
tr.flip(true,false); // this will flip the textureregion only horizontally, write this code again to flip it back!
Now draw your texture region.
batch.draw(tr,x,y);
If you want to show and hide your texture create a boolean variable.
boolean showTextureRegion=true;
In your draw method will be like
if(showTextureRegion)
batch.draw(tr,x,y);
And to hide it just make the showTextureRegion true.
Upvotes: 1