[back to index]

Library Reference (v 0.12.0)

Mouse

Checking out mouse movement and clicks.
Mouse.x:Int
Returns the Mouse's x coordinate on screen.
Mouse.y:Int
Returns the Mouse's y coordinate on screen.
Mouse.deltax:Int
Returns the Mouse's change in x coordinate on screen from the last frame. Can be useful for tracking movement.
Mouse.deltay:Int
Returns the Mouse's change in y coordinate on screen from the last frame. Can be useful for tracking movement.
Mouse.mousewheel:Int
Returns 1 if the mouse has scrolled up, or -1 if the mouse has scrolled down.
Mouse.offscreen():Bool
Is true when the mouse cursor is offscreen, false otherwise.
Mouse.cursormoved():Bool
Is true if the mouse cursor has moved this frame, false otherwise.
Mouse.leftclick():Bool
True if the button has been clicked this frame.
Mouse.leftheld():Bool
True if the button is held down this frame.
Mouse.leftreleased():Bool
True if the mouse has been released this frame.
Mouse.leftdelaypressed(delay:Int):Bool
Mouse version of Input.delaypressed(). True once every N frames, if the left button is being held.
Mouse.leftforcerelease()
If the player is holding down the left mouse button, 'force' release it. Future calls to Mouse.leftheld() will return false until the player lifts their finger and clicks again.
Mouse.middleclick():Bool
True if the button has been clicked this frame.
Mouse.middleheld():Bool
True if the button is held down this frame.
Mouse.middlereleased():Bool
True if the mouse has been released this frame.
Mouse.middledelaypressed(delay:Int):Bool
Mouse version of Input.delaypressed(). True once every N frames, if the middle button is being held.
Mouse.middleforcerelease()
If the player is holding down the middle mouse button, 'force' release it. Future calls to Mouse.middleheld() will return false until the player lifts their finger and clicks again.
Mouse.rightclick():Bool
True if the button has been clicked this frame.
Mouse.rightheld():Bool
True if the button is held down this frame.
Mouse.rightreleased():Bool
True if the mouse has been released this frame.
Mouse.rightdelaypressed(delay:Int):Bool
Mouse version of Input.delaypressed(). True once every N frames, if the right button is being held.
Mouse.rightforcerelease()
If the player is holding down the right mouse button, 'force' release it. Future calls to Mouse.rightheld() will return false until the player lifts their finger and clicks again.
Mouse.leftheldpresstime:Int
Tells you how many frames the left mouse button has been pressed down for.
Mouse.rightheldpresstime:Int
Tells you how many frames the right mouse button has been pressed down for.
Mouse.middleheldpresstime:Int
Tells you how many frames the middle mouse button has been pressed down for.
Mouse.show()
Show the mouse cursor.
Mouse.hide()
Hide the mouse cursor.