• Derma Scaling
    4 replies, posted
I have made a very complex derma screen that I'm very happy about. The only problem is that it only looks how it's suppose to look like in 1920X1080 res. Now I know it's no easy fix for this. And I should have planned it out before I made the whole Derma Window. Does anyway have any idea on how I can make it look good on all screen resolutions?
Make the derma element's size and position be set to a ratio of your screen width and screen height. [url]http://wiki.garrysmod.com/page/Global/ScrW[/url] [url]http://wiki.garrysmod.com/page/Global/ScrH[/url] [url]http://wiki.garrysmod.com/page/Global/ScreenScale[/url]
Use [CODE]ScrH() [/CODE] and [CODE]ScrW()[/CODE] an example [CODE]blabla = vgui.create("DFrame") blabla:SetPos(50, 50) blabla:SetSize(ScrW() - 500, ScrH()- 500 ) blablab:SetTitle("Blabla")[/CODE] ScrH = client screen height resolution ScrW = client screen width resolution [editline]19th September 2014[/editline] fuck ninja'd
[url]http://facepunch.com/showthread.php?t=1417504[/url]
Using modifiers to have dynamic sizing of HUDs, panels, etc... [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/understanding_hardcoding_of_screensizes.lua.html[/url] Something else which may be useful... A PlayerChangedResolution Hook [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_hooks/acecool_hook_playerchangedresolution/gm_playerchangedresolution.lua[/url] Example Usage ( this example shows how to set something up such as a poly table, and only recalculate the poly if the resolution changes / ie the hook gets called; this would work for vgui / panels too ) [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_hooks/acecool_hook_playerchangedresolution/example_usage.lua[/url]
Sorry, you need to Log In to post a reply to this thread.