Adventure Game Studio

AGS Development => Editor Development => Topic started by: Dave Gilbert on Tue 08/10/2024 20:26:55

Title: [FEATURE REQUEST] Word-wrap for buttons
Post by: Dave Gilbert on Tue 08/10/2024 20:26:55
Currently, the text on buttons doesn't word wrap. If I want to wordwrap text on a button, I have to use a text label and place it on top of the button. Normally, no big deal. But this can be a bit annoying when I want to add a lot of buttons like this:

(https://www.wadjeteyegames.com/temp/buttonwrap.png)

For each of those buttons, I had to create individual text labels and place them on top of each button. Very time consuming and a bit of a faff to keep track of which label is on top of which button. If the text on the button could word-wrap, that would save a lot of time and effort.

Thanks!

-Dave
Title: Re: [FEATURE REQUEST] Word-wrap for buttons
Post by: Crimson Wizard on Tue 08/10/2024 23:34:15
I suppose this could be done.
I'd probably add a gui control flag which tells whether wrap text or not for backwards compatibility, and in case someone wants strictly non-wrapped text (e.g. if they worry that it gets unexpectedly wrapped after translation).
Title: Re: [FEATURE REQUEST] Word-wrap for buttons
Post by: eri0o on Tue 08/10/2024 23:45:43
I created an issue just to track this here: https://github.com/adventuregamestudio/ags/issues/2546
Title: Re: [FEATURE REQUEST] Word-wrap for buttons
Post by: Dave Gilbert on Wed 09/10/2024 00:34:32
Ooh thank you!
Title: Re: [FEATURE REQUEST] Word-wrap for buttons
Post by: Crimson Wizard on Wed 09/10/2024 01:23:35
Well, I sort of made it:
https://github.com/adventuregamestudio/ags/pull/2547

but this needs more testing.
Title: Re: [FEATURE REQUEST] Word-wrap for buttons
Post by: Crimson Wizard on Wed 09/10/2024 19:15:40
Here's a test build (based on 3.6.2 Beta release):
https://cirrus-ci.com/task/6557944643321856

Added following:
- Labels have full TextAlignment selection (includes vertical alignment)
- Buttons have WrapText property
- Buttons have TextHorizontalPadding and TextVerticalPadding properties.
Title: Re: [FEATURE REQUEST] Word-wrap for buttons
Post by: Crimson Wizard on Thu 10/10/2024 15:39:35
Which kind of naming seems better:

- TextHorizontalPadding, TextVerticalPadding

or

- TextPaddingHorizontal, TextPaddingVertical

?
Title: Re: [FEATURE REQUEST] Word-wrap for buttons
Post by: RootBound on Thu 10/10/2024 16:08:22
Quote from: Crimson Wizard on Thu 10/10/2024 15:39:35Which kind of naming seems better:

- TextHorizontalPadding, TextVerticalPadding

or

- TextPaddingHorizontal, TextPaddingVertical

?

I'd prefer the second version, since that would make both properties show up together in the list if this is called from the script API.