KariiiM Posted May 31, 2016 Posted May 31, 2016 You have to use: guiGetScreenSize It's a function returns two floating values, those values are the player's screen resolution.
Captain Cody Posted May 31, 2016 Posted May 31, 2016 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)
1LoL1 Posted May 31, 2016 Posted May 31, 2016 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
Captain Cody Posted May 31, 2016 Posted May 31, 2016 relative == 0 to 1, automaticly ajusts itself depending on the resolution.
Anubhav Posted May 31, 2016 Posted May 31, 2016 relative == 0 to 1, automaticly ajusts itself depending on the resolution. There is no relative argument for dx drawing.
Anubhav Posted May 31, 2016 Posted May 31, 2016 My bad, din't notice he switched to the gui static image from dx rectangles.
Captain Cody Posted May 31, 2016 Posted May 31, 2016 -- Also a bit my bad on my part, I didn't read what you said fully. Any ways if you use the relative then you don't need my code as far as I know.
1LoL1 Posted June 1, 2016 Posted June 1, 2016 relative == 0 to 1, automaticly ajusts itself depending on the resolution. But i don't have there 1 i have 0 == 1.
WhoAmI Posted June 1, 2016 Posted June 1, 2016 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.
1LoL1 Posted June 1, 2016 Posted June 1, 2016 I don't need guiCreateStaticImage i need dxDrawRectangle We know you don't need guiCreateStaticImage but he was help me not you.
Bean666 Posted June 9, 2016 Posted June 9, 2016 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
KariiiM Posted June 9, 2016 Posted June 9, 2016 Also, rr, gg, bb and alpha aren't defined in your code tocolor(rr,gg,bb,alpha)
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