Static methods for determining the current position of the mouse cursor on the screen and to emulate mouse movements and button clicks. More...
#include <mouse.h>
Public Types | |
enum | Button { Any = -1, Invalid = 0, LeftButton = 0x01, RightButton = 0x02, MiddleButton = 0x04 } |
Button values on a mouse. More... | |
Static Public Member Functions | |
static bool | IsButtonDown (const Button button=Any) |
Checks if button on the mouse is being pressed/clicked. | |
static Button | GetCurrentButton () |
Gets the current button being pressed. | |
static bool | FakeButtonPress (const Button button, const bool releaseFlag=true) |
Method used to fake a mouse button press. | |
static bool | FakeButtonRelease (const Button button) |
Method used to fake a mouse button release. | |
static bool | SetCursorPosition (const double dx, const double dy, const bool absoluteFlag=true) |
Sets the mouse cursor to an absolute position or moves it by a number of pixels relative to current position. | |
static bool | GetCursorPosition (double &x, double &y, const bool normalized=true) |
Gets the current position of the mouse cursor. | |
static bool | GetScreenResolution (unsigned int &width, unsigned int &height) |
Gets the current screen resolution. |
Static methods for determining the current position of the mouse cursor on the screen and to emulate mouse movements and button clicks.
Dependencies for Linux: libx11, libxtst
Definition at line 58 of file mouse.h.
bool Mouse::FakeButtonPress | ( | const Button | button, |
const bool | releaseFlag = true |
||
) | [static] |
bool Mouse::FakeButtonRelease | ( | const Button | button ) | [static] |
Mouse::Button Mouse::GetCurrentButton | ( | ) | [static] |
bool Mouse::GetCursorPosition | ( | double & | x, |
double & | y, | ||
const bool | normalized = true |
||
) | [static] |
Gets the current position of the mouse cursor.
[out] | x | The x position of the cursor. 0 is the left side increasing positive to the right. |
[out] | y | The y position of the cursor. 0 is the top of the screen increasing as you go down. |
[in] | normalized | If true, then the values of x and y are normalized to [0,1]. If false, the values are in screen pixels. |
bool Mouse::GetScreenResolution | ( | unsigned int & | width, |
unsigned int & | height | ||
) | [static] |
bool Mouse::IsButtonDown | ( | const Button | button = Any ) |
[static] |
bool Mouse::SetCursorPosition | ( | const double | dx, |
const double | dy, | ||
const bool | absoluteFlag = true |
||
) | [static] |
Sets the mouse cursor to an absolute position or moves it by a number of pixels relative to current position.
[in] | dx | The x position of the cursor normalized to [0,1] or the number of pixels the mouse has moved to the left or right. Positive relative movements are to the right, negative to the left. |
[in] | dy | The y position of the cursor normalized to [0,1] or the number of pixels the mouse has moved up or down. A positive value is a movement down. |
[in] | absoluteFlag | If true, dx and dy are absolute positions on the screen to move the mouse. If false, then dx an dy are relative movements in pixels. |