Jump to content

Tocolor Dx Rectangle


Mefisto_PL

Recommended Posts

I don't understand how to use tocolor in this situation :/

local bg = tocolor ( 0, 158, 255, 200 ) 
local wbg = tocolor ( 0, 0, 0, 200 ) 
  
function dupa ( ) 
    dxDrawRectangle ( x/3.7, y/3.9, x/2.02, y/2.2, bg ) 
    dxDrawRectangle ( x/3.6, y/3.5, x/2.08, y/2.4, wbg ) 
    local blackpoint = dxDrawRectangle ( x/1.357, y/3.8, x/50, y/50, tocolor ( 0, 0, 0, 255 ) ) 
end 
  
function blackBG ( clickedElement ) 
        if ( clickedElement == blackpoint ) then 
        bg = tocolor ( 0, 0, 0, 250 ) 
        wbg = tocolor ( 255, 255, 255, 250 ) 
        end 
end 
addEventHandler ( "onClientClick", getRootElement(), blackBG ) 

Link to comment

TAPL, you mean I must do that:

function blackBG ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) 
        if ( button == blackpoint ) then 
        bg = tocolor ( 0, 0, 0, 250 ) 
        wbg = tocolor ( 255, 255, 255, 250 ) 
        end 
end 
addEventHandler ( "onClientClick", getRootElement(), blackBG ) 

right? It doesn't working.

Link to comment
TAPL, you mean I must do that:
function blackBG ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) 
        if ( button == blackpoint ) then 
        bg = tocolor ( 0, 0, 0, 250 ) 
        wbg = tocolor ( 255, 255, 255, 250 ) 
        end 
end 
addEventHandler ( "onClientClick", getRootElement(), blackBG ) 

right? It doesn't working.

Nope.

button: This refers the button used to click on the mouse, can be left, right, or middle'

What you looking for is clickedElement but since dxDrawRectangle aren't element, you can't use it until you find some other way like creating invisible window - label - or whatever in same position of the dxDrawRectangle, or you can check the clicked position with absoluteX and absoluteY.

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