Jump to content

dxDraw


DLmass

Recommended Posts

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
  
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
  
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...