[gnoduino: 96/237] added Mouse press() and release()
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnoduino: 96/237] added Mouse press() and release()
- Date: Sat, 31 Mar 2012 20:22:53 +0000 (UTC)
commit e644231c4772e13a54493188e105d7ee42d30ee7
Author: Zach Eveland <zeveland blacklabel-development com>
Date: Tue Aug 30 20:23:06 2011 -0400
added Mouse press() and release()
arduino/cores/arduino/HID.cpp | 10 ++++++++++
arduino/cores/arduino/USBAPI.h | 3 +++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/arduino/cores/arduino/HID.cpp b/arduino/cores/arduino/HID.cpp
index e3aadb5..16d0448 100644
--- a/arduino/cores/arduino/HID.cpp
+++ b/arduino/cores/arduino/HID.cpp
@@ -233,6 +233,16 @@ void Mouse_::buttons(uint8_t b)
}
}
+void Mouse_::press(uint8_t b)
+{
+ buttons(_buttons | b);
+}
+
+void Mouse_::release(uint8_t b)
+{
+ buttons(_buttons & ~b);
+}
+
//================================================================================
//================================================================================
// Keyboard
diff --git a/arduino/cores/arduino/USBAPI.h b/arduino/cores/arduino/USBAPI.h
index 0dad176..03dddb8 100644
--- a/arduino/cores/arduino/USBAPI.h
+++ b/arduino/cores/arduino/USBAPI.h
@@ -46,6 +46,7 @@ extern Serial_ Serial;
#define MOUSE_LEFT 1
#define MOUSE_MIDDLE 2
#define MOUSE_RIGHT 4
+#define MOUSE_ALL (MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)
class Mouse_
{
@@ -55,6 +56,8 @@ public:
void click(uint8_t b = MOUSE_LEFT);
void move(signed char x, signed char y, signed char wheel = 0);
void buttons(uint8_t b);
+ void press(uint8_t b = MOUSE_LEFT); // press LEFT by default
+ void release(uint8_t b = MOUSE_LEFT); // release LEFT by default
};
extern Mouse_ Mouse;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]