Modafinil Posted July 8, 2022 Share Posted July 8, 2022 Hello, i'm trying to draw a text next to the 'watermark' that shows fps and ping In my resolution (1440x900) its normal But when i test at 800x600 ... Thas my code local sx_, sy_ = guiGetScreenSize() local sx, sy = sx_/1440, sy_/900 addEventHandler("onClientRender", root, function() local a = string.format("FPS: %d PING: %d", fps, getPlayerPing(localPlayer)) dxDrawText(a, 1250*sx, 885*sy, 1359*sx, 900*sy, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end ) I followed the methods described in this topic https://forum.multitheftauto.com/topic/96776-tut-scaling-drawinggui-elements-for-all-resolutions/ If anyone can help me, I'd appreciate it Link to comment
Overkillz Posted July 9, 2022 Share Posted July 9, 2022 (edited) Not tested addEventHandler("onClientRender", root, function() local a = string.format("FPS: %d PING: %d", 51, getPlayerPing(localPlayer)) local c_version = "MTA:SA"..getVersion().mta.."*" dxDrawText(a, 0, 0, sx-dxGetTextWidth(c_version), sy, tocolor(255, 255, 255, 255), 1, "default", "right", "bottom", false, false, false, false, false) end ) Edited July 9, 2022 by Overkillz Link to comment
AngelAlpha Posted July 10, 2022 Share Posted July 10, 2022 On 09/07/2022 at 01:09, Modafinil said: Hello, i'm trying to draw a text next to the 'watermark' that shows fps and ping In my resolution (1440x900) its normal But when i test at 800x600 ... Thas my code local sx_, sy_ = guiGetScreenSize() local sx, sy = sx_/1440, sy_/900 addEventHandler("onClientRender", root, function() local a = string.format("FPS: %d PING: %d", fps, getPlayerPing(localPlayer)) dxDrawText(a, 1250*sx, 885*sy, 1359*sx, 900*sy, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end ) I followed the methods described in this topic https://forum.multitheftauto.com/topic/96776-tut-scaling-drawinggui-elements-for-all-resolutions/ If anyone can help me, I'd appreciate it local sx, sy = guiGetScreenSize() local px = math.min(1, math.max(sx/1920, sy/1080)) addEventHandler("onClientRender", root, function() local a = string.format("FPS: %d PING: %d", fps, getPlayerPing(localPlayer)) dxDrawText(a, sx - 190*px, sy - 15*px, sx, sy, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end ) Try this 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