bradio10 Posted August 14, 2013 Share Posted August 14, 2013 I am needing help with trying to configure a DX so it can be compatible with all resolutions. I am looking for a simple and easy solution. I have tried using the guiGetScreenSize but I just can't seem to figure it out. thanks. Link to comment
bandi94 Posted August 14, 2013 Share Posted August 14, 2013 How to make it : place the window where you want. Like 400,300 on 1152x864 resolution. After that make the math using calculator. X = 400/1152 Y = 300/864 Then in dxDraw you put. dxDrawImage(ScreenW*X,ScreenH*Y,.......) this will be at the same place on every resolution. I hope you get it. Link to comment
xXMADEXx Posted August 14, 2013 Share Posted August 14, 2013 Well, here is an example for center screen: local sx, sy = guiGetScreenSize ( ) local width = 400 local height = 200 local x = ( sx / 2 - width / 2 ) local y = ( sy / 2 - height / 2 ) addEventHandler ( "onClientRender", root, function ( ) dxDrawRectangle ( x, y, width, height ) end ) Its just basic math. Link to comment
bradio10 Posted August 14, 2013 Author Share Posted August 14, 2013 How to make it :place the window where you want. Like 400,300 on 1152x864 resolution. After that make the math using calculator. X = 400/1152 Y = 300/864 Then in dxDraw you put. dxDrawImage(ScreenW*X,ScreenH*Y,.......) this will be at the same place on every resolution. I hope you get it. So, like this? screenW, screenH = guiGetScreenSize () function draw() x = 400/1024 y = 300/768 dxDrawRectangle ( screenW*x, screenH*y, screenW*x, screenH*y, 255, 255, 255, 255, true) end addEventHandler ("onClientRender", root, draw) Link to comment
bandi94 Posted August 14, 2013 Share Posted August 14, 2013 Yes it's like that. for Rectangel W,H you can use another set of math not the same as X,Y if you wanna smaller or bigger Rectangel like 400,3000. Link to comment
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