js.h
Go to the documentation of this file.
1 #include <vector>
2 #ifdef __APPLE__
3 #include "ysjoyreader.h"
4 #endif
5 
6 class joystick
7 {
8 public:
10  joystick(const char *dev);
11  ~joystick();
12  bool readEvent();
13  bool getButtonState(int i_index) const { return m_buttons[i_index]; }
14  float getAxisState(int i_index) const { return m_axes[i_index]; }
15  bool is_open() const { return m_fd >= 0; }
16  unsigned int nButtons() const { return m_buttons.size(); }
17  unsigned int nAxes() const { return m_axes.size(); }
18 private:
19  int m_fd;
20  std::vector<float> m_axes;
21  std::vector<bool> m_buttons;
22 #ifdef __APPLE__
23 #define maxNumJoystick 4
24  YsJoyReader m_dev[maxNumJoystick];
25 #endif
26 };
std::vector< bool > m_buttons
Definition: js.h:21
int m_fd
Definition: js.h:19
bool readEvent()
Definition: js.cpp:40
bool getButtonState(int i_index) const
Definition: js.h:13
joystick(const char *dev)
Definition: js.cpp:10
~joystick()
Definition: js.cpp:33
unsigned int nAxes() const
Definition: js.h:17
Definition: js.h:6
std::vector< float > m_axes
Definition: js.h:20
bool is_open() const
Definition: js.h:15
float getAxisState(int i_index) const
Definition: js.h:14
event
Definition: js.h:9
unsigned int nButtons() const
Definition: js.h:16


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:50