-
Notifications
You must be signed in to change notification settings - Fork 2
/
DInput.h
80 lines (65 loc) · 2.14 KB
/
DInput.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//-----------------------------------------------------------------------------
// File: DINPUT.h
//
// Desc: The Main program
//
// Copyright (c) 2001 Dan
//-----------------------------------------------------------------------------
#ifndef _DINPUT_H
#define _DINPUT_H
#ifndef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800
#endif
#include <dinput.h>
#include "Singleton.h"
typedef struct _INPUTDATA
{
LONG x, y, z;
BOOL lButton, rButton, lArrow, rArrow, dArrow, uArrow;
char Buffer[256];
} INPUTDATA, *LPINPUTDATA;
class CDInput : public CSingleton<CDInput>
{
public:
//---------------------------------------------------------------------
// Contstructor / Destructor
CDInput();
virtual ~CDInput();
//---------------------------------------------------------------------
//---------------------------------------------------------------------
//Functions
bool GetMouseButtonRight() const { return m_bMouseButtonRight; }
void SetFreeze( const bool bFreeze ) { m_bIsFrozen = bFreeze; }
bool GetMouseButtonLeft() const { return m_bMouseButtonLeft; }
bool IsFrozen() const { return m_bIsFrozen; }
long GetMouseX() const { return m_lMouseX; }
long GetMouseY() const { return m_lMouseY; }
long GetMouseZ() const { return m_lMouseZ; }
bool GetData( LPINPUTDATA data );
bool SetAcquire( bool bActive );
bool KeyPressed( int Key );
bool Init( HWND hWnd );
bool UpdateInput();
bool Release();
//---------------------------------------------------------------------
private:
//---------------------------------------------------------------------
//Data Members
LPDIRECTINPUTDEVICE8 m_lpDIDevice;
LPDIRECTINPUTDEVICE8 m_lpMouse;
bool m_bMouseButtonRight;
bool m_bMouseButtonLeft;
LPDIRECTINPUT8 m_lpDI;
char m_KeyBuffer[256];
bool m_bUseKeyboard;
bool m_bUseMouse;
bool m_bIsFrozen;
long m_lMouseX;
long m_lMouseY;
long m_lMouseZ;
HWND m_hWnd;
//---------------------------------------------------------------------
};
#define InputManager CDInput::GetSingletonPtr()
#define IM CDInput::GetSingletonPtr()
#endif