home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / Common / include / diutil.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-31  |  2.0 KB  |  63 lines

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