mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 20:43:26 +02:00
Refactor for documentation
This commit is contained in:
@@ -1,37 +1,38 @@
|
||||
Mouse = {}
|
||||
-- @docclass
|
||||
g_mouse = {}
|
||||
|
||||
local cursorChanged = false
|
||||
|
||||
function Mouse.setTargetCursor()
|
||||
function g_mouse.setTargetCursor()
|
||||
g_window.setMouseCursor('/cursors/targetcursor.png', {x=9,y=9})
|
||||
cursorChanged = true
|
||||
end
|
||||
|
||||
function Mouse.setHorizontalCursor()
|
||||
function g_mouse.setHorizontalCursor()
|
||||
g_window.setMouseCursor('/cursors/horizontal.png', {x=9,y=4})
|
||||
cursorChanged = true
|
||||
end
|
||||
|
||||
function Mouse.setVerticalCursor()
|
||||
function g_mouse.setVerticalCursor()
|
||||
g_window.setMouseCursor('/cursors/vertical.png', {x=4,y=9})
|
||||
cursorChanged = true
|
||||
end
|
||||
|
||||
function Mouse.restoreCursor()
|
||||
function g_mouse.restoreCursor()
|
||||
g_window.restoreMouseCursor()
|
||||
cursorChanged = false
|
||||
end
|
||||
|
||||
function Mouse.isCursorChanged()
|
||||
function g_mouse.isCursorChanged()
|
||||
return cursorChanged
|
||||
end
|
||||
|
||||
function Mouse.isPressed(button)
|
||||
function g_mouse.isPressed(button)
|
||||
if not button then button = MouseLeftButton end
|
||||
return g_window.isMouseButtonPressed(button)
|
||||
end
|
||||
|
||||
function Mouse.bindAutoPress(widget, callback)
|
||||
function g_mouse.bindAutoPress(widget, callback)
|
||||
connect(widget, { onMousePress = function(widget, mousePos, mouseButton)
|
||||
callback()
|
||||
periodicalEvent(function()
|
||||
@@ -43,7 +44,7 @@ function Mouse.bindAutoPress(widget, callback)
|
||||
end })
|
||||
end
|
||||
|
||||
function Mouse.bindPressMove(widget, callback)
|
||||
function g_mouse.bindPressMove(widget, callback)
|
||||
connect(widget, { onMouseMove = function(widget, mousePos, mouseMoved)
|
||||
if widget:isPressed() then
|
||||
callback(mousePos, mouseMoved)
|
||||
|
Reference in New Issue
Block a user