Jump to content

Mouse Enter/Leave - events on dx rectangle


Piorun

Recommended Posts

You need use getCursorPosition in event onClientRender and check offsets rectangle.

Client side example.

local scrX, scrY = guiGetScreenSize( ) 
  
addCommandHandler( 'mouse_show', 
    function( ) 
        showCursor( not isCursorShowing( ) ) 
    end 
)    
  
addEventHandler( 'onClientRender',root, 
    function( ) 
        if isCursorShowing( ) then 
            local x, y = getCursorPosition( ) 
            x, y =  scrX * x, scrY * y 
            if x >= 537 and x <= 537-50+250 and y >= 745 and y <= 787-50+50 then 
                dxDrawText( 'test',537.0,745.0,703.0,787.0,tocolor( 255,255,255,255 ),2.0,"default","center","center",false,false,false ) 
            else 
                dxDrawText( 'test',537.0,745.0,703.0,787.0,tocolor( 255,255,255,150 ),2.0,"default","center","center",false,false,false ) 
            end 
        end 
    end 
)    
  

You can create same with rectangle.

Just change offsets.

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