CSFML - C binding of the Simple and Fast Multimedia Library

CSFML

- Main Page
- Data Structures
- Files

- File List
- Globals

Enumerations | Functions
Mouse.h File Reference
`#include <SFML/Window/Export.h>`
`#include <SFML/Window/Types.h>`
`#include <SFML/System/Vector2.h>`

Go to the source code of this file.

## Enumerations
enum | sfMouseButton { sfMouseLeft, sfMouseRight, sfMouseMiddle, sfMouseXButton1, sfMouseXButton2, sfMouseButtonCount }
| Mouse buttons. More...
enum | sfMouseWheel { sfMouseVerticalWheel, sfMouseHorizontalWheel }
| Mouse wheels. More...

## Functions
CSFML_WINDOW_API sfBool | sfMouse_isButtonPressed (sfMouseButton button)
| Check if a mouse button is pressed. More...
CSFML_WINDOW_API sfVector2i | sfMouse_getPosition (const sfWindow *relativeTo)
| Get the current position of the mouse. More...
CSFML_WINDOW_API void | sfMouse_setPosition (sfVector2i position, const sfWindow *relativeTo)
| Set the current position of the mouse. More...

## Enumeration Type Documentation

enum sfMouseButton

Mouse buttons.

Enumerator
sfMouseLeft | The left mouse button.
sfMouseRight | The right mouse button.
sfMouseMiddle | The middle (wheel) mouse button.
sfMouseXButton1 | The first extra mouse button.
sfMouseXButton2 | The second extra mouse button.
sfMouseButtonCount | Keep last – the total number of mouse buttons.

Definition at line 40 of file Mouse.h.

enum sfMouseWheel

Mouse wheels.

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

Definition at line 55 of file Mouse.h.

## Function Documentation

CSFML_WINDOW_API 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

CSFML_WINDOW_API sfBool sfMouse_isButtonPressed | ( | sfMouseButton | button | ) |

Check if a mouse button is pressed.

Parameters

  button | Button to check

Returns
  sfTrue if the button is pressed, sfFalse otherwise

CSFML_WINDOW_API 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