-
Notifications
You must be signed in to change notification settings - Fork 81
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
Implement UI scaling in Derma UIs #1719
base: master
Are you sure you want to change the base?
Conversation
AdvancedText still doesn't do scaling correctly... DermaDefault doesn't render *at all* under it. Maybe it's *just* DermaDefault?
Wow, you're really doing the heavy lifting here. I'm impressed. Another point on my todo list I thought I'd never get around to.
This addon is broken anyway since a while. This is the reason I started adding lots of features of that addon to TTT2. The actual role debugging is missing though. The dev of that addon said they wanted to contribute to TTT2 and add that stuff, but I guess they didn't have the time so far. A few things I want to add:
|
There's quite a lot of VGUI which makes this painful. Honestly, I'm tempted to try to make another layer above VGUI which enables UI code to not have to care about scaling or translation caching, and have all of that handled automatically. That would require a LOT more work, but may wind up being more worthwhile long-term. |
I tried this at one point with the VGUI right now is awful, mostly due to me. VGUI is built on top of inheritance, but I hacked quite a lot of features in it which breaks the inheritance. Moreover vgui by itself is designed to be cached and only updated when changes happen, but at the time I wasn't aware, so my code completely ignores it. If one would want to exted it, it probably needs a partial rewrite. |
Ah, and here's the issue about the font stuff. Some of my investigation results are in there, but I guess most of them are just in my head and on paper: #1402 |
In #1752 I'm currently rebuilding how the color caching works. Once this is done I can show you how I did this and you can use the same system to rescale alle UIs. It basically works by using GMod's proper systems of invalidating layouts. |
Currently, only the HUD is scaled. This is rather annoying for those with high DPI displays, as much of the text is too small to be readable. Instead, we want to present as much of our UI according to the user's specified UI scale as possible, which this PR does.
This unfortunately means threading
* scale
through a bunch of layout and skin code, and it also means that non-default skins will not work until updated (This is particularly onerous with the role debugger and embedded legacy VGUI menus). I tried, at first, implementing a fully-general system that would automatically attempt to scale things which are not hidpi-aware, but that NOT ONLY had terrible performance, but ALSO didn't work.In the process of doing this, I also discovered that
draw.AdvancedText
was implemented fundamentally incorrectly, and have fixed it.Some limitations:
Panel:DrawTextEntryText()
to use a different font set dynamically or be scaled. IsPanel:SetFont()
frame-delayed?DermaDefault
, which doesn't have scaled variants and so looks bad (though it is scaled! I spent 3 whole days on this!)Currently unchanged:
I intend to continue this and apply scaling to the scoreboard as well, but I don't think the buy menu is reasonably possible without giving it a whole UI overhaul.
Before:




After: (1.5x UI scale)



