File tree 2 files changed +9
-0
lines changed
hardware/arduino/cores/arduino 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,13 @@ void Mouse_::release(uint8_t b)
243
243
buttons (_buttons & ~b);
244
244
}
245
245
246
+ bool Mouse_::isPressed (uint8_t b)
247
+ {
248
+ if (b & _buttons > 0 )
249
+ return true ;
250
+ return false ;
251
+ }
252
+
246
253
// ================================================================================
247
254
// ================================================================================
248
255
// Keyboard
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ extern Serial_ Serial;
46
46
#define MOUSE_LEFT 1
47
47
#define MOUSE_RIGHT 2
48
48
#define MOUSE_MIDDLE 4
49
+ #define MOUSE_ALL (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)
49
50
50
51
class Mouse_
51
52
{
@@ -58,6 +59,7 @@ class Mouse_
58
59
void move (signed char x, signed char y, signed char wheel = 0 );
59
60
void press (uint8_t b = MOUSE_LEFT); // press LEFT by default
60
61
void release (uint8_t b = MOUSE_LEFT); // release LEFT by default
62
+ bool isPressed (uint8_t b = MOUSE_ALL); // check all buttons by default
61
63
};
62
64
extern Mouse_ Mouse;
63
65
You can’t perform that action at this time.
0 commit comments