EEROS  1.0.0.0
API for the EEROS Real-Time Robotics Framework
MouseDigIn.hpp
Go to the documentation of this file.
1 #ifndef ORG_EEROS_MOUSE_DIGIN_HPP_
2 #define ORG_EEROS_MOUSE_DIGIN_HPP_
3 
4 #include <eeros/hal/Input.hpp>
5 #include <eeros/hal/Mouse.hpp>
6 #include <fstream>
7 #include <string>
8 
9 namespace eeros {
10  namespace hal {
11  class MouseDigIn : public Input<bool> {
12  public:
13  MouseDigIn(std::string id, Mouse* m) : Input<bool>(id, nullptr), m(m) { }
15  virtual bool get() {
16  if (getId().compare("leftMouseButton") == 0) return m->current.button.left;
17  if (getId().compare("middleMouseButton") == 0) return m->current.button.middle;
18  if (getId().compare("rightMouseButton") == 0) return m->current.button.right;
19  return false;
20  }
21 
22  private:
23  Mouse* m;
24  };
25 
26  };
27 };
28 
29 #endif /* ORG_EEROS_MOUSE_DIGIN_HPP_ */
bool middle
Definition: Mouse.hpp:19
Definition: Input.hpp:17
Definition: Config.hpp:14
bool right
Definition: Mouse.hpp:20
struct eeros::hal::MouseState::@1 button
Definition: Mouse.hpp:30
bool left
Definition: Mouse.hpp:18
~MouseDigIn()
Definition: MouseDigIn.hpp:14
MouseDigIn(std::string id, Mouse *m)
Definition: MouseDigIn.hpp:13
virtual std::string getId() const
Definition: Input.hpp:21
Definition: MouseDigIn.hpp:11
MouseState current
Definition: Mouse.hpp:39