DLmass Posted August 7, 2012 Share Posted August 7, 2012 Hey. How do I make the this Rectangle fit every screen resolution? local state = false function BLABLABLA ( ) dxDrawRectangle(1356.0,424.0,282.0,541.0,tocolor(0,0,0,100),false) end bindKey ( "m", "down", function ( ) state = ( not state ) removeEventHandler ( "onClientRender", root, BLABLABLA ) if ( state ) then addEventHandler ( "onClientRender", root, BLABLABLA ) end end ) Thanks. Link to comment
DLmass Posted August 7, 2012 Author Share Posted August 7, 2012 Yeah I know. I can use the Wiki ^^ I'm not asking for scripts or anything, What I'm asking for is a good explanation on how to do it. I went here because I've already been on the Wiki. Link to comment
AGENT_STEELMEAT Posted August 7, 2012 Share Posted August 7, 2012 local screenWidth, screenHeight = guiGetScreenSize() local function renderRectangle() if getKeyState("m") then dxDrawRectangle(screenWidth * 0.7, screenHeight * 0.5, screenWidth * 0.15, screenHeight * 0.5, tocolor(0,0,0,100), false) end end addEventHandler("onClientRender", root, renderRectangle) I based the relative values off of a resolution of 1920x1080, you might need to re-adjust them. Link to comment
DLmass Posted August 7, 2012 Author Share Posted August 7, 2012 Very nice example, working out from that. Link to comment
Anderl Posted August 7, 2012 Share Posted August 7, 2012 local screenWidth, screenHeight = guiGetScreenSize() local function renderRectangle() if getKeyState("m") then dxDrawRectangle(screenWidth * 0.7, screenHeight * 0.5, screenWidth * 0.15, screenHeight * 0.5, tocolor(0,0,0,100), false) end end addEventHandler("onClientRender", root, renderRectangle) I based the relative values off of a resolution of 1920x1080, you might need to re-adjust them. He asked for an explanation how to do it but you did not explain how did you get the values "0.7, 0.5, 0.15, 0.5". 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