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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With