forked from AetherCollective/ProconXInput
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommon.hpp
59 lines (52 loc) · 897 Bytes
/
Common.hpp
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
#pragma once
namespace Procon {
using uchar = unsigned char;
// RAII function object
template<class T>
class ScopedFunction {
T t;
public:
explicit ScopedFunction(T&& f) :t(f) {}
explicit ScopedFunction(const T& f) :t(f) {}
~ScopedFunction() {
t();
}
ScopedFunction& operator=(T&& f) { t = f; }
ScopedFunction& operator=(const T& f) { t = f; }
};
template<class T>
ScopedFunction<T> make_scoped(T f) {
return ScopedFunction<T>(std::move(f));
}
enum class Button {
None,
DPadUp,
DPadDown,
DPadRight,
DPadLeft,
A,
B,
X,
Y,
Plus,
Minus,
L,
LZ,
R,
RZ,
LStick,
RStick,
Home,
Share,
};
enum class ButtonSource {
Left,
Right,
Middle
};
constexpr int JoyconL_ID = 0x2006;
constexpr int JoyconR_ID = 0x2007;
constexpr int Procon_ID = 0x2009;
constexpr int JoyconGrip_ID = 0x200e;
constexpr int NintendoID = 0x057E;
};