Android : LibGDX button -
how can create libgdx button , set touch listener it?i want create main menu of game , put 3 buttons there (play,settings,about).i tried sprite
how saw sprite
doesnt have touch listener.
you can use stage
, button
class, this:
button btn = new button(new spritedrawable(youridlesprite), new spritedrawable(yourpressedsprite)); btn.addlistener(new clicklistener() { public void clicked(inputevent event, float x, float y) { //your code } }); stage stage= new stage(); stage.addactor(btn);
there lots of ways create own button class, can find lot of examples in official documentation -> https://github.com/libgdx/libgdx/wiki
Comments
Post a Comment