00001 /// \file CATControllerMapper.h 00002 /// \brief Maps inputs from a controller to various outputs 00003 /// \ingroup CAT 00004 /// 00005 /// Copyright (c) 2008 by Michael Ellison. 00006 /// See COPYING.txt for the \ref gaslicense License (MIT License). 00007 /// 00008 // $Author: mikeellison $ 00009 // $Date: 2008-01-23 08:59:02 -0600 (Wed, 23 Jan 2008) $ 00010 // $Revision: $ 00011 // $NoKeywords: $ 00012 #ifndef CATControllerMapper_H_ 00013 #define CATControllerMapper_H_ 00014 00015 #include "CATInternal.h" 00016 #include "CATJoystick.h" 00017 #include "CATControlMap.h" 00018 #include "CATString.h" 00019 #include "CATMsgThread.h" 00020 00021 // move these to win32 implementation once we've got class developed. 00022 class CATDirectInput; 00023 00024 /// \class CATControllerMapper 00025 /// \brief Maps inputs from a controller to various outputs 00026 /// \ingroup CAT 00027 class CATControllerMapper : public CATMsgThread 00028 { 00029 public: 00030 CATControllerMapper(); 00031 virtual ~CATControllerMapper(); 00032 00033 virtual CATResult Initialize(); 00034 virtual CATResult Uninitialize(); 00035 00036 virtual CATResult GetControllerList( std::vector<CATString>& controllerList); 00037 00038 virtual CATResult GetMappingList( const CATString& controllerName, 00039 std::vector<CATString>& mappingList); 00040 00041 virtual CATResult StartMapping( const CATString& controllerName, 00042 const CATString& mappingName); 00043 00044 virtual CATResult StopMapping(); 00045 00046 protected: 00047 virtual void OnThreadIdle(); 00048 virtual CATUInt32 OnThreadMessage(CATUInt32 msg, CATUInt32 wParam, CATUInt32 lParam); 00049 void OnAxis(CATInt32 val, CATJoystick::AXIS_TYPE axisType); 00050 void OnButtonChange(bool state, CATUInt32 button); 00051 00052 bool fInitialized; 00053 CATUInt32 fPollFreq; 00054 CATJoystick* fController; ///< active input controller (eventually needs to be parent class of joystick) 00055 CATControlMap* fMap; ///< active mapping information 00056 00057 // Move these to win32 implementation once we've got the class developed 00058 CATDirectInput* fDirectInput; 00059 CATJOYSTICKSTRUCT fLastStatus; 00060 CATUInt32 fValidAxis; 00061 }; 00062 00063 #endif // CATControllerMapper_H_