FuriouZ Posted May 15, 2015 Share Posted May 15, 2015 Hey! I don't know how to explain that, but basically I wan't to create an arrow (dx image) which points where the mouse cursor is What functions I need for that ? Link to comment
darhal Posted May 15, 2015 Share Posted May 15, 2015 I already asked about this and this may help viewtopic.php?f=91&t=87924 Link to comment
darhal Posted May 15, 2015 Share Posted May 15, 2015 showCursor(true) local sx, sy = guiGetScreenSize() angle = 0 addEventHandler("onClientRender", root, function() --showCursor(true) local x, y = getCursorPosition() angle = findRotation(x*sx, y*sy, 358, 276) outputChatBox(angle) dxDrawImage(358, 100, 100, 100, ":CUPvehicles/files/lock.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(140, 276, 100, 100, ":CUPvehicles/files/engine.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(537, 276, 100, 100, ":CUPvehicles/files/lights.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(358, 276, 100, 100, ":CUPvehicles/files/switch.png", angle, 0, 0, tocolor(255, 255, 255, 255), true) end ) function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end 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