Jump to content

Assigning the correct resolution


Cruze

Recommended Posts

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.

Link to comment
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 

Link to comment
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 
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...