Jump to content

DX & Resolutions... Not a good combo.


WolfPire

Recommended Posts

So it's been 2 days since i started this little proyect... and well i've been trying to center my code in order to make it available for all resoltuions... I tried EVERYTHING.. Everyway i saw, but nothing works....

This is just another newbie problem that can be solved easily, but resolutions, that doesn't go with me :T

I'd like a hand on here guys!

Thanks in advance >~<

- WolfPire

function drawLinesAcrossScreen() 
    if getPedOccupiedVehicle(localPlayer) then 
        if getElementModel(getPedOccupiedVehicle(localPlayer)) == 520 then 
         
        ---Script--- 
        local sx, sy = guiGetScreenSize() 
        sx = sx / 1.10 
        sy = sy / 1.10 
        local maxHeight = 800 
        --speed-- 
            speedx, speedy, speedz = getElementVelocity ( getPedOccupiedVehicle(localPlayer) ) 
            actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5)  
            --mps = actualspeed * 50 
            kmh = actualspeed * 180 
            --mph = actualspeed * 111.847 
        --/speed-- 
         
        --altitude-- 
            local px, py, pz = getElementPosition(getPedOccupiedVehicle(localPlayer)) 
             
            if not alarm then 
            if pz > maxHeight then 
                alarm = playSound("sounds/alarm.mp3", true) 
                lineColor = tocolor(255, 0, 0) 
                boxColor = tocolor(0,0,255) 
                setSoundVolume(alarm, 0.3) 
                setTimer(function() stopSound(alarm) alarm = nil end, 1100, 1) 
            else 
                stopSound(alarm) 
                alarm = nil 
                lineColor = tocolor(0, 255, 0) 
                boxColor = tocolor(0,255,0) 
            end 
        end 
             
            local sty = sy - 120 
            local sly = sy - 108 
            local ssly = sy - 120 
            dxDrawText ( ">", sx - 215, sty - 330 * (pz/maxHeight), sx - 215, sy - 100, lineColor, 1.5, "default", "left", "top") -- ALT Raising Arrow 
            dxDrawLine ( sx - 202.5, sy - 100, sx - 202.5, sly - 330 * (pz/maxHeight), lineColor ) -- ALT Raising Line 
            dxDrawText ( "<", sx - 597.5, ssly - 330 * (kmh/270), sx - 215, sy - 100, lineColor, 1.5, "default", "left", "top") -- SPD Raising Arrow 
            dxDrawLine ( sx - 596.5, sy - 100, sx - 596.5, sly - 330 * (kmh/270), lineColor ) -- SPD Raising Line 
        --/altitude-- 
         
        --hs-- 
        if getElementData(localPlayer, "hydra.mode") == 3 then 
            if getElementData(localPlayer, "hydra.lock") == true then 
            local tvehicle = tuFindNearestElement(getPedOccupiedVehicle(localPlayer), "vehicle", 400) 
            circleColor = tocolor(255, 255, 0) 
            drawCircle( sx/1.835, sy/1.85, 15, circleColor ) -- Circle 
                if tvehicle and getElementHealth(tvehicle) > 0 then 
                    if lockon == false then 
                    local px, py, pz = getElementPosition(getPedOccupiedVehicle(localPlayer)) 
                    local tx, ty, tz = getElementPosition(tvehicle) 
                    if( isLineOfSightClear(px, py, pz, tx, ty, tz, true, false, false, false )) then 
                    local tsx, tsy = getScreenFromWorldPosition ( tx, ty, tz ) 
                    drawCircle( tsx, tsy, 15, circleColor ) -- Circle 
                    if not timerlock then 
                    timerLock = setTimer(function() setElementData(localPlayer, "hydra.target", tvehicle) lockon = true end, 3000, 1) 
                    setTimer(function() timerLock = false end, 3000, 1) 
                    else 
                    timerLock = nil 
                    timerLock = setTimer(function() setElementData(localPlayer, "hydra.target", tvehicle) lockon = true end, 3000, 1) 
                    setTimer(function() timerLock = false end, 3000, 1) 
                    end 
                    end 
                    else 
                    local tx, ty, tz = getElementPosition(tvehicle) 
                    local tsx, tsy = getScreenFromWorldPosition ( tx, ty, tz ) 
                    circleColor = tocolor(255, 0, 0) 
                    drawCircle( tsx, tsy, 15, circleColor ) -- Circle 
                    drawCircle( tsx, tsy, 15, circleColor ) -- Circle 
                    if not lockons then 
                    lockons = playSound("sounds/lockon.wav", false) 
                    setSoundVolume(lockons, 0.1) 
                    end 
                    end 
                end 
                else 
                setElementData(localPlayer, "hydra.target", nil) 
                setElementData(localPlayer, "hydra.lock", false) 
                lockon = false 
                stopSound(lockons) 
                lockons = false 
                circleColor = tocolor(0, 255, 0) 
                drawCircle( sx/1.835, sy/1.85, 15, circleColor ) -- Circle 
                setElementData(localPlayer, "hydra.lock", false) 
            end 
        end 
        --/hs-- 
         
        --solo-- 
        if getElementData(localPlayer, "hydra.mode") == 1 then 
            circleColor = tocolor(0, 255, 0) 
            drawCircle( sx/1.835, sy/1.85, 20, circleColor ) -- Circle 
        end 
        --/solo-- 
         
        --bomb-- 
        if getElementData(localPlayer, "hydra.mode") == 2 then 
            if myScreenSource then 
            local matrix = getElementMatrix(getPedOccupiedVehicle(localPlayer)) 
            local px, py, pz = getElementPosition(getPedOccupiedVehicle(localPlayer)) 
            local offX1 = 0 * matrix[1][1] + 0 * matrix[2][1] + 2 * matrix[3][1] + 1 * matrix[4][1] 
            local offY1 = 0 * matrix[1][2] + 0 * matrix[2][2] + 2 * matrix[3][2] + 1 * matrix[4][2] 
            local offZ1 = 0 * matrix[1][3] + 0 * matrix[2][3] + 2 * matrix[3][3] + 1 * matrix[4][3] 
            local offX = 0 * matrix[1][1] - 3 * matrix[2][1] + 2 * matrix[3][1] + 1 * matrix[4][1] 
            local offY = 0 * matrix[1][2] - 3 * matrix[2][2] + 2 * matrix[3][2] + 1 * matrix[4][2] 
            local offZ = 0 * matrix[1][3] - 3 * matrix[2][3] + 2 * matrix[3][3] + 1 * matrix[4][3] 
            local slx, sly = getScreenFromWorldPosition( px, py + 5, pz) 
            drawCircle( slx, sly, 20, circleColor ) -- Circle 
            --setCameraMatrix(offX1,offY1,offZ1,offX,offY,offZ,0,0) 
            end 
        end 
        --/bomb-- 
         
        ---/Script--- 
        ---HUD--- 
            dxDrawLine(sx - 200, sy - 100, sx - 200, sy - 500, lineColor) -- Main Line (Right) 
            dxDrawLine(sx - 600, sy - 100, sx - 600, sy - 500, lineColor) -- Main Line (Left) 
            dxDrawLine(sx - 200, sy - 500, sx - 215, sy - 500, lineColor) -- Little Line 1 (Right) 
            dxDrawLine(sx - 200, sy - 100, sx - 215, sy - 100, lineColor) -- Little Line 2 (Right) 
            dxDrawLine(sx - 600, sy - 500, sx - 585, sy - 500, lineColor) -- Little Line 1 (Left) 
            dxDrawLine(sx - 600, sy - 100, sx - 585, sy - 100, lineColor) -- Little Line 2 (Left) 
            dxDrawImage(sx - 195, sy - 300, 128, 32, "hudimgs/box.png", 0, 0, 0, boxColor) -- Box (Altitude) 
            dxDrawImage(sx - 605, sy - 268 , - 128, - 32, "hudimgs/box.png", 0, 0, 0, boxColor) -- Box (Speed) 
            dxDrawText ( "ALT", sx - 160, sy - 325, sx, sy, lineColor, 1.5, "default", "left", "top") -- ALT Label 
            dxDrawText ( math.floor(pz), sx - 100, sy - 297.5, sx - 70, sy, lineColor, 2, "default", "right", "top") -- ALT Def Label 
            dxDrawText ( "SPD", sx - 680, sy - 325, sx, sy, lineColor, 1.5, "default", "left", "top") -- SPD Label 
            dxDrawText ( math.floor(kmh), sx - 730, sy - 297.5, sx, sy, lineColor, 2, "default", "left", "top") -- SPD Def Label 
            if soloc then 
            dxDrawText ( "MISSILES..."..soloc, sx - 180, sy - 80, sx, sy, lineColor, 1.5, "default", "left", "top") -- Missiles Label 
            end 
            if bombc then 
            dxDrawText ( "BOMBS..."..bombc, sx - 180, sy - 60, sx, sy, lineColor, 1.5, "default", "left", "top") -- Missiles Label 
            end 
            if hsc then 
            dxDrawText ( "HS-MISSILES..."..hsc, sx - 180, sy - 40, sx, sy, lineColor, 1.5, "default", "left", "top") -- Missiles Label 
            end 
             
            --cam type-- 
            if getElementData(localPlayer, "hydra.cmode") == 1 then 
                dxDrawText ( "LOCK", sx - 280, sy - 525, sx, sy, lineColor, 1, "default", "left", "top") -- LOCK Label (!) 
                dxDrawText ( "FREE", sx - 560, sy - 525, sx, sy, lineColor, 1.5, "default", "left", "top") -- FREE Label 
            elseif getElementData(localPlayer, "hydra.cmode") == 2 then 
                dxDrawText ( "LOCK", sx - 280, sy - 525, sx, sy, lineColor, 1.5, "default", "left", "top") -- LOCK Label 
                dxDrawText ( "FREE", sx - 560, sy - 525, sx, sy, lineColor, 1, "default", "left", "top") -- FREE Label (!) 
            end 
            --/cam type-- 
             
            --missile Type-- 
            if getElementData(localPlayer, "hydra.mode") == 1 then 
            dxDrawText ( "SOLO", sx - 580, sy - 80, sx, sy, lineColor, 1.5, "default", "left", "top") -- SOLO Label (!) 
            dxDrawText ( "BOMB", sx - 420, sy - 80, sx, sy, lineColor, 1, "default", "left", "top") -- BOMB Label 
            dxDrawText ( "HS", sx - 260, sy - 80, sx, sy, lineColor, 1, "default", "left", "top") -- HS Label 
            elseif getElementData(localPlayer, "hydra.mode") == 2 then 
            dxDrawText ( "SOLO", sx - 580, sy - 80, sx, sy, lineColor, 1, "default", "left", "top") -- SOLO Label 
            dxDrawText ( "BOMB", sx - 420, sy - 80, sx, sy, lineColor, 1.5, "default", "left", "top") -- BOMB Label (!) 
            dxDrawText ( "HS", sx - 260, sy - 80, sx, sy, lineColor, 1, "default", "left", "top") -- HS Label 
            elseif getElementData(localPlayer, "hydra.mode") == 3 then 
            dxDrawText ( "SOLO", sx - 580, sy - 80, sx, sy, lineColor, 1, "default", "left", "top") -- SOLO Label 
            dxDrawText ( "BOMB", sx - 420, sy - 80, sx, sy, lineColor, 1, "default", "left", "top") -- BOMB Label 
            dxDrawText ( "HS", sx - 260, sy - 80, sx, sy, lineColor, 1.5, "default", "left", "top") -- HS Label (!) 
            end 
            --/missile Type-- 
        --/HUD-- 
        end 
    end 
