drk Posted October 29, 2011 Share Posted October 29, 2011 I've created a JoinQuit in DX on GUI Editor, but I want to use guiGetScreenSize() to adjust to all resolutions. Is there any way to discover the coordinates? Link to comment
12p Posted October 29, 2011 Share Posted October 29, 2011 (edited) It's a really simple operation to scale DX things to the screen. Suppose your PC uses 1024x768 as resolution on MTA, okay? Then do this: local dw = 1024 local sw = guiGetScreenSize ( ) dxDrawWhatever ( arguments... (SCALE = sw/dw ) .. more arguments ) Edited October 29, 2011 by Guest Link to comment
arezu Posted October 29, 2011 Share Posted October 29, 2011 Use the screen width and height and divide, or multiply with a value under 1.. for example: local screen_w, screen_h = guiGetScreenSize() local guiWidth = 500 local guiHeight = 500 -- creates a window with 500 pixels width and height, and puts it on the center of the screen. local guiWindow = guiCreateWindow(screen_w*0.5 - guiWidth*0.5, screen_h*0.5 - guiHeight*0.5, guiWidth, guiHeight, "Centered window", false) Link to comment
drk Posted October 31, 2011 Author Share Posted October 31, 2011 I don't understand nothing '-' Can anyone adjust to me ? pls dxDrawText( textQuit, 959.0, 246.0, 1227.0, 264.0, tocolor(0,0,0,255), 0.6, "bankgothic", "left", "top", false, false, false ) dxDrawText( textQuit, 956.0, 243.0, 1224.0, 261.0, tocolor(255,0,0,255), 0.6, "bankgothic", "left", "top", false, false, false ) Anyonee pls Link to comment
12p Posted October 31, 2011 Share Posted October 31, 2011 Tell me your screen size, please. Link to comment
arezu Posted November 1, 2011 Share Posted November 1, 2011 local screen_x, screen_y = guiGetScreenSize() local font = "bankgothic" local scale = 0.6 dxDrawText(textQuit, screen_x*(959.0/1280), screen_y*(246.0/720), screen_x*(1227.0/1280), screen_y*(264.0/720), tocolor(0,0,0,255), scale, font, "left", "top", false, false, false) dxDrawText(textQuit, screen_x*(956.0/1280), screen_y*(243.0/720), screen_x*(1224.0/1280), screen_y*(261.0/720), tocolor(255,0,0,255), scale, font, "left", "top", false, false, false) Link to comment
drk Posted November 1, 2011 Author Share Posted November 1, 2011 I will test it ! Thanks Link to comment
drk Posted November 1, 2011 Author Share Posted November 1, 2011 Can u tell me how to do this, with more details ? And adjust this to mee pls '-' dxDrawText( textJoin,943.0,217.0,1211.0,235.0,tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textJoin,939.0,213.0,1207.0,231.0,tocolor(0,255,0,255),0.6,"bankgothic","left","top",false,false,false) end ) Link to comment
CapY Posted November 1, 2011 Share Posted November 1, 2011 Can u tell me how to do this, with more details ?And adjust this to mee pls '-' dxDrawText( textJoin,943.0,217.0,1211.0,235.0,tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textJoin,939.0,213.0,1207.0,231.0,tocolor(0,255,0,255),0.6,"bankgothic","left","top",false,false,false) end ) What you did with 'textJoin' Is that some variable or a string ? If that's a string then just do from textJoin to "textJoin" If that's a variable then just do like: local textJoin = "type something here" dxDrawText(textJoin,.....) Link to comment
drk Posted November 1, 2011 Author Share Posted November 1, 2011 I know ! And it's a variable I don't posted all the code, I only need to someone tell me how to adjust the text to all resolutions '-' Link to comment
CapY Posted November 1, 2011 Share Posted November 1, 2011 I know ! It's a variable Then what you want ? Link to comment
drk Posted November 1, 2011 Author Share Posted November 1, 2011 All I need is that someone tell me with details how to adjust a DX text to all resolution's. Because I've dont understand "Use the screen width and height and divide, or multiply with a value under 1.." Link to comment
CapY Posted November 1, 2011 Share Posted November 1, 2011 I tried to adjust dx text to all resoulutions before, but it didn't worked, seems like an MTA bug. Link to comment
12p Posted November 1, 2011 Share Posted November 1, 2011 Don't pay attention to CapY. I made it on 1.0.4, there is no reason for it to don't work at 1.1 or 1.1.1. sw1 = 1280 sw2 = guiGetScreenSize ( ) dxDrawText ( textJoin, (943/sw1)*sw2, (217/sw1)*sw2, (1211/sw1)*sw2, (235/sw1)*sw2, tocolor ( 0, 0, 0, 255 ), (0.6/sw1)*sw2, "bankgothic", "left", "top", false, false, false ) dxDrawText ( textJoin, (939/sw1)*sw2, (213/sw1)*sw2, (1207/sw1)*sw2, (231/sw1)*sw2, tocolor ( 0, 255, 0, 255 ), (0.6/sw1)*sw2, "bankgothic", "left", "top", false, false, false ) If my maths are not wrong because of the long time I haven't been on school (education is stopped due to student manifestations because of the poor "free" education system ftw), that should work, man. Link to comment
CapY Posted November 1, 2011 Share Posted November 1, 2011 Don't pay attention to CapY. I made it on 1.0.4, there is no reason for it to don't work at 1.1 or 1.1.1. sw1 = 1280 sw2 = guiGetScreenSize ( ) dxDrawText ( textJoin, (943/sw1)*sw2, (217/sw1)*sw2, (1211/sw1)*sw2, (235/sw1)*sw2, tocolor ( 0, 0, 0, 255 ), (0.6/sw1)*sw2, "bankgothic", "left", "top", false, false, false ) dxDrawText ( textJoin, (939/sw1)*sw2, (213/sw1)*sw2, (1207/sw1)*sw2, (231/sw1)*sw2, tocolor ( 0, 255, 0, 255 ), (0.6/sw1)*sw2, "bankgothic", "left", "top", false, false, false ) If my maths are not wrong because of the long time I haven't been on school (education is stopped due to student manifestations because of the poor "free" education system ftw), that should work, man. Okay my bad you faggot;) Then just GUIEditor sucks. Link to comment
arezu Posted November 1, 2011 Share Posted November 1, 2011 Don't pay attention to CapY. I made it on 1.0.4, there is no reason for it to don't work at 1.1 or 1.1.1. sw1 = 1280 sw2 = guiGetScreenSize ( ) dxDrawText ( textJoin, (943/sw1)*sw2, (217/sw1)*sw2, (1211/sw1)*sw2, (235/sw1)*sw2, tocolor ( 0, 0, 0, 255 ), (0.6/sw1)*sw2, "bankgothic", "left", "top", false, false, false ) dxDrawText ( textJoin, (939/sw1)*sw2, (213/sw1)*sw2, (1207/sw1)*sw2, (231/sw1)*sw2, tocolor ( 0, 255, 0, 255 ), (0.6/sw1)*sw2, "bankgothic", "left", "top", false, false, false ) If my maths are not wrong because of the long time I haven't been on school (education is stopped due to student manifestations because of the poor "free" education system ftw), that should work, man. its not accurate to calculate positions only based on screen width, because it only works if screen "dimension" or whatever is the same as 1280x720, for example it wont work correctly on a 1280x1024 screen.. so try this instead: local screen_x, screen_y = guiGetScreenSize() -- diffX and diffY is how many times bigger the users screen resolution is compared to yours. local diffX = screen_x/1280 local diffY = screen_y/720 local font = "bankgothic" -- scaling is based on the difference of screen width. or set scale = 0.6 if you want text to have same size as your screen. looks better when only multiplying with diffX. local scale = 0.6*diffX dxDrawText(textJoin, 943.0*diffX, 217.0*diffY, 1211.0*diffX, 235.0*diffY, tocolor(0, 0, 0, 255), scale, font, "left", "top", false, false, false) dxDrawText(textJoin, 939.0*diffX, 213.0*diffY, 1207.0*diffX, 231.0*diffY, tocolor(0, 255, 0, 255), scale, font, "left", "top", false, false, false) Link to comment
12p Posted November 1, 2011 Share Posted November 1, 2011 Right, Vuze. Thank you for that Link to comment
drk Posted November 2, 2011 Author Share Posted November 2, 2011 Thanks for all tried to help me but isn't that I want. I want to adjust the text to all resolutions, example: If a player enter in a server with 800 x 600 resolution, the text is adjusted to that resolution. If a player enter in a server with 1280 x 720 resolution, the text is adjusted to that resolution. If anyone can help, I say "Thanks very much Noob !" ahshahshzhzahzahahzzahsh Link to comment
arezu Posted November 2, 2011 Share Posted November 2, 2011 Thanks for all tried to help me but isn't that I want. I want to adjust the text to all resolutions, example:If a player enter in a server with 800 x 600 resolution, the text is adjusted to that resolution. If a player enter in a server with 1280 x 720 resolution, the text is adjusted to that resolution. If anyone can help, I say "Thanks very much Noob !" ahshahshzhzahzahahzzahsh thats whats it is doing.. did you even try them? Link to comment
drk Posted November 4, 2011 Author Share Posted November 4, 2011 Yes, but it isn't what I want. When a player joins the DX text not adjust to my resolution. Just get the screen size and move that. You understand me ? Link to comment
arezu Posted November 5, 2011 Share Posted November 5, 2011 Yes, but it isn't what I want. When a player joins the DX text not adjust to my resolution. Just get the screen size and move that. You understand me ? I dont understand what you mean. Do you mean that for example if on your screen your text is in the middle of the screen, and you also want it to be in the middle of the screen for all resolutions? if not, draw a picture or something of an example. Link to comment
drk Posted November 5, 2011 Author Share Posted November 5, 2011 I've created the DX text in GUIEditor, but I want to the text adjust to all resolutions. The text appear in same location but adjusted to the resolution to be visible to the player. If resolution is 800 x 600 the text appear under the HUD but adjusted to resolution, if resolution is, ex: 1280 x 720 - Adjust the text to the screen size but in the same location. Understand ? 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