Piorun Posted February 4, 2012 Share Posted February 4, 2012 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 . Link to comment
Castillo Posted February 4, 2012 Share Posted February 4, 2012 These event's only work's with GUI: Wiki quote:This event is fired when the user moves the mouse over a GUI element Link to comment
Piorun Posted February 4, 2012 Author Share Posted February 4, 2012 I know, so how to make that? Ex. im entering mouse into rectangle, and this rectangle changing color. Link to comment
Castillo Posted February 4, 2012 Share Posted February 4, 2012 Use: getCursorPosition to compare the position of the rectangle? Link to comment
Kenix Posted February 4, 2012 Share Posted February 4, 2012 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
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