8

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?

Daahrien
  • 10,190
  • 6
  • 39
  • 71
Xerusial
  • 525
  • 1
  • 5
  • 17

2 Answers2

7

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.

James Skemp
  • 8,018
  • 9
  • 64
  • 107
maqjav
  • 2,310
  • 3
  • 23
  • 35
  • @Siggy1000 you could always write to the developers in their forum, they are pretty active and always answer ;), maybe you can give them some new ideas! – maqjav Jul 01 '13 at 08:28
  • Concerning this, I got pretty bad experiences, but it is worth a try ;) – Xerusial Jul 01 '13 at 09:14
6
new Image(new Texture(...)).getDrawable();
Tom
  • 16,842
  • 17
  • 45
  • 54
charles
  • 61
  • 1
  • 3