Retera / WarsmashModEngine

An emulation engine to improve Warcraft III modding
GNU Affero General Public License v3.0
192 stars 37 forks source link

Regression in map selection UI on 4K monitors #26

Closed Retera closed 1 year ago

Retera commented 1 year ago

@bearU369 I noticed that when playing on the big screen after the MapListBoxFrame changes, the icon size is set to 32 pixels instead of a monitor independent converted value

Below is a before/after comparison.

Before: image

After: image

In premise I think this might be really easy to fix -- basically instead of the static mapIconSize = 32.0f in the MapListBoxFrame instead the height of the rows could be based on a GameUI.convertY(...) call or something like that. Also, I figured it might be possible that the dyanmic ListBoxFrame changes might be smart enough to handle this case anyway when we get there, although I have not yet extensively read through that.

bearU369 commented 1 year ago

Oh wow, this is not something I would come across with my 1080p monitor.

My attempt is by doing mapIconSize = GameUI.convertY(viewport, 1/48f) and getting rid of numStringSize to just get the numStringFrames with mapIconSize. 1/48f is the closest I can get back to normal as with 1/32f just largens the icons. I personally like how 1/64f ended up with while I'm testing these. image

This is my solution to this attempt though there's no way for me to verify this since I don't have a 4k monitor to replicate this bug.

Edit: It may be bit unnecessary to remove numStringSize assuming if font sizes are already monitor-independent, my bad for the force commit.

Retera commented 1 year ago

If it helps, it is possible to compute the exact value to use so that the appearance remains the same on a 1080p monitor. The convertX and convertY functions are designed to support the old FDF files which are on a scale where x=0, y=0 is the lower left hand corner of the 4:3 resolution area and the upper right hand corner is x=0.8, y=0.6 probably because these old games in 2002 were played on an 800 by 600 monitor. So, using that same math, if you want the height of the row to be 32 pixels on a 1920x1080 monitor, we could compute (32/1080)*0.6 as the value to pass to convertY(...) and I would imagine it should go back to looking exactly as it was on your monitor but now look the same even on a 4K monitor.

It does kind of make me wonder where or what the number was coming from on the Warcraft 3 Blizzard game, though.

Edit: And like you said, we have: 1/64=0.015625 (32/1080)*0.6=0.0177777778

So visually either one is going to be very similar in size

bearU369 commented 1 year ago

Thanks, your math helps getting the more specific size for the icon.

Retera commented 1 year ago

I merged the PR for this. Maybe one way to test different resolutions in the future if it helps could be to try lower resolutions on your monitor, too.

Either way, thanks for the fix!