Jump to content

.


-Doc-

Recommended Posts

    
H = PUT YOUR HIGHT HERE 
W = PUT YOUR WIDTH HERE 
  
local height, width = guiGetScreenSize() 
  
local adjustH = (1/H)*height 
local adjustW = (1/W)*width  
 dxDrawRectangle(1555*adjustH , 1003*adjustW , lenght*adjustH , 16*adjustW , tocolor(rr,gg,bb,alpha), false) 
       dxDrawRectangle(1555*adjustH , 1003*adjustW, 320*adjustH, 16*adjustW, tocolor(0, 0, 0, 120), false) 

Link to comment
    
H = PUT YOUR HIGHT HERE 
W = PUT YOUR WIDTH HERE 
  
local height, width = guiGetScreenSize() 
  
local adjustH = (1/H)*height 
local adjustW = (1/W)*width  
 dxDrawRectangle(1555*adjustH , 1003*adjustW , lenght*adjustH , 16*adjustW , tocolor(rr,gg,bb,alpha), false) 
       dxDrawRectangle(1555*adjustH , 1003*adjustW, 320*adjustH, 16*adjustW, tocolor(0, 0, 0, 120), false) 

Idk but really this don't work.

H = 800 
W = 600 
  
local height, width = guiGetScreenSize() 
  
local x = (1/H)*height 
local y = (1/W)*width 
wnds = guiCreateStaticImage(x * 0.800, y * 0.250, 0.27, 0.18, "image.png", true) 

in 800x600 work normally but in 1366x768 no :(

Link to comment

What you need to do is working on percentage units. Look

yourScreenWitdth = 1920 
yourScreenHeight = 1080 
  
dxWidth = 1555 
dxHeight = 1003 
  
screenWidth, screenHeight = guiGetScreenSize(); 
  
--onClientRender 
dxDrawRectangle( (dxWidth/yourScreenWitdth) * sreenWidth, (dxHeight/yourScreenHeight) * screenHeight, lenght, 16, tocolor(rr,gg,bb,alpha), false) 
dxDrawRectangle( (dxWidth/yourScreenWitdth) * sreenWidth, (dxHeight/yourScreenHeight) * screenHeight, 320, 16, tocolor(0, 0, 0, 120), false) 

Hope you understand.

Link to comment
What you need to do is working on percentage units. Look
yourScreenWitdth = 1920 
yourScreenHeight = 1080 
  
dxWidth = 1555 
dxHeight = 1003 
  
screenWidth, screenHeight = guiGetScreenSize(); 
  
--onClientRender 
dxDrawRectangle( (dxWidth/yourScreenWitdth) * sreenWidth, (dxHeight/yourScreenHeight) * screenHeight, lenght, 16, tocolor(rr,gg,bb,alpha), false) 
dxDrawRectangle( (dxWidth/yourScreenWitdth) * sreenWidth, (dxHeight/yourScreenHeight) * screenHeight, 320, 16, tocolor(0, 0, 0, 120), false) 

Hope you understand.

Will this work on all resolutions?

try testing it yourself. anyways there's a typo at dxDrawRectangle, it's screenWidth not sreenWidth
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...