Jump to content

guiGetScreenSize


Enargy,

Recommended Posts

Posted

because using 'guiGetScreenSize' The position does not change but changing my resolution changes, I want the gui is in its original position for all resolutions.

local sx,sy = guiGetScreenSize() 
  
  
  
function gui() 
wnd = guiCreateStaticImage(sx / 2.5 - 310, sy / 1.4 - 260, 132, 252, "images/window_sect.png", false)        
  
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), gui) 

Posted

You want the GUI image in the center of the screen? Use this:

  
local windowW,windowH=guiGetSize(wnd,false) 
local sWidth,sHeight = guiGetScreenSize() 
local x,y = (sWidth-windowW)/2,(sHeight-windowH)/2 
guiSetPosition(wnd,x,y,false) 
  

 

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