end 
addEventHandler("onClientRender", root, drawLinesAcrossScreen) 

Link to comment
Yeah, working with DX functions is a pain in the ass. But even with DX the code for the link I gave you is similar to centering it, except with out guiGetSize of course.

Can i use it without having to replace the whole code? >w<

EDIT: I'm using that to center all this:

Link to comment

That looks really good, but that is the annoying thing DX, you have to play around with it to get it where you want. For example,

  
  
local screenW, screenH = guiGetScreenSize() 
  
--That will create a rectangle and put it in the center of the screen regardless of what resolution you are using. 
right = dxDrawRectangle((screenW - 488) / 2, (screenH - 24 ) , 488, 24, tocolor(0, 0, 0, 205), true) 
  
--This makes a rectangle  at the very top of the screen but at the center. 
another = dxDrawRectangle((screenW - 488) / 2, 0, 488, 24, tocolor(0, 0, 0, 205), true) 
  
  

You just have to play around with it until you get it just right. Since you have different positions for all of them you will have to do it manually kind of like I did it above.

 

Link to comment
That looks really good, but that is the annoying thing DX, you have to play around with it to get it where you want. For example,
  
  
local screenW, screenH = guiGetScreenSize() 
  
--That will create a rectangle and put it in the center of the screen regardless of what resolution you are using. 
right = dxDrawRectangle((screenW - 488) / 2, (screenH - 24 ) , 488, 24, tocolor(0, 0, 0, 205), true) 
  
