Mouse

Enums

enum sfMouseButton

Mouse buttons.

Values:

enumerator sfMouseLeft

The left mouse button.

enumerator sfMouseRight

The right mouse button.

enumerator sfMouseMiddle

The middle (wheel) mouse button.

enumerator sfMouseButtonExtra1

The first extra mouse button.

enumerator sfMouseButtonExtra2

The second extra mouse button.

Values:

enumerator sfMouseButtonCount

The total number of mouse buttons.

enum sfMouseWheel

Mouse wheels.

Values:

enumerator sfMouseVerticalWheel

The vertical mouse wheel.

enumerator sfMouseHorizontalWheel

The horizontal mouse wheel.

Functions

bool sfMouse_isButtonPressed(sfMouseButton button)

Check if a mouse button is pressed.

Parameters:
  • button – Button to check

Returns:

true if the button is pressed, false otherwise

sfVector2i sfMouse_getPosition(const sfWindow *relativeTo)

Get the current position of the mouse.

This function returns the current position of the mouse cursor relative to the given window, or desktop if NULL is passed.

Parameters:
  • relativeTo – Reference window

Returns:

Position of the mouse cursor, relative to the given window

void sfMouse_setPosition(sfVector2i position, const sfWindow *relativeTo)

Set the current position of the mouse.

This function sets the current position of the mouse cursor relative to the given window, or desktop if NULL is passed.

Parameters:
  • position – New position of the mouse

  • relativeTo – Reference window

sfVector2i sfMouse_getPositionWindowBase(const sfWindowBase *relativeTo)

Get the current position of the mouse relative to a window base.

This function returns the current position of the mouse cursor relative to the given window base, or desktop if NULL is passed.

Parameters:
  • relativeTo – Reference window

Returns:

Position of the mouse cursor, relative to the given window base

void sfMouse_setPositionWindowBase(sfVector2i position, const sfWindowBase *relativeTo)

Set the current position of the mouse relative to a window base.

This function sets the current position of the mouse cursor relative to the given window base, or desktop if NULL is passed.

Parameters:
  • position – New position of the mouse

  • relativeTo – Reference window