From 944a250ec557834d9bd236cbc30fee6a2105dd3e Mon Sep 17 00:00:00 2001 From: Saggi Mizrahi Date: Sat, 10 May 2014 19:11:23 +0300 Subject: [PATCH] Allow overriding of the mouse position getter. Useful if the ui is positioned behind the camera as opposed as in front of it. Signed-off-by: Saggi Mizrahi --- mouse.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mouse.lua b/mouse.lua index a7d6d6c..85db24b 100644 --- a/mouse.lua +++ b/mouse.lua @@ -60,7 +60,7 @@ end local function beginFrame() hot = nil - x,y = love.mouse.getPosition() + x,y = _M.getMousePosition() downLast = down down = false for _,btn in ipairs{'l', 'm', 'r'} do @@ -103,6 +103,7 @@ _M = { disable = disable, enable = enable, + getMousePosition = love.mouse.getPosition } -- metatable provides getters to x, y and down