jkub Posted January 9, 2011 Posted January 9, 2011 Lets say I make a GUI window for a script. I don't know exactly how to center that GUI in the exact center of my screen, no matter the resolution. Can someone help me please
Castillo Posted January 9, 2011 Posted January 9, 2011 maybe this helps, i've tested it and sounds like in the center. https://forum.multitheftauto.com/viewtopic.php?f=91&t=25042&p=294320&hilit=center+a+window#p294320
Discord Moderators Zango Posted January 9, 2011 Discord Moderators Posted January 9, 2011 local x, y = guiGetScreenSize () local guiWidth, guiHeight = 500, 400 local centerX, centerY = (x / 2) - (guiWidth / 2), (y / 2) - (guiHeight / 2) this is pretty elementary lol, you get the half of the screen total width, and subtract it with the half of the guiWidth. If we didn't do the latter, the GUI's top left corner would be the centre instead.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now