damien111 Posted July 19, 2014 Share Posted July 19, 2014 Whats the easiest way to make this fit for all resolutions since there are not any relative sizing/coords options. addEventHandler("onClientRender", root, function() if(getElementData(localPlayer,"loggedIn"))then dxDrawRectangle(0, 0, 1366, 51, tocolor(0, 0, 0, 255), true) dxDrawRectangle(0, 0, 1365, 49, tocolor(0, 9, 85, 255), true) dxDrawRectangle(1365, 130, 1, 0, tocolor(255, 255, 255, 255), true) dxDrawRectangle(627, 12, 110, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(628, 13, 108, 26, tocolor(17, 43, 255, 255), true) dxDrawRectangle(381, 12, 238, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(382, 13, 236, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(209, 12, 164, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(210, 13, 162, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(37, 12, 164, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(38, 13, 162, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(745, 12, 238, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(746, 13, 236, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(991, 12, 143, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(992, 13, 141, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(1142, 12, 164, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(1143, 13, 162, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(971, 48, 395, 48, tocolor(0, 0, 0, 255), true) dxDrawRectangle(972, 49, 393, 46, tocolor(0, 9, 85, 255), true) dxDrawRectangle(981, 58, 227, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(982, 59, 225, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(1216, 58, 129, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(1217, 59, 127, 26, tocolor(0, 17, 159, 255), true) dxDrawText(getElementData(localPlayer,"Score"), 36, 13, 200, 39, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText(getElementData(localPlayer,"Crew"), 210, 13, 374, 39, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText(getElementData(localPlayer,"Money"), 372, 13, 618, 39, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText(tostring(raceTimeLeft), 628, 13, 736, 39, tocolor(255, 255, 255, 255), 0.6, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText(mapName, 746, 13, 978, 39, tocolor(255, 255, 255, 255), 0.6, "bankgothic", "center", "center", false, true, true, false, false) dxDrawText("Likes", 979, 13, 1143, 39, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Dislikes", 1141, 13, 1305, 39, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("User Panel (F1)", 1020, 59, 1163, 85, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("SHOP (F2)", 1207, 59, 1350, 85, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, true, false, false) dxDrawRectangle(1365, 524, 1, 16, tocolor(255, 255, 255, 255), true) end end) Link to comment
FuriouZ Posted July 19, 2014 Share Posted July 19, 2014 Whats the easiest way to make this fit for all resolutions since there are not any relative sizing/coords options. addEventHandler("onClientRender", root, function() if(getElementData(localPlayer,"loggedIn"))then dxDrawRectangle(0, 0, 1366, 51, tocolor(0, 0, 0, 255), true) dxDrawRectangle(0, 0, 1365, 49, tocolor(0, 9, 85, 255), true) dxDrawRectangle(1365, 130, 1, 0, tocolor(255, 255, 255, 255), true) dxDrawRectangle(627, 12, 110, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(628, 13, 108, 26, tocolor(17, 43, 255, 255), true) dxDrawRectangle(381, 12, 238, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(382, 13, 236, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(209, 12, 164, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(210, 13, 162, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(37, 12, 164, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(38, 13, 162, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(745, 12, 238, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(746, 13, 236, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(991, 12, 143, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(992, 13, 141, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(1142, 12, 164, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(1143, 13, 162, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(971, 48, 395, 48, tocolor(0, 0, 0, 255), true) dxDrawRectangle(972, 49, 393, 46, tocolor(0, 9, 85, 255), true) dxDrawRectangle(981, 58, 227, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(982, 59, 225, 26, tocolor(0, 17, 159, 255), true) dxDrawRectangle(1216, 58, 129, 28, tocolor(0, 0, 0, 255), true) dxDrawRectangle(1217, 59, 127, 26, tocolor(0, 17, 159, 255), true) dxDrawText(getElementData(localPlayer,"Score"), 36, 13, 200, 39, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText(getElementData(localPlayer,"Crew"), 210, 13, 374, 39, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText(getElementData(localPlayer,"Money"), 372, 13, 618, 39, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText(tostring(raceTimeLeft), 628, 13, 736, 39, tocolor(255, 255, 255, 255), 0.6, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText(mapName, 746, 13, 978, 39, tocolor(255, 255, 255, 255), 0.6, "bankgothic", "center", "center", false, true, true, false, false) dxDrawText("Likes", 979, 13, 1143, 39, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Dislikes", 1141, 13, 1305, 39, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("User Panel (F1)", 1020, 59, 1163, 85, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("SHOP (F2)", 1207, 59, 1350, 85, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "center", "center", false, false, true, false, false) dxDrawRectangle(1365, 524, 1, 16, tocolor(255, 255, 255, 255), true) end end) I use this way, best for me. local screenW,screenH = guiGetScreenSize() local resW,resH = 1280,720 -- Your resolution (This is mine) local sW,sH = (screenW/resW), (screenH/resH) It should look like this then: local screenW,screenH = guiGetScreenSize() local resW,resH = 1280,720 local sW,sH = (screenW/resW), (screenH/resH) addEventHandler("onClientRender", root, function() if(getElementData(localPlayer,"loggedIn"))then dxDrawRectangle(0*sW, 0*sH, 1366*sW, 51*sH, tocolor(0, 0, 0, 255), true) dxDrawRectangle(0*sW, 0*sH, 1365*sW, 49*sH, tocolor(0, 9, 85, 255), true) dxDrawRectangle(1365*sW, 130*sH, 1*sW, 0*sH, tocolor(255, 255, 255, 255), true) --... end end) Link to comment
damien111 Posted July 19, 2014 Author Share Posted July 19, 2014 Oh my god, if this works, im going to worship you. For the past few months i have been just doing like math equations that just centered it then offset it. Thanks!! Link to comment
FuriouZ Posted July 19, 2014 Share Posted July 19, 2014 (edited) Oh my god, if this works, im going to worship you. For the past few months i have been just doing like math equations that just centered it then offset it. Thanks!! Trust me, it will, i did excatly the same like you, until i found this way You can even see it in my hud script how it is done https://community.multitheftauto.com/index.php?p= ... ls&id=9679 Edited July 20, 2014 by Guest Link to comment
damien111 Posted July 20, 2014 Author Share Posted July 20, 2014 Oh my gosh i love you. Link to comment
aintaro Posted July 21, 2014 Share Posted July 21, 2014 Oh my god, if this works, im going to worship you. For the past few months i have been just doing like math equations that just centered it then offset it. Thanks!! Link to comment
Bonsai Posted July 30, 2014 Share Posted July 30, 2014 Just wondering, what happens to this way if its about 4/3, 16/9 ? If it comes to that, the width is much wider. Link to comment
MTA Team botder Posted July 31, 2014 MTA Team Share Posted July 31, 2014 Try this one (made for 1920x1080) local screenResolution = { guiGetScreenSize() } local resizeFactor = (screenResolution[1] / 1920 + screenResolution[2] / 1080) / 2 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