11

I know that libgdx has this Button class that seems so easy to use, but I wonder why the draw method is set protected?

In that case, how should I draw the button?

Scene2d Button

Daahrien
  • 10,190
  • 6
  • 39
  • 71
Fugogugo
  • 4,460
  • 10
  • 36
  • 50

3 Answers3

14

Button is also an Actor. So you would put it on the Stage and the framework would draw it. Here is some more documentation on how this fits together.

CaseyB
  • 24,780
  • 14
  • 77
  • 112
7

I'm writing a libgdx tutorial for beginners. This post might be useful to you: libgdx Tutorial: scene2d

G. Steigert
  • 178
  • 3
  • 5
3

Button is an Actor, so it is used with Stage. There is official documentation for scene2d. Button is in scene2d.ui, which is a UI framework on top Stage, which is a general purpose 2D scene graph. There is no official documentation for scene2d.ui yet. You can see UITest though.

NateS
  • 5,751
  • 4
  • 49
  • 59
  • Now official documentation for scene2dui. https://code.google.com/p/libgdx/wiki/scene2dui – NateS Nov 22 '12 at 03:09