CSFML 3.0.0
Loading...
Searching...
No Matches
Enumerations | Functions
Mouse.h File Reference
`#include <CSFML/Window/Export.h>`
`#include <CSFML/System/Vector2.h>`
`#include <CSFML/Window/Types.h>`

Go to the source code of this file.

## Enumerations
enum | sfMouseButton { sfMouseLeft , sfMouseRight , sfMouseMiddle , sfMouseButtonExtra1 , sfMouseButtonExtra2 }
| Mouse buttons. More...
enum | { sfMouseButtonCount = sfMouseButtonExtra2 + 1 }
enum | sfMouseWheel { sfMouseVerticalWheel , sfMouseHorizontalWheel }
| Mouse wheels. More...

## Functions
bool | sfMouse_isButtonPressed (sfMouseButton button)
| Check if a mouse button is pressed.
sfVector2i | sfMouse_getPosition (const sfWindow *relativeTo)
| Get the current position of the mouse.
void | sfMouse_setPosition (sfVector2i position, const sfWindow *relativeTo)
| Set the current position of the mouse.
sfVector2i | sfMouse_getPositionWindowBase (const sfWindowBase *relativeTo)
| Get the current position of the mouse relative to a window base.
void | sfMouse_setPositionWindowBase (sfVector2i position, const sfWindowBase *relativeTo)
| Set the current position of the mouse relative to a window base.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
sfMouseButtonCount | The total number of mouse buttons.

Definition at line 49 of file Mouse.h.

## ◆ sfMouseButton

enum sfMouseButton

Mouse buttons.

Enumerator
sfMouseLeft | The left mouse button.
sfMouseRight | The right mouse button.
sfMouseMiddle | The middle (wheel) mouse button.
sfMouseButtonExtra1 | The first extra mouse button.
sfMouseButtonExtra2 | The second extra mouse button.

Definition at line 40 of file Mouse.h.

## ◆ sfMouseWheel

enum sfMouseWheel

Mouse wheels.

Enumerator
sfMouseVerticalWheel | The vertical mouse wheel.
sfMouseHorizontalWheel | The horizontal mouse wheel.

Definition at line 58 of file Mouse.h.

## Function Documentation

## ◆ sfMouse_getPosition()

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

## ◆ sfMouse_getPositionWindowBase()

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

## ◆ sfMouse_isButtonPressed()

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

## ◆ sfMouse_setPosition()

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

## ◆ sfMouse_setPositionWindowBase()

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