Skip to content

obsi.mouse

simadude edited this page Oct 27, 2023 · 1 revision

This module is made for checking the mouse position and the pressed buttons. It is very similar to Love2D, so mostt of it would be cross-compatible.

Beware that functions like obsi.mouse.getPosition, obsi.mouse.getX and obsi.mouse.getY return the position of the mouse on the terminal, not on the canvas.

Functions of obsi.mouse: Functions of obsi.mouse:

function description
obsi.mouse.getX Returns the last position of the mouse on X axis.
obsi.mouse.getY Returns the last position of the mouse on Y axis.
obsi.mouse.getPosition Returns the last position of the mouse on X axis.
obsi.mouse.canMove Returns either true or false if "mouse_move" event can fire on CraftOS-PC
obsi.mouse.isDown Returns if true or false if the mouse button is down.

Functions

obsi.mouse.getX

Returns the last position of the mouse on X axis.

Declared as:

obsi.mouse.getX() -> number

obsi.mouse.getY

Returns the last position of the mouse on Y axis.

Declared as:

obsi.mouse.getY() -> number

obsi.mouse.getPosition

Returns the last position of the mouse on X axis.

Declared as:

obsi.mouse.getPosition() -> number, number

obsi.mouse.canMove

Returns either true or false if "mouse_move" event can fire on CraftOS-PC

Declared as:

obsi.mouse.canMove() -> boolean

obsi.mouse.isDown

Returns if true or false if the mouse button is down.

Declared as:

obsi.mouse.isDown(button: number) -> boolean
Clone this wiki locally