• help with scaling vgui
    3 replies, posted
i want to scale my whole f1 panel with all its children depending on your screen resolution so it all fits
Scale the root parent by the screen size, then the children by their parents, and so on.
Use the ScreenScale( number ) global function, or use the ScrW() for game window width, and ScrH() for game window height and do the calculations, etc.
If you are new to scaling VGUI, I'd recommend taking a look at this: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/understanding_hardcoding_of_screensizes.lua.html[/url] It shows how to simplify sizing of HUD elements and VGUI elements in a way that lets you hard-code your screen resolution ( the size the elements are designed in ) and it creates a modifier based on the end-users resolution. Also, when working with VGUI, if you create a typo you may end up unable to do anything without rejoining the server. Here's a tool that fixes that, making vgui development much easier AND shows you how to process all children of an element ( second question ): [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/dev_tools/vgui_clearscreen.lua.html[/url] ALL VGUI elements, by default, are children of the World/Game Panel. There is a HUDPanel ( but it doesn't return the list of children as far as I know ), so you can remove all elements of the World/Game Panel, or target a specific panel and grab the children.
Sorry, you need to Log In to post a reply to this thread.