Jump to content

Mouse Enter/Leave - events on dx rectangle


Piorun

Recommended Posts

Posted

How to use this event on rectangle made by directx function? For example I have few rectangles and i want to sign one of this when im entering into rectangle. Pls help me :).

Posted

These event's only work's with GUI:

Wiki quote:

This event is fired when the user moves the mouse over a GUI element

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Use:

getCursorPosition 

to compare the position of the rectangle?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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.

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

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