Chaos Posted September 9, 2016 Share Posted September 9, 2016 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
Captain Cody Posted September 9, 2016 Share Posted September 9, 2016 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
Chaos Posted September 9, 2016 Author Share Posted September 9, 2016 it's still the same nothing has changed http://image.prntscr.com/image/f14f5945dae24f908d27600a081e9d7a.png Link to comment
KariiiM Posted September 9, 2016 Share Posted September 9, 2016 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
Chaos Posted September 9, 2016 Author Share Posted September 9, 2016 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
KariiiM Posted September 9, 2016 Share Posted September 9, 2016 I did a change for text scale, just try what I posted it should do the job. Link to comment
Chaos Posted September 9, 2016 Author Share Posted September 9, 2016 it works great thanks a lot Link to comment
KariiiM Posted September 9, 2016 Share Posted September 9, 2016 6 minutes ago, Chaos said: it works great thanks a lot You're welcome. Link to comment
koragg Posted September 27, 2016 Share Posted September 27, 2016 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 Link to comment
Dealman Posted September 27, 2016 Share Posted September 27, 2016 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. 1 Link to comment
koragg Posted September 28, 2016 Share Posted September 28, 2016 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 Link to comment
KariiiM Posted September 30, 2016 Share Posted September 30, 2016 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 If I'm not wrong, you can script a code for that Link to comment
koragg Posted September 30, 2016 Share Posted September 30, 2016 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. 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