⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gameinput.h

📁 一个类似坦克大战的小小游戏
💻 H
字号:

/**************************************************************************************
	Project  Name			: Pirates of the Caribbean
	Module Name				: Direct Input
	File Name				: GameInput.h: interface for the CGameInput class.
	Create					: 2007-7-13, by Vigame
	Update					: 
	Copyright				: 
	Reference				: 
	Abstrct					: Encapsulation of the DirectInput8 interface
 **************************************************************************************/

#ifndef __H_GameInput__
#define __H_GameInput__

#pragma once
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")

#include <dinput.h>

class CGameInput
{
public:
	CGameInput(void);
	virtual ~CGameInput(void);

public:
	BOOL Create(HWND hWnd, HINSTANCE hInstance);	// Create a direct input8 device
	void Release();

	// Get state of the input device
	HRESULT GetKeyboardState();
	HRESULT GetMouseState();

	// Controlment of input devices
	BOOL IsKeyDown(int inKey);
	BOOL IsMouseDown(int inKey);

	void GetCursorPos(long &outX, long &outY, long &outZ);

private:
	LPDIRECTINPUT8 m_pDirectInput;		// IDirectInput8 interface
	LPDIRECTINPUTDEVICE8 m_pKeyboard;	// Keyboard device
	LPDIRECTINPUTDEVICE8 m_pMouse;		// Mouse deviced
	DIMOUSESTATE m_mouseState;			// Mouse state
	UCHAR m_keyboardState[256];			// This will hold keyboard data
};

#endif

⌨️ 快捷键说明

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