We all have problems with HUD/VGUI when using it in different screen resolutions (at least I do). That’s why I think we need an easy way to scale HUD/VGUI (Derma) based on screen resolution. Basically, by making some functions like these:
[lua]-- Scales clientside screen positions based on Screen Res in comparison to the X/Y coordinates in the 3rd and 4th arguments
– Scales clientside sizes based on Screen Res in comparison to the Width/Hight in the 3rd and 4th arguments
Basically, you’d configure your HUD/VGUI in whatever screen resolution you feel comfortable using. Then, wherever you have something that involved coordinates/sizes, you’d put this in by entering the screen res you constructed it in and the positions/sizes you originally used.
The function would then spit out some new values based on the current ScrW() and ScrH() in a table format so you could do something like this:
local translatePos = ScaleClientSidePos(1024,860,115,200)
local translateSize = ScaleClientSidePos(1024,860,400,800)
draw.RoundedBox( 3, translatePos.x, translatePos.y, translateSize.w, translateSize.h, Color(255,255,255,255) )
What equation(s) would be used to get such functions to work?