-
Notifications
You must be signed in to change notification settings - Fork 0
/
InputManager.cpp
60 lines (48 loc) · 1.08 KB
/
InputManager.cpp
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
#include <windows.h> // Header File For Windows
#include "baseTypes.h"
#include "InputManager.h"
InputManagerC* InputManagerC::sInstance = NULL;
InputManagerC *InputManagerC::CreateInstance()
{
if(sInstance!=NULL)return sInstance;
else
sInstance = new InputManagerC();
return sInstance;
}
void InputManagerC::update()
{
movingRight[0] = GetAsyncKeyState(VK_D);
movingLeft[0] = GetAsyncKeyState(VK_A);
active[0] = GetAsyncKeyState(VK_W);
movingRight[1] = GetAsyncKeyState(VK_RIGHT);
movingLeft[1] = GetAsyncKeyState(VK_LEFT);
active[1] = GetAsyncKeyState(VK_UP);
enter = GetAsyncKeyState(VK_RETURN);
backspace = GetAsyncKeyState(VK_BACK);
}
bool InputManagerC::isMovingRight(int player)
{
return movingRight[player - 1];
}
bool InputManagerC::isMovingLeft(int player)
{
return movingLeft[player - 1];
}
bool InputManagerC::isPressingActive(int player)
{
return active[player - 1];
}
bool InputManagerC::isPressingEnter()
{
return enter;
}
bool InputManagerC::isPressingBackspace()
{
return backspace;
}
/*
bool InputManagerC::isPressingUp(int player)
{
return up;
}
*/