inputlayer.h
来自「Visual C++ 游戏开发与设计实例 源代码(所有)」· C头文件 代码 · 共 88 行
H
88 行
/*******************************************************************
* Advanced 3D Game Programming using DirectX 7.0
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Title: InputLayer.h
* Desc: Manages DirectInput
* Currently only has support for keyboard/mouse
* copyright (c) 1999 by Adrian Perez
* See license.txt for modification and distribution information
******************************************************************/
#ifndef _INPUTLAYER_H
#define _INPUTLAYER_H
#include <dinput.h>
#include "Keyboard.h"
#include "Mouse.h"
class cInputLayer
{
cKeyboard* m_pKeyboard;
cMouse* m_pMouse;
// The DI7 object
LPDIRECTINPUT8 m_pDI;
static cInputLayer* m_pGlobalILayer;
cInputLayer(
HINSTANCE hInst,
HWND hWnd,
bool bExclusive,
bool bUseKeyboard = true,
bool bUseMouse = true );
public:
static void Destroy();
virtual ~cInputLayer();
cKeyboard* GetKeyboard()
{
return m_pKeyboard;
}
cMouse* GetMouse()
{
return m_pMouse;
}
void UpdateDevices();
static cInputLayer* GetInput()
{
return m_pGlobalILayer;
}
LPDIRECTINPUT8 GetDInput()
{
return m_pDI;
}
void SetFocus(); // called when the app gains focus
void KillFocus(); // called when the app must release focus
static void Create(
HINSTANCE hInst,
HWND hWnd,
bool bExclusive,
bool bUseKeyboard = true,
bool bUseMouse = true )
{
// everything is taken care of in the constructor
new cInputLayer(
hInst,
hWnd,
bExclusive,
bUseKeyboard,
bUseMouse );
}
};
inline cInputLayer* Input()
{
return cInputLayer::GetInput();
}
#endif //_INPUTLAYER_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?