Jump to content

guigetScreenSize help


XeRo

Recommended Posts

do a:

local x,y = guiGetScreenSize () 

then if your resolution is 1024x768 you do this:

217/1024 = 0.2119140625

79/768 = 0.1028645833333333

647/1024 = 0.6318359375

558/768 = 0.7265625

after you get it done, you go like this:

  
guiCreateStaticImage (x*0.2119140625, y*0.102864583, x*0.6318359375, y*0.7265625, "panel.png", false) 

you can keep as much decimal numbers as you want, but the more the numbers the better

Link to comment
do a:
local x,y = guiGetScreenSize () 

then if your resolution is 1024x768 you do this:

217/1024 = 0.2119140625

79/768 = 0.1028645833333333

647/1024 = 0.6318359375

558/768 = 0.7265625

after you get it done, you go like this:

  
guiCreateStaticImage (x*0.2119140625, y*0.102864583, x*0.6318359375, y*0.7265625, "panel.png", false) 

you can keep as much decimal numbers as you want, but the more the numbers the better

oh Thanks. Help me

     GUIEditor.staticimage[2] = guiCreateStaticImage(0, 0, 231, 768, "menu.png", false) 

Edited by Guest
Link to comment

Hey, look what i am going to do and try to learn from that

First of all you've to get your screen "Resolution" ,if you created the gui in another resolution and tried to do your current resolution ,it won't works as it must be like,and it will shows for you in another place,anyway

  
--put here your resolution, for example if it's 800x600. 
local screenX =800 --put 800 here 
local screenY =  600 -- put 600 in screenY 
local sx, sy = guiGetScreenSize() 
local x, y = sx/screenX, sy/screenY 

--Now let's add them in the gui:

  GUIEditor.staticimage[1] = guiCreateStaticImage(217*x, 79*y, 647*x, 558*y, "panel.png", false) 

I thinks it's easy to understand and easy way.

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...