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.

68 lines
2.6 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_WIN_P_H
  20. #define QGAMECONTROLLER_WIN_P_H
  21. #include <QtCore/QMap>
  22. #include "qgamecontroller.h"
  23. #include "qgamecontroller_p.h"
  24. #include <windows.h>
  25. #define DIRECTINPUT_VERSION 0x0800
  26. #include <dinput.h>
  27. #include <dinputd.h>
  28. #include <QtCore/QList>
  29. struct DI_ENUM_CONTEXT
  30. {
  31. DIJOYCONFIG* pPreferredJoyCfg;
  32. bool bPreferredJoyCfgValid;
  33. };
  34. #define SAFE_DELETE(p) { if(p) { delete (p); (p)=nullptr; } }
  35. #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } }
  36. BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext );
  37. BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext );
  38. class QGameControllerPrivate
  39. {
  40. Q_DECLARE_PUBLIC(QGameController)
  41. public:
  42. explicit QGameControllerPrivate(uint id, QGameController *q);
  43. QGameController * const q_ptr;
  44. protected:
  45. public:
  46. int fd;
  47. QString Description;
  48. uint ID;
  49. bool Valid;
  50. QMap<uint, float> AxisValues;
  51. QMap<uint, bool> ButtonValues;
  52. LPDIRECTINPUTDEVICE8 g_pJoystick;
  53. uint enumCounter;
  54. QList<GUID> DIaxisGIIDs;
  55. uint Axis;
  56. uint Buttons;
  57. void readGameController();
  58. };
  59. QT_END_NAMESPACE
  60. #endif // QGAMECONTROLLER_WIN_P_H