在学习中遇到一个有关问题,请大家帮忙看看,多谢高分求救
在学习中遇到一个问题,请大家帮忙看看,谢谢高分求救
#ifndef __INPUT_SYSTEM_INCLUDED__
#define __INPUT_SYSTEM_INCLUDED__
#include <dinput.h>
#define IS_USEKEYBOARD 1
#define IS_USEMOUSE 2
#define IS_USEJOYSTICK 4
class CKeyboard
{
public:
CKeyboard(LPDIRECTINPUT8 pDI, HWND hwnd);//错误通不过
~CKeyboard();
bool KeyDown(int key) { return (m_keys[key] & 0x80) ? true : false; }
bool KeyUp(int key) { return (m_keys[key] & 0x80) ? false : true; }
bool Update();
void Clear() { ZeroMemory(m_keys, 256 * sizeof(char)); }
bool Acquire();
bool Unacquire();
private:
LPDIRECTINPUTDEVICE8 m_pDIDev;//错误
char m_keys[256];
};
class CMouse
{
public:
CMouse(LPDIRECTINPUT8 pDI, HWND hwnd, bool isExclusive = true);//错误
~CMouse();
bool ButtonDown(int button) { return (m_state.rgbButtons[button] & 0x80) ? true : false; }
bool ButtonUp(int button) { return (m_state.rgbButtons[button] & 0x80) ? false : true; }
void GetMovement(int &dx, int &dy) { dx = m_state.lX; dy = m_state.lY; }
bool Update();
bool Acquire();
bool Unacquire();
private:
LPDIRECTINPUTDEVICE8 m_pDIDev;//错误
DIMOUSESTATE m_state;
};
class CJoystick
{
public:
CJoystick(LPDIRECTINPUT8 pDI, HINSTANCE appInstance);//错误
~CJoystick();
bool Update();
bool Acquire();
bool Unacquire();
private:
LPDIRECTINPUTDEVICE8 m_pDIDev;//错误
};
class CInputSystem
{
public:
CInputSystem() { }
~CInputSystem() { Shutdown(); }
bool Initialize(HWND hwnd, HINSTANCE appInstance, bool isExclusive, DWORD flags = 0);
bool Shutdown();
void AcquireAll();
void UnacquireAll();
CKeyboard *GetKeyboard() { return m_pKeyboard; }
CMouse *GetMouse() { return m_pMouse; }
CJoystick *GetJoystick() { return m_pJoystick; }
#ifndef __INPUT_SYSTEM_INCLUDED__
#define __INPUT_SYSTEM_INCLUDED__
#include <dinput.h>
#define IS_USEKEYBOARD 1
#define IS_USEMOUSE 2
#define IS_USEJOYSTICK 4
class CKeyboard
{
public:
CKeyboard(LPDIRECTINPUT8 pDI, HWND hwnd);//错误通不过
~CKeyboard();
bool KeyDown(int key) { return (m_keys[key] & 0x80) ? true : false; }
bool KeyUp(int key) { return (m_keys[key] & 0x80) ? false : true; }
bool Update();
void Clear() { ZeroMemory(m_keys, 256 * sizeof(char)); }
bool Acquire();
bool Unacquire();
private:
LPDIRECTINPUTDEVICE8 m_pDIDev;//错误
char m_keys[256];
};
class CMouse
{
public:
CMouse(LPDIRECTINPUT8 pDI, HWND hwnd, bool isExclusive = true);//错误
~CMouse();
bool ButtonDown(int button) { return (m_state.rgbButtons[button] & 0x80) ? true : false; }
bool ButtonUp(int button) { return (m_state.rgbButtons[button] & 0x80) ? false : true; }
void GetMovement(int &dx, int &dy) { dx = m_state.lX; dy = m_state.lY; }
bool Update();
bool Acquire();
bool Unacquire();
private:
LPDIRECTINPUTDEVICE8 m_pDIDev;//错误
DIMOUSESTATE m_state;
};
class CJoystick
{
public:
CJoystick(LPDIRECTINPUT8 pDI, HINSTANCE appInstance);//错误
~CJoystick();
bool Update();
bool Acquire();
bool Unacquire();
private:
LPDIRECTINPUTDEVICE8 m_pDIDev;//错误
};
class CInputSystem
{
public:
CInputSystem() { }
~CInputSystem() { Shutdown(); }
bool Initialize(HWND hwnd, HINSTANCE appInstance, bool isExclusive, DWORD flags = 0);
bool Shutdown();
void AcquireAll();
void UnacquireAll();
CKeyboard *GetKeyboard() { return m_pKeyboard; }
CMouse *GetMouse() { return m_pMouse; }
CJoystick *GetJoystick() { return m_pJoystick; }