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
|
#ifndef INPUT_H
#define INPUT_H
#include <keyboard.h>
#include <mouse.h>
#include <pad.h>
#include <peripheral.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef void (*input_ch)(char ch, void *user);
typedef void (*input_erase)(void *user);
struct input
{
input_ch cb;
input_erase erase;
void *user;
unsigned char t;
bool repeat;
struct keyboard_combo prev;
};
void input_update(struct input *in, const union peripheral *p);
int input_render(const struct input *in, const union peripheral *p);
bool input_keyboard_justpressed(const struct input *in,
const struct keyboard *k,
const struct keyboard_combo *c);
bool input_keyboard_pressed(const struct input *in,
const struct keyboard *k,
const struct keyboard_combo *c);
bool input_keyboard_justreleased(const struct input *in,
const struct keyboard *k,
const struct keyboard_combo *c);
bool input_pad_pressed(const struct input *in, const struct pad *p,
enum pad_key k);
bool input_pad_justpressed(const struct input *in, const struct pad *p,
enum pad_key k);
bool input_pad_released(const struct input *in, const struct pad *p,
enum pad_key k);
bool input_mouse_pressed(const struct input *in, const struct mouse *m,
enum mouse_button b);
bool input_mouse_justpressed(const struct input *in, const struct mouse *m,
enum mouse_button b);
bool input_mouse_justreleased(const struct input *in, const struct mouse *m,
enum mouse_button b);
#ifdef __cplusplus
}
#endif
#endif /* INPUT_H */
|