--This makes a rectangle  at the very top of the screen but at the center. 
another = dxDrawRectangle((screenW - 488) / 2, 0, 488, 24, tocolor(0, 0, 0, 205), true) 
  
  

You just have to play around with it until you get it just right. Since you have different positions for all of them you will have to do it manually kind of like I did it above.

 

Oh, this makes me wanna die c: (literally)

Anyways, i'll try it, i'll post whether it worked or not owo

Thanks for the support, pal!! Really appreciate it!

EDIT: Why is there no "/2" after screenH? owo

Link to comment
Dividing the resolution by 2 so it centers it. so the height of (1920/2 = 960) ( 1080 / 2 = 540 ) which would be in the center of the screen.

Well i tried this part:

dxDrawLine((sx - 200)/2, (sy - 100)/2, (sx - 200)/2, (sy - 500)/2, lineColor) -- Main Line (Right) 
            dxDrawLine((sx - 600)/2, (sy - 100)/2, (sx - 600)/2, (sy - 500)/2, lineColor) -- Main Line (Left) 
            dxDrawLine((sx - 200)/2, (sy - 500)/2, (sx - 215)/2, (sy - 500)/2, lineColor) -- Little Line 1 (Right) 
            dxDrawLine((sx - 200)/2, (sy - 100)/2, (sx - 215)/2, (sy - 100)/2, lineColor) -- Little Line 2 (Right) 
            dxDrawLine((sx - 600)/2, (sy - 500)/2, (sx - 585)/2, (sy - 500)/2, lineColor) -- Little Line 1 (Left) 
            dxDrawLine((sx - 600)/2, (sy - 100)/2, (sx - 585)/2, (sy - 100)/2, lineColor) -- Little Line 2 (Left) 
            dxDrawImage((sx - 195)/2, (sy - 300)/2, 128, 32, "hudimgs/box.png", 0, 0, 0, boxColor) -- Box (Altitude) 
            dxDrawImage((sx - 605)/2, (sy - 268)/2 , - 128, - 32, "hudimgs/box.png", 0, 0, 0, boxColor) -- Box (Speed) 

