Karuzo Posted February 1, 2014 Share Posted February 1, 2014 Hey Guys, so i have again a question about my scoreboard. I have this code : dxDrawImage((x- 720)/2, (y-460) /2, 720, 460, "images/back.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Name", (x - 110) / 2.3, (y - 29) / 3.7, 110,29, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText(getPlayersOnline().."/50" ,(x - 101) / 1.25, (y - 27) / 4.3, ((x - 101) / 1.25) + 101, ( (y - 27) / 4.3) + 27, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Germain Kaff Reillife by Blackpotato", (x - 168) / 1.7, (y - 23) / 4.2, ((x - 168) / 1.7) + 168, ( (y - 23) / 3.-- s8) --> + 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Ping", (x - 110) / 1.25, (y - 29) / 3.7, ((x - 110) / 1.25) + 10, ( (y - 29) / 3.7) + 29, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Money", (x - 110) / 1.78, (y - 29) / 3.7, ((x - 110) / 1.78) + 110, ( (y - 29) / 3.7) + 29, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) Ok. so whats my question ? The dxText's aren't in that place where they should be . So i searched a little bit in the forum, i've found out that i need to do them in relative. But wiki says: left: the absolute X coordinate of the top left corner of the text I should give the coordinates in absolute. So what's right now ? Link to comment
Gallagher Posted February 1, 2014 Share Posted February 1, 2014 local screenWidth, screenHeight = guiGetScreenSize ( ) dxDrawText("TEXT",screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) I do so and it works Link to comment
Karuzo Posted February 1, 2014 Author Share Posted February 1, 2014 Thank you for your reply. But how do i know what 720 is in relative ? Btw, isn't x-720/2 not the same as x*0.720 ? Link to comment
Gallagher Posted February 1, 2014 Share Posted February 1, 2014 Thank you for your reply.But how do i know what 720 is in relative ? Btw, isn't x-720/2 not the same as x*0.720 ? I do not know much, but be assured that this script works in all resolutions Link to comment
Karuzo Posted February 1, 2014 Author Share Posted February 1, 2014 hmm ok thank you. Link to comment
Karuzo Posted February 1, 2014 Author Share Posted February 1, 2014 Could someone explain it to me please ? Link to comment
pa3ck Posted February 1, 2014 Share Posted February 1, 2014 Relative: Left hand side of your screen is 0 and the right hand side of your screen is 1. So 0.5 is the centre. Absolute: As far as I know, it is counted in pixels, so, '20, 20' is going to be at the 20th pixel of your screen, if you get me. How to get the relative: Simple maths. Lets say, you want to draw a dxRectangle, starting at 0, 0 and you want the size to be half of the screen. Just do: local sX, sY = guiGetScreenSize() local rX, rY = sX * 0.5, sY * 0.5 -- 50% dxDrawRectangle(0, 0, rX, rY) Link to comment
arezu Posted February 1, 2014 Share Posted February 1, 2014 This same question has been asked at least 70 times on this forum already. Please search on the forum first with the search button. Link to comment
Karuzo Posted February 1, 2014 Author Share Posted February 1, 2014 So i searched a little bit in the forum, i've found out that i need to do them in relative. But wiki says: left: the absolute X coordinate of the top left corner of the text I've been searching a long time and didn't understand it. So i opened a thread that people may help me. B2T: pa3ck thank you , i think i ve now understood it. If ive got more questions ill post them here. 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