-
Notifications
You must be signed in to change notification settings - Fork 382
[WIP] UI scale #3159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[WIP] UI scale #3159
Conversation
3f4d228 to
1aceaa1
Compare
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
Include fix for line width
Was redundant to UIResizable code.
Add the ability to specify flags when loading a bitmap. This is needed because linear scaling causes artifacts at the border where the face is composed of multiple images.
CorsixTH/Src/th_lua_gfx.cpp
Outdated
| #include FT_TYPES_H | ||
|
|
||
| namespace { | ||
| uint32_t flags_from_table(lua_State* L, int index) { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
Fonts and graphics need to be reloaded when the flags changed.
Fixes #1210
...