Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LibGDX texture to drawable?

Tags:

java

libgdx

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 ?

like image 813
IgnasR Avatar asked Aug 21 '15 16:08

IgnasR


1 Answers

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));
like image 158
tobloef Avatar answered Sep 20 '22 04:09

tobloef