java - Libgdx How to implement list of checked buttons? -
how can implement list of horizontally aligned buttons in 1 button can checked @ moment? wanted implement game in have select tool list , click on object perform action. want highlight button represents current tool , when choose 1 return previous 1 non-highlighted state , 1 has been chosen highlighted state. there can 1 tool active @ given moment , after used tool , didn't select else there should no highlighted button. tried past 2 days implemented myself couldn't it. thought maybe there in libgdx scene2d didn't find anything. or advice appreciated.
sounds job buttongroup. i'm surprised didn't show after basic google search.
see answer here: libgdx: make actors on stage unchecked
//initalize stage , buttons buttongroup buttongroup = new buttongroup(button1, button2, button3, etc...) //next set max , min amount checked buttongroup.setmaxcheckcount(1); buttongroup.setmincheckcount(0); //it may useful use method: setunchecklast(true); //if true, when maximum number of buttons checked , additional button checked, last button checked unchecked maximum not exceeded.
Comments
Post a Comment