Added releaseAll() for Mouse API
This commit is contained in:
parent
3a71aaeb72
commit
d3147adbfd
2 changed files with 14 additions and 8 deletions
|
|
@ -73,6 +73,7 @@ public:
|
|||
inline void move(signed char x, signed char y, signed char wheel = 0);
|
||||
inline void press(uint8_t b = MOUSE_LEFT); // press LEFT by default
|
||||
inline void release(uint8_t b = MOUSE_LEFT); // release LEFT by default
|
||||
inline void releaseAll(void);
|
||||
inline bool isPressed(uint8_t b = MOUSE_LEFT); // check LEFT by default
|
||||
|
||||
// Sending is public in the base class for advanced users.
|
||||
|
|
|
|||
|
|
@ -77,10 +77,15 @@ void MouseAPI::release(uint8_t b)
|
|||
buttons(_buttons & ~b);
|
||||
}
|
||||
|
||||
void MouseAPI::releaseAll(void)
|
||||
{
|
||||
_buttons = 0;
|
||||
move(0,0,0);
|
||||
}
|
||||
|
||||
bool MouseAPI::isPressed(uint8_t b)
|
||||
{
|
||||
if ((b & _buttons) > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue