Leo Messi Posted November 2, 2016 Share Posted November 2, 2016 Hello, when I try to create dx Rectangle, I find that it's not in its position in another resolutions, any solutions? please. Link to comment
iPrestege Posted November 2, 2016 Share Posted November 2, 2016 use : g guiGetScreenSize -- Make sure to read the wiki page and read examples. Link to comment
Leo Messi Posted November 2, 2016 Author Share Posted November 2, 2016 I know this... How I can use it? Link to comment
iPrestege Posted November 2, 2016 Share Posted November 2, 2016 2 minutes ago, majdxd said: I know this... How I can use it? I HAVE ASKED YOU IN THE PREVIOUS POST TO READ THE : O WIKI PAGE : Using guiGetScreenSize to fit GUI & DX drawing in all resolutions To get the precise coordinates of a GUI element or DX drawings, you need to decide which edges of the screen you want to have them positioned against, then you just need to find the difference between your screen size and your position values. For example, there is a DX text. It fits on 1024x768 resolution. function DXtext () dxDrawText(tostring "Hello World!",684.0,731.0,732.0,766.0,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) end addEventHandler ( "onClientRender", getRootElement(), DXtext ) Now if you want it to fit on all resolutions. Then follow these steps: 1. Add width and height variables to get GUI's screen size, here we use sWidth and sHeight. local sWidth,sHeight = guiGetScreenSize() -- The variables dxDrawText( "Hello World!",684.0,731.0,732.0,766.0,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) 2. Divide each of the DX text's position values by the screen size manually (remembering the resolution is 1024x768): Left position value is 684, 684/1024 = 0.668 Top position value is 731, 731/768 = 0.952 Right position values is 732, 732/1024 = 0.715 Bottom position value is 766, 766/768 = 0.997 You may want to use a calculator to help you count. 3. Now with the answer above remove all of the position values and replace it with the width or height variable multiplied by the answer. Which would be: local sWidth,sHeight = guiGetScreenSize() -- The variables dxDrawText("Hello World!",sWidth*0.668, sHeight*0.952, sWidth*0.715, sHeight*0.997,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) So the final results will be a DX text which will fit on all resolutions which will be: function DXtext () local sWidth,sHeight = guiGetScreenSize() -- The variables dxDrawText("Hello World!",sWidth*0.668, sHeight*0.952, sWidth*0.715, sHeight*0.997,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) end addEventHandler ( "onClientRender", getRootElement(), DXtext ) We can also do it by ourself doing some calculations in the code. This works in all resolution, adjusting the scale to all screen-sizes. local sx, sy = guiGetScreenSize( ) addEventHandler( "onClientRender", root, function( ) dxDrawText( "Hello World!", sx*( 684/1024 ), sy*( 731/768 ), sx*( 732/1024 ), sy( 766/768 ), tocolor(0,255,255,175), sx/1000*1.0,"bankgothic","left","top",false,false,false ) end ) Link to comment
Leo Messi Posted November 2, 2016 Author Share Posted November 2, 2016 I DONT NEED YOUR HELP IF YOUR NOT RESPECTFUL LOCK THIS TOPIC! Link to comment
iPrestege Posted November 2, 2016 Share Posted November 2, 2016 So you are saying i didn't respect you? really? i asked you to read the wiki and the examples and you post how to do it , It's all in the wiki and in the examples i think you know how to do it now and that's why you asked to lock this topic anyway if you are not going to read the wiki you will not become a scripter ever so good luck! Link to comment
Dealman Posted November 2, 2016 Share Posted November 2, 2016 Well if you had actually read the wiki page, you would have seen that. So it's rather obvious you didn't look at it at all. With an attitude like that you're quite frankly not worth the time and effort to try and help, so good luck. 1 Link to comment
raynner Posted November 2, 2016 Share Posted November 2, 2016 (edited) this should be one of the easiest to use try to use it local screenW,screenH = guiGetScreenSize() local resW, resH = 1280,720 -- resolution creating the dxDraw local x, y = (screenW/resW), (screenH/resH) -- just add. -- x*width, y*height ... dxDrawRectangle(x*303, y*158, x*579, y*27, tocolor(0, 255, 150, 255), false) ------ dxDrawText("Your Text", x*303, y*158, x*882, y*185, tocolor(255, 255, 255, 255), x*1.00, "default-bold", "center", "center", false, false, false, false, false) Edited November 2, 2016 by raynner Link to comment
Leo Messi Posted November 3, 2016 Author Share Posted November 3, 2016 (edited) 21 hours ago, FaHaD said: So you are saying i didn't respect you? really? i asked you to read the wiki and the examples and you post how to do it , It's all in the wiki and in the examples i think you know how to do it now and that's why you asked to lock this topic anyway if you are not going to read the wiki you will not become a scripter ever so good luck! You seem have a mind of kids, so I won't reply you because I already read wiki examples By the way, I didn't register here to make fights with anyone, at the end it will stay a game @raynner thanks for your help, I am going to test it and I will reply you if it worked. Edited November 3, 2016 by majdxd Link to comment
iPrestege Posted November 3, 2016 Share Posted November 3, 2016 Just now, majdxd said: You seem have a mind of kids, so I won't reply you because I already read wiki examples By the way, I didn't register here to make fights with anyone, at the end it will stay a game @raynner thanks for your help, I am going to test it and I will reply you if it's worked. if you ever read the wiki as Dealman said you will know how to use it but i think you didn't even read the wiki examples because if you did you will know how to use that function but you are looking for someone to make it for you so yeah i waste my time in this topic trying give you some help. Link to comment
Dealman Posted November 3, 2016 Share Posted November 3, 2016 9 minutes ago, majdxd said: You seem have a mind of kids, so I won't reply you because I already read wiki examples And you expect us to help you? Not only are you being rude to someone trying to help you, you're outright lying to us. It's literally on the page he linked you, in bold text. It's described in detail how it works. Next time try and be a bit mature and appreciate the fact people are taking their time helping you. 1 Link to comment
Leo Messi Posted November 3, 2016 Author Share Posted November 3, 2016 Guys, get out from this case, I won't answer both of you, I don't need your help guys, lol, I never expected to get help from both of you guys, get lost. 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