简体   繁体   English

LibGDX纹理可绘制吗?

[英]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: 我遇到一个问题,无法解决,我正在制作imagebutton,并且imagebutton有一个选项可以设置imageUp和atm,我得到的是这样的drawable:

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. 但是我想从资产文件夹.png文件中获取可绘制的图像,这样我就可以使带有更多图标的按钮不会过载打包的纹理大小。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM