Search code examples
javalibgdx

LibGDX texture to drawable?


I got an issue and can't figure an solution for it, I'am making imagebutton and imagebutton has an option to set imageUp and atm I was getting the drawable like this:

redButton.imageUp = skin.getDrawable("LogoutIcon");

But I want to get drawable from assets folder .png file, that I could make button with more icons not overloading the packed texture size.

So the question, is there a way to make an drawable ? from texture, image ?


Solution

  • As far as I know there currently isn't an elegant way to do this. This is the easiest way I've found so far:

    someButtonStyle.imageUp = new TextureRegionDrawable(new TextureRegion(someTexture));