mouse.h

来自「Visual C++ 游戏开发与设计实例 源代码(所有)」· C头文件 代码 · 共 54 行

H
54
字号
/*******************************************************************
 *         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

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?