js.h
Go to the documentation of this file.
00001 #include <vector>
00002 #ifdef __APPLE__
00003 #include "ysjoyreader.h"
00004 #endif
00005 
00006 class joystick
00007 {
00008 public:
00009     typedef enum {EVENT_AXIS, EVENT_BUTTON, EVENT_NONE} event;
00010     joystick(const char *dev);
00011     ~joystick();
00012     bool readEvent();
00013     bool getButtonState(int i_index) const { return m_buttons[i_index]; }
00014     float getAxisState(int i_index) const { return m_axes[i_index]; }
00015     bool is_open() const { return m_fd >= 0; }
00016     unsigned int nButtons() const { return m_buttons.size(); }
00017     unsigned int nAxes() const { return m_axes.size(); }
00018 private:
00019     int m_fd;
00020     std::vector<float> m_axes;
00021     std::vector<bool> m_buttons;
00022 #ifdef __APPLE__
00023 #define maxNumJoystick 4
00024     YsJoyReader m_dev[maxNumJoystick];
00025 #endif
00026 };


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed Sep 6 2017 02:35:55