Jump to content

Easiest Way To DX


Recommended Posts

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
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
  • 2 weeks later...

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