Skip to content

Fix: improve appearance of toolbars and main menu images/text#15402

Merged
PeterN merged 3 commits intoOpenTTD:masterfrom
PeterN:menu-square-images
Mar 31, 2026
Merged

Fix: improve appearance of toolbars and main menu images/text#15402
PeterN merged 3 commits intoOpenTTD:masterfrom
PeterN:menu-square-images

Conversation

@PeterN
Copy link
Copy Markdown
Member

@PeterN PeterN commented Mar 26, 2026

Motivation / Problem

The images used on the main menu are highly dependent on the baseset used, and currently rely on all images being the same size.

This unfortunately doesn't hold for all basesets, most notably the original TTD baseset, and this results in the text of the main menu not being aligned neatly.

Part of the issue is that the method to set button size relative to toolbar button sizes uses a hardcoded pixel size value, which may not actually match the loaded baseset.

This is noticeable when using a graphics set such as "aBase" or "biggui", which use larger than intended toolbar icons, but only for some toolbar icons, resulting in a weird mix of sizes.

ttdmenubefore abasemenubefore abasetoolbarbefore

Description

These issues are resolved by making toolbar-button-sizes relative to the largest normal toolbar icon, instead of the hardcoded 20 pixels, and then forcing the image part of image-text buttons to be square, based on toolbar button sizing.

This is not 100% ideal for image-text buttons, but there are currently no other users of this widget type so it's mostly fine.

It's still not really recommended to use larger icons than designed, as it will always cause inconsistency with NewGRF addons which are generally designed for the default button size.

ttdmenuafter abasemenuafter abasetoolbarafter

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

PeterN added 3 commits March 26, 2026 21:26
Reduces duplication in SetMinimalSize / SetMinimalTextLines
… hardcoded value

This improves appearance with basesets that use a different sprite size for toolbar icons.
…ensions

Fixes appearance with original basesets
@PeterN PeterN force-pushed the menu-square-images branch from 6bb771d to c65bf82 Compare March 26, 2026 21:59
@PeterN PeterN merged commit 423bf8d into OpenTTD:master Mar 31, 2026
18 checks passed
@PeterN PeterN deleted the menu-square-images branch March 31, 2026 11:20
@PeterN PeterN added the backport requested This PR should be backport to current release (RC / stable) label Apr 3, 2026
@PeterN PeterN added backported This PR is backported to a current release (RC / stable) and removed backport requested This PR should be backport to current release (RC / stable) labels Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported This PR is backported to a current release (RC / stable)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants