简体   繁体   English

LibGDX初始化Drawable

[英]LibGDX initialize Drawable

This is a Question for those who are familiar with the new LibGDX 0.98. 对于那些熟悉新LibGDX 0.98的人来说,这是一个问题。 I'm not quite sure, how to use a Drawable in the Scene2d package. 我不太确定,如何在Scene2d包中使用Drawable。 My current code for using a ".png" as a Background for various classes looks like this: 我目前使用“.png”作为各种类的背景的代码如下所示:

new TextureRegionDrawable(new TextureRegion(new Texture("data/splitpane.png")));

Is there any easyer way to use a ".png" as Drawable than with these 3 classes? 有没有比这3个类更容易使用“.png”作为Drawable的方法?

Reading the API we can see that there aren't more options to draw an image as you want. 阅读API,我们可以看到没有更多选项可以根据需要绘制图像。

libGDX makes things a lot easier, but you have to think that in the background of this library there are lots of OpenGL complex logic that cannot be simplified more than these functions actually do. libGDX使事情变得更容易,但你必须认为在这个库的背景中有许多OpenGL复杂逻辑,这些逻辑不能比这些函数实际做的更简单。

Here I leave a link to the wiki of libGDX where they explain with examples some of the functions in Scene2d package. 在这里,我给libGDX的wiki留下了一个链接 ,他们用示例解释了Scene2d包中的一些函数。 Maybe this could be useful. 也许这可能有用。

new Image(new Texture(...)).getDrawable();

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

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