DLmass Posted August 7, 2012 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.
denny199 Posted August 7, 2012 Posted August 7, 2012 guiGetScreenSize ( ) Sometimes I dream about cheese
DLmass Posted August 7, 2012 Author 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.
AGENT_STEELMEAT Posted August 7, 2012 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.
Anderl Posted August 7, 2012 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". "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
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