home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / DirectX / dx9sdkcp.exe / SDK (C++) / Bin / DXUtils / Visual Studio 6.0 Wizards / Source Code / Template / diutil.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-12  |  2.0 KB  |  66 lines

  1. //-----------------------------------------------------------------------------
  2. // File: DIUtil.h
  3. //
  4. // Desc: DirectInput support using action mapping
  5. //-----------------------------------------------------------------------------
  6. #ifndef DIUTIL_H
  7. #define DIUTIL_H
  8.  
  9. #ifndef DIRECTINPUT_VERSION
  10. #define DIRECTINPUT_VERSION 0x0800
  11. #endif
  12.  
  13. #include <dinput.h>
  14.  
  15.  
  16.  
  17.  
  18. //-----------------------------------------------------------------------------
  19. // Name: class CInputDeviceManager
  20. // Desc: Input device manager using DX8 action mapping
  21. //-----------------------------------------------------------------------------
  22. class CInputDeviceManager
  23. {
  24. public:
  25.     struct DeviceInfo
  26.     {
  27.         LPDIRECTINPUTDEVICE8 pdidDevice;
  28.         LPVOID               pParam;
  29.     };
  30.  
  31.     typedef HRESULT (CALLBACK *LPDIMANAGERCALLBACK)(CInputDeviceManager::DeviceInfo* pDeviceInfo, const DIDEVICEINSTANCE* pdidi, LPVOID);
  32.  
  33. private:
  34.     BOOL                    m_bCleanupCOM;
  35.     HWND                    m_hWnd;
  36.     TCHAR*                  m_strUserName;
  37.  
  38.     LPDIRECTINPUT8          m_pDI;
  39.     DeviceInfo*             m_pDevices;
  40.     DWORD                   m_dwMaxDevices;
  41.     DWORD                   m_dwNumDevices;
  42.     DIACTIONFORMAT          m_diaf;
  43.  
  44.     LPDIMANAGERCALLBACK  m_AddDeviceCallback;
  45.     LPVOID               m_AddDeviceCallbackParam;
  46.  
  47. public:
  48.     // Device control
  49.     HRESULT AddDevice( const DIDEVICEINSTANCE* pdidi, LPDIRECTINPUTDEVICE8 pdidDevice );
  50.     HRESULT GetDevices( DeviceInfo** ppDeviceInfo, DWORD* pdwNumDevices );
  51.     HRESULT ConfigureDevices( HWND hWnd, IUnknown* pSurface, VOID* pCallback, DWORD dwFlags, LPVOID pvCBParam );
  52.     VOID UnacquireDevices();
  53.     VOID SetFocus( HWND hWnd );
  54.  
  55.     // Construction
  56.     HRESULT SetActionFormat( DIACTIONFORMAT& diaf, BOOL bReenumerate );
  57.     HRESULT Create( HWND hWnd, TCHAR* strUserName, DIACTIONFORMAT& diaf, LPDIMANAGERCALLBACK AddDeviceCallback, LPVOID pCallbackParam );
  58.  
  59.     CInputDeviceManager();
  60.     ~CInputDeviceManager();
  61. };
  62.  
  63. #endif
  64.  
  65.  
  66.