Mouse - JakeTurner616/pygame-lua-bindings GitHub Wiki

Pygame mouse functions

get_mouse_pressed(num_buttons=3)

Get the state of the mouse buttons.

Parameters:

  • num_buttons: The number of mouse buttons to check. Default is 3.

Returns: A tuple representing the state of the mouse buttons, with each value being True (pressed) or False (not pressed).

get_pos()

Get the mouse cursor position.

Returns: A tuple representing the current position of the mouse cursor (x, y).

get_rel()

Get the amount of mouse movement.

Returns: A tuple representing the relative movement of the mouse cursor since the last call (x, y).

set_pos(x, y)

Set the mouse cursor position.

Parameters:

  • x: The x-coordinate to set the mouse cursor position to.
  • y: The y-coordinate to set the mouse cursor position to.

Returns: None

set_visible(visible)

Hide or show the mouse cursor.

Parameters:

  • visible: A boolean value where True makes the cursor visible and False hides it.

Returns: The previous visibility state of the mouse cursor.

get_visible()

Get the current visibility state of the mouse cursor.

Returns: A boolean value where True indicates the cursor is visible and False indicates it is hidden.

get_focused()

Check if the display is receiving mouse input.

Returns: A boolean value where True indicates the display is receiving mouse input and False indicates it is not.

set_cursor(*args)

Set the mouse cursor to a new cursor.

Parameters:

  • *args: Arguments to set the new cursor. The exact parameters depend on the cursor type.

Returns: None

get_cursor()

Get the current mouse cursor.

Returns: The current mouse cursor.