blob: c8f6b31d316687f1ae8e51afdc64e105a7d8ccfe (
plain) (
blame)
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
|
#ifndef PAD_H
#define PAD_H
#include <pad/port.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C"
{
#endif
#define PAD_KEYS \
X(PAD_KEY_LEFT) \
X(PAD_KEY_RIGHT) \
X(PAD_KEY_UP) \
X(PAD_KEY_DOWN) \
X(PAD_KEY_A) \
X(PAD_KEY_B) \
X(PAD_KEY_C) \
X(PAD_KEY_D) \
X(PAD_KEY_E) \
X(PAD_KEY_OPTIONS) \
X(PAD_KEY_FULL_SCREEN) \
X(PAD_KEY_EXIT)
enum pad_key
{
#define X(x) x,
PAD_KEYS
#undef X
MAX_PAD_KEYS
};
struct pad
{
int player;
int mask, oldmask;
struct pad_port port;
};
void pad_init(int player, struct pad *p);
void pad_update(struct pad *p);
bool pad_pressed(const struct pad *p, enum pad_key k);
bool pad_justpressed(const struct pad *p, enum pad_key k);
bool pad_released(const struct pad *p, enum pad_key k);
const char *pad_str(enum pad_key k);
#ifdef __cplusplus
}
#endif
#endif /* PAD_H */
|