graphics - How can i set default skin in Libgdx? -


i created custom skin in assets class called skin1, write codes in other class

textbutton button1 = new textbutton("button1", assets.skin1);  textbutton button2 = new textbutton("button2", assets.skin1);  textbutton button3 = new textbutton("button3", assets.skin1);  ... 

and use assets.skin1 parameter in textbutton objects.
there set method setdefaultskintomygame(assets.skin1) set skin only 1 times?
want use only

textbutton button1 = new textbutton("button1"); 

and must use assets.skin1?

you can create own textbutton customized constructor:

public class skin1textbutton extends textbutton {     public skin1textbutton(string text) {         super(text, assets.skin1);     } } 

now code relieved specifying skin:

textbutton button1 = new skin1textbutton("button1");  textbutton button2 = new skin1textbutton("button2");  textbutton button3 = new skin1textbutton("button3");  

Comments