简体   繁体   中英

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 ?

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

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