JuniorMelo Posted July 11, 2013 Share Posted July 11, 2013 Hello I have a problem in this script pictures resolution (800 x 600 x 16) resolution (1280 x 720 x 32) button changes location function onClickNext () local x, y = guiGetScreenSize () vx = x + 600 vy = y - 610 Nexx = guiCreateButton (vx*0.1-138, vy*0.1, 130, 20, "Next", false ) addEventHandler("onClientGUIClick",Nexx,onLog) guiSetAlpha(Nexx, 0 ) end function Next() local x, y = guiGetScreenSize () tx = x + 600 ty = y - 610 dxDrawRectangle ( tx*0.1-138, ty*0.1, 130, 20, tocolor ( 0, 0, 0, 200 ) ) dxDrawColorText ("Next", tx*0.1-135, ty*0.1, tx, ty, tocolor(255,255,255,255), 1.3, "default-bold", "nil", "nil" ) end Link to comment
itoko Posted July 11, 2013 Share Posted July 11, 2013 If you just want it in the corner, then don't use screen size. function Next() local x, y = guiGetScreenSize () tx = 0 ty = 10 dxDrawRectangle ( tx, ty, 130, 20, tocolor ( 0, 0, 0, 200 ) ) dxDrawColorText ("Next", tx+3, ty, tx, ty, tocolor(255,255,255,255), 1.3, "default-bold","nil","nil") end addEventHandler("onClientRender",getRootElement(),Next) But you can also make the positions relative. (divide your position by the screensize ==> tx/x ty/y and then replace the pics) Link to comment
JuniorMelo Posted July 11, 2013 Author Share Posted July 11, 2013 Thanks helped me a lot But I have another problem, Also with the resolution ============Panel Test============ resolution (800 x 600 x 16) resolution (1280 x 720 x 32) function onClick () local x, y = guiGetScreenSize () tx = 30 ty = 251 edit_Login = guiCreateEdit(tx,ty,280, 35,"",false ) guiSetFont(edit_Login,"default-bold-small") edit_password = guiCreateEdit(tx,ty+80,280,35,"",false ) guiSetFont(edit_password,"default-bold-small") guiEditSetMaxLength ( edit_Login,25) guiEditSetMaxLength ( edit_password,25) guiEditSetMasked ( edit_password, true ) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), onClick ) function Win() local x, y = guiGetScreenSize () sx = x sy = y + 400 tx = 20 ty = 200 dxDrawRectangle ( tx, 200, 300, 25, tocolor ( 0, 255, 0, 255 ) ) dxDrawRectangle ( tx, ty, 300, 350, tocolor ( 0, 0, 0, 155 ) ) dxDrawText ( "Nick", 20+10, sy*0.2+20, sx, sy, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold") dxDrawText ( "Password", 20+10, sy*0.2+100, sx, sy, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold") end addEventHandler ("onClientRender", getRootElement(), Win ) can help Link to comment
pino-boy Posted July 11, 2013 Share Posted July 11, 2013 Test ....... function onClick () local x, y = guiGetScreenSize () fx = 30 fy = 251 edit_Login = guiCreateEdit(tx,ty,280, 35,"",false ) guiSetFont(edit_Login,"default-bold-small") edit_password = guiCreateEdit(tx,ty+80,280,35,"",false ) guiSetFont(edit_password,"default-bold-small") guiEditSetMaxLength ( edit_Login,25) guiEditSetMaxLength ( edit_password,25) guiEditSetMasked ( edit_password, true ) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), onClick ) function Win() local x, y = guiGetScreenSize () sx = x sy = y + 400 tx = 20 ty = 200 dxDrawRectangle ( tx, 200, 300, 25, tocolor ( 0, 255, 0, 255 ) ) dxDrawRectangle ( tx, ty, 300, 350, tocolor ( 0, 0, 0, 155 ) ) dxDrawText ( "Nick", 20+10, sy*0.2+20, sx, sy, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold") dxDrawText ( "Password", 20+10, sy*0.2+100, sx, sy, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold") end addEventHandler ("onClientRender", getRootElement(), Win ) Link to comment
JuniorMelo Posted July 11, 2013 Author Share Posted July 11, 2013 centerWindow not working Link to comment
JuniorMelo Posted July 11, 2013 Author Share Posted July 11, 2013 this and the problem local x, y = guiGetScreenSize () fx = 30 fy = 251 not working Link to comment
DNL291 Posted July 11, 2013 Share Posted July 11, 2013 Try this: function onClick () local x, y = guiGetScreenSize () edit_Login = guiCreateEdit(x*0.023, y*0.360, x*0.219, y*0.049, "", false ) guiSetFont(edit_Login,"default-bold-small") edit_password = guiCreateEdit(x*0.023, y*0.460, x*0.219, y*0.049, "", false ) guiSetFont(edit_password,"default-bold-small") guiEditSetMaxLength ( edit_Login,25) guiEditSetMaxLength ( edit_password,25) guiEditSetMasked ( edit_password, true ) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), onClick ) function Win() local x, y = guiGetScreenSize () dxDrawRectangle ( x*0.016, y*0.278, x*0.234, y*0.035, tocolor ( 0, 255, 0, 255 ) ) dxDrawRectangle ( x*0.016, y*0.278, x*0.234, y*0.486, tocolor ( 0, 0, 0, 155 ) ) dxDrawText("Nick", x*0.024, y*0.324, x*0.235, y*0.353, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold") dxDrawText("Password", x*0.024, y*0.424, x*0.235, x*0.453, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold") end addEventHandler ("onClientRender", getRootElement(), Win ) 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