However it only made the interface a lot smaller and in the corner >w<

Link to comment

Personally I have never used dxDrawLine too much, but

That is why for things like this i use guieditor and right click on the lines and use the 'Set Position Code' option and play around from there. Because when you output the code after doing it, you can guarantee it will work on everyone resolution .

Link to comment
Personally I have never used dxDrawLine too much, but

That is why for things like this i use guieditor and right click on the lines and use the 'Set Position Code' option and play around from there. Because when you output the code after doing it, you can guarantee it will work on everyone resolution .

True that, bro... True that....

Thanks a bunch for the help!!!

Anyone else that could lend us a hand in here? This might come useful for future coders with the same problem.

Link to comment

Found something usefull from 50p:

https://forum.multitheftauto.com/viewtopic.php?f=91&t=41865&p=423999#p423999

And tips for Centering a dxDrawText:

https://wiki.multitheftauto.com/wiki/DxGetFontHeight

and

https://wiki.multitheftauto.com/wiki/DxGetTextWidth

( with some easy calculations you can get it right )

Here's my old code which I used once for a 3d radio system it might be crappy but it's something:

For example my dxDrawText in a rectangle combined with the centerWindow function,dxGetFontHeight and dxGetTextWidth:

  
  
  
local screenW,screenH=guiGetScreenSize() 
local windowW,windowH=400, 60 
local x,y = (screenW-windowW)/2, 60 
local x2,y2 = (screenW-windowW)/1.5, 40 
local x3,y3 = (screenW-windowW)/2.5, 40 
  
  
  
  
  
  
function drawStuff() 
  
dxDrawRectangle (x2, y2, 400, 60, tocolor(0,0,0,150)) 
dxDrawText ("right",x2 - (dxGetTextWidth ( "right", 1.02, "pricedown" ) / 2) + 200 , y2 - (dxGetFontHeight(1.02, "pricedown") / 2 ) + 30, 400, 60, tocolor ( 255, 0, 0, 100 ), 1.02, "pricedown" ) 
  
  
dxDrawRectangle (x3, y3, 400, 60, tocolor(0,0,0,150)) 
dxDrawText ("left?",x3 - (dxGetTextWidth ( "left?", 1.02, "pricedown" ) / 2) + 200 , y3 - (dxGetFontHeight(1.02, "pricedown") / 2 ) + 30, 400, 60, tocolor ( 255, 0, 0, 100 ), 1.02, "pricedown" ) 
  
  
dxDrawRectangle (x, y, 400, 60, tocolor(0,0,0,250)) 
dxDrawText ("default",x - (dxGetTextWidth ( "default", 1.02, "pricedown" ) / 2) + 200 , y - (dxGetFontHeight(1.02, "pricedown") / 2 ) + 30, 400, 60, tocolor ( 255, 0, 0, 255 ), 1.02, "pricedown" ) 
  
  
  
