Question

This is a Question for those who are familiar with the new LibGDX 0.98. I'm not quite sure, how to use a Drawable in the Scene2d package. My current code for using a ".png" as a Background for various classes looks like this:

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?

Was it helpful?

Solution

Reading the API we can see that there aren't more options to draw an image as you want.

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.

Here I leave a link to the wiki of libGDX where they explain with examples some of the functions in Scene2d package. Maybe this could be useful.

OTHER TIPS

new Image(new Texture(...)).getDrawable();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top