// XGamepad.h: interface for the CXGamepad class. // Sergiy Shaykin (sergiys@crytek.de) ////////////////////////////////////////////////////////////////////// #ifndef _XGAMEPAD_H_ #define _XGAMEPAD_H_ #include struct ILog; class CInput; class CXGamepad : public IGamepad { public: bool Init(ILog *pLog); CXGamepad(); virtual ~CXGamepad(); //////////////////////////////////////////////////////////// void ShutDown(); //! allow to force a key code value void SetKey(int p_key, int value); //! allow to force a key code value void SetPrevKey(int p_key, int value); //! check for key pressed and held bool KeyDown(int p_key); //! check for key pressed only once bool KeyPressed(int p_key); //! check if the key has been released bool KeyReleased(int p_key); //! clear the key status void ClearKey(int p_key); //! return the code of the key pressed int GetKeyPressedCode(); //! return the name of the key pressed const char *GetKeyPressedName(); //! return the code of the key down int GetKeyDownCode(); //! return the name of the key down const char *GetKeyDownName(); //! return the name (key name list) of the key specified in kKeyCode const char *EnumerateKey(int nKeyCode); //! set/unset directinput to exclusive mode void SetExclusive(bool value,void *hwnd=0); //! wait for a key pressed void WaitForKey(); //! clear the key (pressed) state void ClearKeyState(); //! return the name (ascii name mapped to the virtual keyboard layout) of the key specified in kKeyCode //const char *GetKeyName(unsigned short nKey); //! void Update(); float GetDeltaX(); float GetDeltaY(); ///////////////////////////////////////////////////////////// private: bool IsControllerReady(UINT iNumController) const { assert(iNumController < MAX_XBOX_CONTROLLERS); return m_hGamepads[iNumController] != NULL; }; bool AnyControllersReady() const { UINT i; for (i=0; i