Apparently textButton.setScale()
is not working. Even when the scale is set to 0.1, the button is displayed in it's original size.
How to properly scale a TextButton in LibGdx? The official documentation doesn't provide any details.
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityA little late but to answer my own question, you have to setTransform(true)
if you're scaling a Button
or Table
. So in my case:
textButton.setTransform(true);
textButton.setScale(0.5f);
You should use a table to setup. Tables can be aligned and there cells sizes can change. You can do something like:
table.row();
table.add (tb).width (tb.width*scale);
What I did here is setting the cell with to the size of the table times a scale. You can set various variables on table cells. A table is a container widget and you have more of these. A button is a actor and best belongs to a container widget.
Sometimes tables and Scene2d work like a bitch and sometimes like a charm. Look them up in the document. I sent a link when not at my phone.
button.setWidth(button.getPrefWidth())
? \$\endgroup\$