Jump to content

Dx Rectangle Resolution


Chaos

Recommended Posts

Posted

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

 

Posted
    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
    )

 

Posted
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
)

 

Posted
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

  • 3 weeks later...
Posted

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

Posted

Most of the time you can get away by doing what @KariiiM did, in that you change the scale depending on the resolution. Depending on the font and how much smaller the resolution is, it may or may not work.

  • Like 1
Posted

Yes, I also always change font scale same way as he did but some things just can't get fixed for every resolution, which you gotta just live with I guess :P

Posted
On 28/09/2016 at 8:29 PM, koragg said:

Yes, I also always change font scale same way as he did but some things just can't get fixed for every resolution, which you gotta just live with I guess :P

If I'm not wrong, you can script a code for that

Posted
18 minutes ago, KariiiM said:

If I'm not wrong, you can script a code for that

If so, I'd be happy to see an example as I myself have a few dxdrawings that should look nice on pretty much any resolution but on some unknown resolutions they just look horrible.

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