sge.mouse

This module provides functions related to the mouse input.

Many other mouse functionalities are provided through attributes of sge.game.mouse:

  • sge.game.mouse.x and sge.game.mouse.y indicate the position of the mouse relative to the room. Set these attributes to change the position of the mouse.
  • sge.game.mouse.xvelocity, sge.game.mouse.yvelocity, sge.game.mouse.speed, and sge.game.mouse.move_direction indicate the average movement of the mouse during the last 250 milliseconds. They cannot be manually set.
  • sge.game.mouse.sprite controls what the mouse cursor looks like. Set to None for the default mouse cursor.
  • sge.game.mouse.visible controls whether or not the mouse cursor is visible.

sge.mouse Functions

sge.mouse.get_pressed(button)[source]

Return whether or not a mouse button is pressed.

See the documentation for sge.input.MouseButtonPress for more information.

sge.mouse.get_x()[source]

Return the horizontal location of the mouse cursor.

This function differs from sge.game.mouse.x in that the location returned is relative to the window, not the room.

sge.mouse.get_y()[source]

Return the vertical location of the mouse cursor.

This function differs from sge.game.mouse.y in that the location returned is relative to the window, not the room.

Table Of Contents

Previous topic

sge.keyboard

This Page