-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput.cpp
36 lines (29 loc) · 926 Bytes
/
input.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
#include "input.hpp"
void input::Update() {
// ƒL[ƒ{[ƒh //
DxLib::GetHitKeyStateAll(this->Key);
// ƒ}ƒEƒX //
int X = 0, Y = 0;
DxLib::GetMousePoint(&X, &Y);
this->MousePos.SetPos((double)X, (double)Y);
this->BeforeMouseInput = this->MouseInput;
this->MouseInput = DxLib::GetMouseInput();
}
bool input::GetKey(unsigned char KeyCode) {
return this->Key[KeyCode] == 1;
}
pos input::GetMousePos() {
return this->MousePos;
}
bool input::GetMouseInput(short MouseCode) {
return this->MouseInput & MouseCode;
}
bool input::GetMouseDown(short MouseCode) {
return ((this->BeforeMouseInput ^ this->MouseInput) & this->MouseInput) & MouseCode;
}
bool input::GetMouseUp(short MouseCode) {
return ((this->BeforeMouseInput ^ this->MouseInput) & this->BeforeMouseInput) & MouseCode;
}
input::input(bool Init) {
if (!Init) this->Update();
}