SCA_PythonMouse(EXP_PyObjectPlus)

base class — EXP_PyObjectPlus

class SCA_PythonMouse(EXP_PyObjectPlus)

The current mouse.

Warning

Mouse normalization is using the maximum coordinate in width and height, whether bge.render.getWindowWidth() - 1 or bge.render.getWindowHeight() - 1.

A script setting the mouse at center is similar to the following example:

import bge

w, h = bge.render.getWindowWidth() - 1, bge.render.getWindowHeight() - 1
center_x, center_y = (w // 2) / w, (h // 2) / h

bge.logic.mouse.position = center_x, center_y

Note the usage of floor division to round an existing coordinate.

inputs

A dictionary containing the input of each mouse event. (read-only).

Type:dictionary {keycode:SCA_InputEvent, …}
events

a dictionary containing the status of each mouse event. (read-only).

Deprecated since version use: inputs

Type:dictionary {keycode:status, …}
activeInputs

A dictionary containing the input of only the active mouse events. (read-only).

Type:dictionary {keycode:SCA_InputEvent, …}
active_events

a dictionary containing the status of only the active mouse events. (read-only).

Deprecated since version use: activeInputs

Type:dictionary {keycode:status, …}
position

The normalized x and y position of the mouse cursor.

Type:tuple (x, y)
visible

The visibility of the mouse cursor.

Type:boolean