IgnasR
IgnasR

Reputation: 184

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 ?

Upvotes: 8

Views: 8266

Answers (1)

tobloef
tobloef

Reputation: 1891

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));

Upvotes: 32

Related Questions