Created
April 30, 2016 14:45
-
-
Save ExtReMLapin/700fc33ee04f7df58020a564018bfbfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hook.Add("Think", "MouseMove hook", function() | |
local x = gui.MouseX() | |
local y = gui.MouseY() | |
if x == 0 and y == 0 then return end -- cursor not enabled | |
if not gui.OldMouseX then -- first call | |
gui.OldMouseX = x; | |
gui.OldMouseY = y; | |
end | |
if ((gui.OldMouseY ~= y) or (gui.OldMouseX ~= x)) then | |
hook.Run("MouseMoved", gui.OldMouseX, gui.OldMouseY, x, y) -- oldX, oldY, X, Y | |
gui.OldMouseX = x; | |
gui.OldMouseY = y; | |
end | |
end) | |
hook.Add("MouseMoved", "test", function(oldX, oldY, X, Y) | |
print(SysTime(), oldX, oldY, X, Y) | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment