int calcNumDevices() { if (numDevices>=0) return numDevices; initAll(); unsigned int i=0; for (; i<MAXJOYSTICKS; i++) { int fd=openJoystick(i); if (fd<0) break; closeJoystick(i); } return numDevices=i; }
Joystick::~Joystick() { closeJoystick(); }