#ifndef ASW_INPUT_DX_H #define ASW_INPUT_DX_H #define DIRECTINPUT_VERSION 0x0800 #include "dinput.h" #ifdef WIN32 #pragma comment( lib, "dinput8.lib" ) #pragma comment( lib, "dxguid.lib" ) #endif #include "ASW_Window_W32.h" #define BUFFER_SIZE 16 /* InputDX implements Input using DirectInput to communicate directly with the hardware devices. Buffered input is used (see Init()). */ class InputDX : public ASW::Input { friend class ASW::Input; private: LPDIRECTINPUT8 m_ptrManager; LPDIRECTINPUTDEVICE8 m_ptrMouse; LPDIRECTINPUTDEVICE8 m_ptrKeyboard; DIDEVICEOBJECTDATA m_stuDataMouse[BUFFER_SIZE]; DIDEVICEOBJECTDATA m_stuDataKeyboard[BUFFER_SIZE]; static ASW::Input::KeyType m_enmDirectXKeys[256]; static void InitKeys(); protected: bool Sync(KeyChange * Changes, unsigned int & Amount, ASW::Point3i & MouseMovement); public: struct Exception : public ASW::Exception { const HRESULT m_hndError; Exception(const char * File, const unsigned int Line, const char * Function, const char * Detail, const HRESULT Error); virtual void Print(UTIL::Output &); virtual const char * Type(); }; InputDX(WindowW32 &); virtual ~InputDX(); virtual bool Acquire(); }; #endif