AppleWin/source/frontends/ncurses/input.h
Andrea Odetti b63f232ebe Use evdev to handle a joystick.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
2017-10-14 19:18:44 +01:00

29 lines
487 B
C++

#include <string>
#include <memory>
#include <vector>
struct libevdev;
struct input_event;
class Input
{
public:
Input(const std::string & device);
~Input();
int poll();
bool getButton(int i) const;
int getAxis(int i) const;
private:
int myFD;
std::shared_ptr<libevdev> myDev;
void process(const input_event & ev);
std::vector<unsigned int> myButtonCodes;
std::vector<unsigned int> myAxisCodes;
std::vector<int> myAxisMins;
std::vector<int> myAxisMaxs;
};