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 or UiDrawer that calculates the length of a given string. Use this function in UiTextButton.
  • A Pull Request submitted against the DestinationSol:uiOverhaul branch with your changes in it

Where to Start

  • UiTextButton has a method called setDisplayName where the text in the button is set
  • CommonDrawer loads the font
  • UiVerticalListLayout is the class for lists of buttons
  • UiTextButton.BUTTON_PADDING is the constant for the padding from text to button edge; use it on both sides of the button

See Also

Task tags

  • destinationsol
  • code
  • ui
  • destsol

Students who completed this task

AndyTechGuy, BSA

Task type

  • code Code
  • web Design
close

2018