MovingBlocks
DestSol - Button width based on text length
On the DestinationSol:uiOverhaul branch, buttons do not adjust to the length of the text in them, producing some funny results. The ship selection screen is a prime example of this. Your job is to make buttons adjust to the text inside of them (and some padding on either side).
Definition of 'Done'
- Individual buttons adjust their
width
based on the text in them - Button lists adjust all buttons in the list to match the longest button
- A helper function created in either
CommonDrawer
orUiDrawer
that calculates the length of a given string. Use this function inUiTextButton
. - A Pull Request submitted against the DestinationSol:uiOverhaul branch with your changes in it
Where to Start
UiTextButton
has a method calledsetDisplayName
where the text in the button is setCommonDrawer
loads the fontUiVerticalListLayout
is the class for lists of buttonsUiTextButton.BUTTON_PADDING
is the constant for the padding from text to button edge; use it on both sides of the button
See Also
- Join our discord to talk to us in chat and get help fast: https://discord.gg/Terasology
Task tags
Students who completed this task
AndyTechGuy, BSA