Mouse.h
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:1k
- /*******************************************************************
- * Advanced 3D Game Programming using DirectX 7.0
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Title: Mouse.h
- * Desc: Wrapper of a DirectInput mouse object
- *
- * copyright (c) 1999 by Adrian Perez
- * See license.txt for modification and distribution information
- ******************************************************************/
- #ifndef _MOUSE_H
- #define _MOUSE_H
- #include <dinput.h>
- /**
- * Any object that implements this interface can receive input
- * from the mouse.
- */
- struct iMouseReceiver
- {
- virtual void MouseMoved( int dx, int dy ){};
- virtual void MouseButtonUp( int button ){};
- virtual void MouseButtonDown( int button ){};
- };
- class cMouse
- {
- LPDIRECTINPUTDEVICE8 m_pDevice;
- DIMOUSESTATE m_lastState;
- iMouseReceiver* m_pTarget;
- public:
- cMouse( HWND hWnd, bool bExclusive );
- ~cMouse();
- /**
- * Use this to establish a MouseReceiver as the current
- * input focus
- */
- void SetReceiver( iMouseReceiver* pTarget );
- eResult Update();
- eResult Acquire();
- void UnAcquire();
- };
- #endif // _MOUSE_H