You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.1 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /***************************************************************************
  2. * Copyright (C) 2014 M Wellings *
  3. * info@openforeveryone.co.uk *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License version 2 as *
  7. * published by the Free Software Foundation *
  8. * *
  9. * This program is distributed in the hope that it will be useful, *
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  12. * GNU General Public License for more details. *
  13. * *
  14. * You should have received a copy of the GNU General Public License *
  15. * along with this program; if not, write to the *
  16. * Free Software Foundation, Inc., *
  17. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  18. ***************************************************************************/
  19. #ifndef QGAMECONTROLLER_LINUX_P_H
  20. #define QGAMECONTROLLER_LINUX_P_H
  21. #include <QMap>
  22. #include "qgamecontroller.h"
  23. #include "qgamecontroller_p.h"
  24. #include <iostream>
  25. #include <unistd.h>
  26. #include <fcntl.h>
  27. //#include <sstream>
  28. #include <errno.h>
  29. #include <linux/joystick.h>
  30. QT_BEGIN_NAMESPACE
  31. class QGameControllerPrivate
  32. {
  33. Q_DECLARE_PUBLIC(QGameController)
  34. public:
  35. explicit QGameControllerPrivate(uint id, QGameController *q);
  36. QGameController * const q_ptr;
  37. protected:
  38. void process_event(js_event e);
  39. public:
  40. int fd;
  41. QString Description;
  42. uint ID;
  43. bool Valid;
  44. QMap<uint, float> AxisValues;
  45. QMap<uint, bool> ButtonValues;
  46. uint Axis;
  47. uint Buttons;
  48. void readGameController();
  49. };
  50. QT_END_NAMESPACE
  51. #endif // QGAMECONTROLLER_LINUX_P_H