pyxen.input.mouse

Access mouse position, movement, and buttons.

mouse = pyxen.input.mouse

Properties

PropertyTypeDescription
presentboolPlatform supports mouse
posVector2Current mouse position
deltaVector2Movement since last frame

Buttons

  • mouse.left
  • mouse.right
  • mouse.middle

Each is a Button object:

if mouse.left.pressed:
    print("Clicked!")

Example: Dragging

if mouse.left.down:
    pos = mouse.pos
    player.x = pos.x
    player.y = pos.y

Notes

  • All properties are read-only
  • delta resets every frame
  • Coordinates are in world/screen space depending on your engine mode