MisterQuestions Posted December 31, 2014 Share Posted December 31, 2014 Hey, it is possible, to make when the cursor gets over a interface of rectangle, text or something, change it color, size or thing like that?? How, and what measures i should use? Link to comment
MTA Team botder Posted December 31, 2014 MTA Team Share Posted December 31, 2014 Do you mean DirectX windows or GUI? Link to comment
MisterQuestions Posted December 31, 2014 Author Share Posted December 31, 2014 dx Interface, like rectangles, texts, images... Link to comment
Castillo Posted December 31, 2014 Share Posted December 31, 2014 You can use this simple function: function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing ( ) ) then return false end local sx, sy = guiGetScreenSize ( ) -- Get the player screen resolution local cx, cy = getCursorPosition ( ) -- Get the cursor position local cx, cy = ( cx * sx ), ( cy * sy ) -- Convert relative positions to absolute if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end Example: addEventHandler ( "onClientRender", root, function ( ) local color = tocolor ( 0, 0, 0 ) if isMouseInPosition ( 200, 200, 50, 50 ) then color = tocolor ( 255, 0, 0 ) end dxDrawRectangle ( 200, 200, 50, 50, color ) end ) Link to comment
MisterQuestions Posted December 31, 2014 Author Share Posted December 31, 2014 Oh crist, thanks!! 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