Enargy, Posted February 1, 2015 Share Posted February 1, 2015 Hi guys, I'm working on a point system but when do the work of rendering the following emerges: local screenW, screenH = guiGetScreenSize() local x, y = (screenW/1024), (screenH/768) local size = 1.50 --- the size of the text font addEventHandler("onClientRender", root, function() local playerCoins = getPlayerCoins(getLocalPlayer()) dxDrawText("C"..gPlayerCoins(playerCoins), x*795, y*170, x*973, 198, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*795, y*166, x*973, 198, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*800, y*166, x*973, 196, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*795, y*171, x*971, 198, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*800, y*171, x*971, 198, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*796, y*168, x*971, 196, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*797, y*169, x*972, 197, tocolor(100, 100, 255, 200), size, "pricedown", "left", "top", false, false, false, false, false) end) the script works totally fine but when a player has a higher or lower resolution than the acquiree as text size varies with different ones. I was thinking of doing the calculations using the font size of the text but I have no idea how to calculate the size of the font for all resolutions. ty. Link to comment
Jaysds1 Posted February 1, 2015 Share Posted February 1, 2015 You would need to use these functions to calculate the font size: dxGetTextWidth --Width dxGetFontHeight --Height Link to comment
Dimmitry007 Posted February 1, 2015 Share Posted February 1, 2015 local screenW, screenH = guiGetScreenSize() local x, y = (screenW/1024), (screenH/768) just change that Link to comment
TAPL Posted February 1, 2015 Share Posted February 1, 2015 Try/ local screenW, screenH = guiGetScreenSize() local x, y = (screenW/1024), (screenH/768) local size = y*1.50 --- the size of the text font addEventHandler("onClientRender", root, function() local playerCoins = getPlayerCoins(getLocalPlayer()) dxDrawText("C"..gPlayerCoins(playerCoins), x*795, y*170, x*973, y*198, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*795, y*166, x*973, y*198, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*800, y*166, x*973, y*196, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*795, y*171, x*971, y*198, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*800, y*171, x*971, y*198, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*796, y*168, x*971, y*196, tocolor(0, 0, 0, 255), size, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("C"..gPlayerCoins(playerCoins), x*797, y*169, x*972, y*197, tocolor(100, 100, 255, 200), size, "pricedown", "left", "top", false, false, false, false, false) end) 1 Link to comment
xScatta Posted February 1, 2015 Share Posted February 1, 2015 Hey man u can use two values for the dxDrawText scale dxDrawText the size of the text.scale: can (optionally) be specified as two floats. i.e. scaleX, scaleY Link to comment
Enargy, Posted February 1, 2015 Author Share Posted February 1, 2015 @TAPL thank you, and others for your attention. it works perfectly. 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