end 
  
draw = false 
  
addCommandHandler ( "radio", 
function() 
if ( draw == false ) then 
addEventHandler("onClientRender", root, drawStuff) 
draw = true 
elseif ( draw == true ) then 
removeEventHandler("onClientRender", root, drawStuff) 
draw = false 
end 
  
end) 
--etc.  

And on the wiki is a very good example of guiGetScreenSize.

For example, You have made a text/line in guiEditor and then you have outputted the propertys ( width,size,etc.) ( you are currently playing on 1920x1080xblah)

Now you can use those to calculate it.

Just like the wiki:

Left position value is 684, 684/1920 = 0.356

Top position value is 731, 731/1080 = 0.676

Right position values is 732, 732/1920 = 0.381

Bottom position value is 766, 766/1080 = 0.709

And then

local sWidth,sHeight = guiGetScreenSize() 
dxDrawText("I just copied the text from the wiki with some changes",sWidth*0.356, sHeight*0.676, sWidth*0.381, sHeight*0.709,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) 

ETC.

Source: wiki ;p

Link to comment
Found something usefull from 50p:

https://forum.multitheftauto.com/viewtopic.php?f=91&t=41865&p=423999#p423999

And tips for Centering a dxDrawText:

https://wiki.multitheftauto.com/wiki/DxGetFontHeight

and

https://wiki.multitheftauto.com/wiki/DxGetTextWidth

( with some easy calculations you can get it right )

Here's my old code which I used once for a 3d radio system it might be crappy but it's something:

For example my dxDrawText in a rectangle combined with the centerWindow function,dxGetFontHeight and dxGetTextWidth:

  
  
  
local screenW,screenH=guiGetScreenSize() 
local windowW,windowH=400, 60 
local x,y = (screenW-windowW)/2, 60 
local x2,y2 = (screenW-windowW)/1.5, 40 
local x3,y3 = (screenW-windowW)/2.5, 40 
  
  
  
  
  
  
function drawStuff() 
  
dxDrawRectangle (x2, y2, 400, 60, tocolor(0,0,0,150)) 
dxDrawText ("right",x2 - (dxGetTextWidth ( "right", 1.02, "pricedown" ) / 2) + 200 , y2 - (dxGetFontHeight(1.02, "pricedown") / 2 ) + 30, 400, 60, tocolor ( 255, 0, 0, 100 ), 1.02, "pricedown" ) 
  
  
dxDrawRectangle (x3, y3, 400, 60, tocolor(0,0,0,150)) 
dxDrawText ("left?",x3 - (dxGetTextWidth ( "left?", 1.02, "pricedown" ) / 2) + 200 , y3 - (dxGetFontHeight(1.02, "pricedown") / 2 ) + 30, 400, 60, tocolor ( 255, 0, 0, 100 ), 1.02, "pricedown" ) 
  
  
dxDrawRectangle (x, y, 400, 60, tocolor(0,0,0,250)) 
dxDrawText ("default",x - (dxGetTextWidth ( "default", 1.02, "pricedown" ) / 2) + 200 , y - (dxGetFontHeight(1.02, "pricedown") / 2 ) + 30, 400, 60, tocolor ( 255, 0, 0, 255 ), 1.02, "pricedown" ) 
  
  
  
end 
  
draw = false 
  
addCommandHandler ( "radio", 
function() 
if ( draw == false ) then 
addEventHandler("onClientRender", root, drawStuff) 
draw = true 
elseif ( draw == true ) then 
removeEventHandler("onClientRender", root, drawStuff) 
draw = false 
end 
  
end) 
--etc.  

And on the wiki is a very good example of guiGetScreenSize.

For example, You have made a text/line in guiEditor and then you have outputted the propertys ( width,size,etc.) ( you are currently playing on 1920x1080xblah)

Now you can use those to calculate it.

Just like the wiki:

Left position value is 684, 684/1920 = 0.356

Top position value is 731, 731/1080 = 0.676

Right position values is 732, 732/1920 = 0.381

Bottom position value is 766, 766/1080 = 0.709

And then

