Cruze Posted February 20, 2014 Posted February 20, 2014 I was wondering everyday, how I could assign the correct resolution for GUI alot of people said to me use maths, I know maths, but how to calculate it?
Bonsai Posted February 20, 2014 Posted February 20, 2014 Keyword is "relative" I guess. Else you have to get players resolution and scale everything.
Bonsai Posted February 20, 2014 Posted February 20, 2014 What do you mean by GUI anyway? Elements created by gui functions can be relative to the screen and each other. Thats pretty easy to make them look equal on all resolution, except for the textlabels maybe. For dx functions you can also make positions and stuff relative, by multiplying the screenX or Y by some value. THere you can also scale font size, but it might look bad.
Anubhav Posted February 20, 2014 Posted February 20, 2014 I suggest you to make it relative . You can also use guiGetScreenSize
Moderators Citizen Posted February 20, 2014 Moderators Posted February 20, 2014 Yeah every gui elements should be relative most of the time. Here is a nice explanation about relative and abosulte: https://wiki.multitheftauto.com/wiki/In ... d_Absolute
Gallardo9944 Posted February 20, 2014 Posted February 20, 2014 I was wondering everyday, how I could assign the correct resolution for GUI alot of people said to me use maths, I know maths, but how to calculate it? huh, just calculate the position relatively to your guiGetScreenSize values. Like this: local x,y = guiGetScreenSize() local px,py = x-100,y-100 -- will stick to "-100" from any resultion or local x,y = guiGetScreenSize() local px,py = x/2,y/2 -- will keep middle here
Jesseunit Posted February 22, 2014 Posted February 22, 2014 I was wondering everyday, how I could assign the correct resolution for GUI alot of people said to me use maths, I know maths, but how to calculate it? huh, just calculate the position relatively to your guiGetScreenSize values. Like this: local x,y = guiGetScreenSize() local px,py = x-100,y-100 -- will stick to "-100" from any resultion or local x,y = guiGetScreenSize() local px,py = x/2,y/2 -- will keep middle here That'll only put the top left corner of the GUI in the center. If you actually want it to be centered, I suggest you to remove the width and height of the GUI from the width and height of the screen resolution and multiply by 0.5 or divide by 2. local sw, sh = guiGetScreenSize() -- Retrieve the client's screen resolution local width, height = 500, 250 -- Predefined width and height of the GUI local sx, sy = ( sw - width ) * 0.5, ( sh - height ) * 0.5 -- The actual centered width and height
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