android - Resize text in Textbutton -
helo guys! i'm trying set size of text in textbutton using libgdx , scene2d.
here's how create , initialize textbutton object:
skin skin = new skin(); skin.add("white", new texture(gdx.files.internal("data/texture.jpg"))); skin.add("default", new bitmapfont()); textbutton.textbuttonstyle textbuttonstyle = new textbutton.textbuttonstyle(); textbuttonstyle.up = skin.newdrawable("white"); textbuttonstyle.down = skin.newdrawable("white", color.dark_gray); textbuttonstyle.checked = skin.newdrawable("white", color.blue); textbuttonstyle.over = skin.newdrawable("white", color.light_gray); textbuttonstyle.font = skin.getfont("default"); skin.add("default", textbuttonstyle); textbutton newgame = new textbutton("hello button",skin);
after button text in created perfectly, don't understand how can change it's text size.
i've tried every method of label object:
newgame.getlabel().setscale(10); newgame.getlabel().setwidth(100);
and on. question is: how can change text size in textbutton?
try changing size of font scaling. textbuttonstyle.font.setscale(..)
id recommend take @ freetypefontgenerator
can create fonts in different sizes without scaling, out of regular .tff
files.
Comments
Post a Comment