local sWidth,sHeight = guiGetScreenSize() 
dxDrawText("I just copied the text from the wiki with some changes",sWidth*0.356, sHeight*0.676, sWidth*0.381, sHeight*0.709,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) 

ETC.

Source: wiki ;p

Hi there, danny!

Thanks for the response, mate!

I actually do know how to center a GUI without any problem, but this DX in specific where i have to center lines, texts and images it's quite different, so i would have to re-do the whole interface then in order to center it i guess?

And thanks as well for the explanations, it was clear for me, but there were some details i didn't know about, so thanks for the info.

EDIT: The only way i didn't want to try was diving directly from resolution... Thing that seems likely that i'll do... So if i get this to work, then this case will be closed and i'll be posting solution as fast as i get it done.

Link to comment

You should get a "VMware Player", you can install it on your pc and then create a virtual server and then play mta on that virtual server on a another resolution. You should google arround a bit for "VMware Player". It really helps out sometimes.

Like when creating resolution, you startup your own mta, and then start the virtual server with VMware player, start the mta on that virtual computer, join your local server, and start the script and voila ;-)

You are free to ask me more question's about converting the line's and text's for everyone's resolution.

Edit: you can convert the usefull function "centerWindow" very easy:

  
--The normal version 
function centerWindow(center_window) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(center_window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(center_window,x,y,false) 
end 
  
  
  
--converted a bit for dxDrawing. 
-- since there isn't a 'element' for dxDrawing you need to remove the function and se the 'x' and the 'y' 
  
    local screenW,screenH=guiGetScreenSize() 
--it's stil the same. 
  
    local windowW,windowH=500,500 --see down why. 
-- You need to put here your variables ( like the width and height ) 
  
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
-- this will center the rectangle preciese like the default function 
--and then you can use this: 
  
addEventHandler("onClientRender", root,  
function () 
    dxDrawRectangle ( x, y, 500, 500, tocolor ( 0, 0, 0, 150 ) ) 
-- for example a rectangle. 
end) 
  

IDK for lines, because I never worked with lines drawing ( only 3d lines lawl ).

You should play arround with it.

Kindly regards,

Danny

Link to comment
You should get a "VMware Player", you can install it on your pc and then create a virtual server and then play mta on that virtual server on a another resolution. You should google arround a bit for "VMware Player". It really helps out sometimes.

Like when creating resolution, you startup your own mta, and then start the virtual server with VMware player, start the mta on that virtual computer, join your local server, and start the script and voila ;-)

You are free to ask me more question's about converting the line's and text's for everyone's resolution.

Edit: you can convert the usefull function "centerWindow" very easy:

  
--The normal version 
function centerWindow(center_window) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(center_window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(center_window,x,y,false) 
end 
  
  
  
--converted a bit for dxDrawing. 
-- since there isn't a 'element' for dxDrawing you need to remove the function and se the 'x' and the 'y' 
  
    local screenW,screenH=guiGetScreenSize() 
--it's stil the same. 
  
    local windowW,windowH=500,500 --see down why. 
-- You need to put here your variables ( like the width and height ) 
  
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
-- this will center the rectangle preciese like the default function 
--and then you can use this: 
  
addEventHandler("onClientRender", root,  
function () 
    dxDrawRectangle ( x, y, 500, 500, tocolor ( 0, 0, 0, 150 ) ) 
-- for example a rectangle. 
end) 
  

IDK for lines, because I never worked with lines drawing ( only 3d lines lawl ).

You should play arround with it.

Kindly regards,

Danny

Already solving it... And found a solution to fit it on all resolutions.

            dxDrawLine(sx/1.33, sy/1.2, sx/1.33, sy/6, lineColor) -- Main Line (Right) 
            dxDrawLine(sx/4.01, sy/1.2, sx/4.01, sy/6, lineColor) -- Main Line (Left) 
            dxDrawLine(sx/1.33, sy/6, sx/1.36, sy/6, lineColor) -- Little Line 1 (Right) 
            dxDrawLine(sx/1.33, sy/1.2, sx/1.36, sy/1.2, lineColor) -- Little Line 2 (Right) 
            dxDrawLine(sx/4.01, sy/6, sx/3.75, sy/6, lineColor) -- Little Line 1 (Left) 
            dxDrawLine(sx/4.01, sy/1.2, sx/3.75, sy/1.2, lineColor) -- Little Line 2 (Left) 
  

It works if you set it's position by dividing the screen size... I will have to replace all positions and re-do it again. But at least i learned from this big hit.

Thanks for all the help tho' guys!! Really happy to get support for this =)

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