00001 /// \file CATDirectInput.h 00002 /// \brief Basic DirectInput wrapper 00003 /// \ingroup CAT 00004 /// 00005 /// Copyright (c) 2002-2008 by Michael Ellison. 00006 /// See COPYING.txt for the \ref gaslicense License (MIT License). 00007 /// 00008 // $Author: mikeellison $ 00009 // $Date: 2008-01-27 21:01:45 -0600 (Sun, 27 Jan 2008) $ 00010 // $Revision: $ 00011 // $NoKeywords: $ 00012 #ifndef CATDirectInput_H_ 00013 #define CATDirectInput_H_ 00014 00015 #include "CATInternal.h" 00016 #ifdef CAT_CONFIG_WIN32 00017 00018 #define DIRECTINPUT_VERSION 0x800 00019 #include <dinput.h> 00020 #include "CATJoystick.h" 00021 #include <vector> 00022 00023 class CATDirectInput 00024 { 00025 public: 00026 CATDirectInput(); 00027 00028 virtual ~CATDirectInput(); 00029 00030 // Must call init after creation before use 00031 bool Init(); 00032 00033 void DoControlPanel(HWND parent = 0); 00034 00035 typedef void (*EnumJoysticksCallback)(const CATWChar* name, void* userParam); 00036 00037 void EnumJoysticks(EnumJoysticksCallback callback, void *userParam); 00038 00039 CATJoystick* CreateJoystick(const CATWChar* name); 00040 00041 00042 protected: 00043 bool fInitialized; 00044 IDirectInput8* fDirectInput; 00045 00046 std::vector<DIDEVICEINSTANCE*> fJoystickList; 00047 EnumJoysticksCallback fUserCallback; 00048 void* fUserParam; 00049 00050 // Direct Input joystick callback 00051 static BOOL CALLBACK DIJoysticksCB( LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef ); 00052 }; 00053 00054 #endif // CAT_CONFIG_WIN32 00055 #endif //CATDirectInput_H_