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?
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.
I'm writing a libgdx tutorial for beginners. This post might be useful to you: libgdx Tutorial: scene2d
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.