Jump to content

Dx Rectangle Resolution


Chaos

Recommended Posts

Hi, i'm trying to draw DX Rectangle and fit it with all screen resolutions but i can't figure what's wrong with rectangle it seems doesn't fit, here's the code :

 

local sWidth, sHeight = guiGetScreenSize()
local sx, sy = sWidth/1280, sHeight/720


addEventHandler("onClientRender", root,
    function()
        dxDrawRectangle(sx*506, sy*616, sx*297, sy*76, tocolor(0, 0, 0, 133),true)
        dxDrawText("Team 1 Score: 0", sx*556, sy*626, sx*793, sy*650, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Team 2 Score: 0", sx*556, sy*658, sx*793, sy*682, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "left", "top", false, false, true, false, false)
    end
)

 

as you can see here it's fine with res 1280 * 720

http://image.prntscr.com/image/402d0c42b10341c2be6bc64d90498aca.png

and here with res 800 * 600

http://image.prntscr.com/image/24f660b05d2243a6916d4d42d392bf96.png

 

Link to comment
    local sWidth, sHeight = guiGetScreenSize()
    local sx, sy = (1/1280)*sWidth, (1/720)*sHeight
    addEventHandler("onClientRender", root,
        function()
            dxDrawRectangle(sx*506, sy*616, sx*297, sy*76, tocolor(0, 0, 0, 133),true)
            dxDrawText("Team 1 Score: 0", sx*556, sy*626, sx*793, sy*650, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "left", "top", false, false, true, false, false)
            dxDrawText("Team 2 Score: 0", sx*556, sy*658, sx*793, sy*682, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "left", "top", false, false, true, false, false)
        end
    )

 

Link to comment
local sWidth, sHeight = guiGetScreenSize ( )
local sx, sy = sWidth/1280, sHeight/720

addEventHandler ( "onClientRender", root,
    function ( )
        dxDrawRectangle ( sx*506, sy*616, sx*297, sy*76, tocolor ( 0, 0, 0, 133 ), true )
        dxDrawText ( "Team 1 Score: 0", sx*556, sy*626, sx*793, sy*650, tocolor ( 255, 255, 255, 255 ), sx*0.80, "bankgothic", "left", "top", false, false, true, false, false )
        dxDrawText ( "Team 2 Score: 0", sx*556, sy*658, sx*793, sy*682, tocolor ( 255, 255, 255, 255 ), sx*0.80, "bankgothic", "left", "top", false, false, true, false, false )
    end
)

 

Link to comment
4 minutes ago, KariiiM said:

local sWidth, sHeight = guiGetScreenSize ( )
local sx, sy = sWidth/1280, sHeight/720

addEventHandler ( "onClientRender", root,
    function ( )
        dxDrawRectangle ( sx*506, sy*616, sx*297, sy*76, tocolor ( 0, 0, 0, 133 ), true )
        dxDrawText ( "Team 1 Score: 0", sx*556, sy*626, sx*793, sy*650, tocolor ( 255, 255, 255, 255 ), sx*0.80, "bankgothic", "left", "top", false, false, true, false, false )
        dxDrawText ( "Team 2 Score: 0", sx*556, sy*658, sx*793, sy*682, tocolor ( 255, 255, 255, 255 ), sx*0.80, "bankgothic", "left", "top", false, false, true, false, false )
    end
)

 

Actually that's the code i posted

Link to comment
  • 3 weeks later...

Getting dxtext to be PERFECT for ALL resolutions is hard. I'd advise you to make it look as you want it to on the most widely used ones and try making it look 'good' on lower resolutions (so that those guys can still get the idea although not as perfect as the other resolutions). Like, who uses 800x600 :D

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