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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -