8000 [WIP] UI scale by TheCycoONE · Pull Request #3159 · CorsixTH/CorsixTH · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@TheCycoONE
Copy link
Member
@TheCycoONE TheCycoONE commented Dec 3, 2025

Fixes #1210

  • scale ui config
  • in game option to choose the scale
  • clear text using nearest scaling
  • high-dpi text (scale ttf without canvas:scale)
  • scale sprites independently (without canvas:scale)
  • working scaled select theme hospital screen
  • working scaled map editor (seems to lose the scale)
  • working zoom (to cursor)
  • dragging windows
  • reactive settings (respond immediately to ui scale) - alternately force reset.
  • information window
  • re-scale on load save game
  • tooltips
  • file browser
  • annual report
  • bank manager
  • drug casebook
  • fax
  • graphs
  • hospital policy
  • progress report
  • research policy
  • staff management
  • town map
  • call dispatcher
  • cheats
  • customise
  • directory browser
  • folder settings
  • hotkey assign
  • lua console
  • machine menu
  • main menu
  • map editor
  • menu list
  • new game
  • options
  • sound settings
  • tip of the day
  • update
  • advisor
  • bottom panel
  • build room
  • confirm dialog
  • edit room
  • furnish corridor
  • hire staff
  • information
  • jukebox
  • machine dialog
  • (top) menu
  • fax message
  • patient
  • place object
  • queue
  • staff
  • staff raise
  • watch
    ...
image

@ARGAMX ARGAMX added the PR:Feature PR adds a new or missing feature to the game. label Dec 3, 2025
@TheCycoONE TheCycoONE force-pushed the ui_scale branch 2 times, most recently from 3f4d228 to 1aceaa1 Compare December 7, 2025 04:31
Currently this is quite blurry, and the pick hospital screen is broken.
When the cursor isn't drawn, e.g. the choose theme hospital directory
screen, it was in completely the wrong position. This fixes that by
compensating the cursor position.

There are still some gaps in game_ui, but the main menu and settings
screens are working well.
Scale panel sprites because that can't be helped.

Scale UIResizable, buttons, and panels

Scale some text drawing - though I will likely replace that with a draw argument later.
Use scale factor instead of canvas scale for window label text.

The visual difference with TTF fonts is very clear. Yey HiDPI.
Use that instead of canvas:scale for panel sprites
Instead of storing the scaled height and width as state store whether
the Window / Panel is using scale independent pixels. If so perform the
adjustment in the draw/hitTest functions.

The goal is to avoid mixing scale information into the save state in
ways that will be hard to deal with.

Some regression here, mainly tooltips are not functioning
Improve hit tests / hover
6855
#include FT_TYPES_H

namespace {
uint32_t flags_from_table(lua_State* L, int index) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you aware that the draw flags also exist as named constants in Lua?

Lua/utility.lua
217:DrawFlags = {}
218:DrawFlags.FlipHorizontal  = 2^0
219:DrawFlags.FlipVertical    = 2^1
220:DrawFlags.Alpha50         = 2^2
221:DrawFlags.Alpha75         = 2^3
222:DrawFlags.AltPalette      = 2^4
223:DrawFlags.EarlyList       = 2^10
224:DrawFlags.ListBottom      = 2^11
225:DrawFlags.BoundBoxHitTest = 2^12
226:DrawFlags.Crop            = 2^13

utility also has a number of bit operation functions (flag_* functions around lines 190-210, and two more around lines 295-310)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't, I'll switch to using those and add the missing flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR:Feature PR adds a new or missing feature to the game.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integer-based UI scaling
37A8

3 participants

0