Public Member Functions | |
bool | CheckButtonState (int button) |
Checks button state. | |
Rect & | GetPosition () |
Returns the mouse position in the game window. | |
Rect & | GetRelativePosition () |
Returns the mouse relative position in the game window. | |
void | SetButtonState (bool pressed, int button) |
Sets button state. | |
void | SetPosition (int x, int y) |
Sets the mouse position. | |
void | SetRelativePosition (int x, int y) |
Sets the mouse relative position. | |
void | ShowCursor (bool show) |
Toggle whether or not the cursor is shown on the screen. | |
Static Public Member Functions | |
static Mouse * | GetInstance (void) |
Gets an object for this class. | |
Static Public Attributes | |
static const int | LEFT_BUTTON = 1 |
Left mouse button. | |
static const int | MIDDLE_BUTTON = 2 |
Middle mouse button. | |
static const int | RIGHT_BUTTON = 3 |
Right mouse button. | |
static const int | WHEEL_FARTHER = 4 |
Mouse wheel pushed forward. | |
static const int | WHEEL_CLOSER = 5 |
Mouse wheel pulled backward. |
Mouse * e2d::core::Mouse::GetInstance | ( | void | ) | [static] |
This class is a Singleton. If you want an instance of this class to work with, get it via this method.
bool e2d::core::Mouse::CheckButtonState | ( | int | button | ) |
With this method you are able to verify if a button is being or not pressed on the mouse.
button | The button you want to check the state of. |
Rect & e2d::core::Mouse::GetRelativePosition | ( | ) |
Relative position means the difference between the current position and and the position just before the last mouse movement. This method returns this delta.
void e2d::core::Mouse::SetButtonState | ( | bool | pressed, | |
int | button | |||
) |
With this method you can set a button state yourself. Note that if a button is not pressed and you set its state to pressed, it will remain in a state of pressed even if the button is not really being pressed on the mouse. But, if the real button is pressed and then released, then it will switch to the state of unpressed.
pressed | Set it to true if you want the button to be seen as pressed, and set it to false otherwise. | |
button | The button you want to change the state. |
void e2d::core::Mouse::SetPosition | ( | int | x, | |
int | y | |||
) |
This method is called by EventHandler to set the current mouse position. It won't move the mouse through the screen.
x | New mouse position in the X axis. | |
y | New mouse position in the Y axis. |
void e2d::core::Mouse::SetRelativePosition | ( | int | x, | |
int | y | |||
) |
This method is called by EventHandler to set the current mouse position. It won't move the mouse through the screen.
x | New mouse relative position in the X axis. | |
y | New mouse relative position in the Y axis. |
void e2d::core::Mouse::ShowCursor | ( | bool | show | ) |
Toggle whether or not the cursor is shown on the screen.
show | true shows the mouse cursor, false hides it. |