blob: 6df947b594daae00485facf0d667e0b2a9912ff0 (
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
|
#ifndef INPUT_H_
#define INPUT_H_
#include "../bang.h"
#include "../types/circbuf.h"
// Bedrock input device.
typedef struct {
bool pointer; // Pointer active
bool keyboard; // Keyboard active
u16 x, y; // Pointer position
u16 x_read, y_read; // Read caches for pointer position
CircBuf keybuffer; // Queued keypresses
u8 gamepad; // Gamepad state
bool wake; // Wake flag
} InputDevice;
// Methods.
void input_reset(InputDevice *input);
void input_read_x(InputDevice *input);
void input_read_y(InputDevice *input);
void input_receive_key(InputDevice *input, u8 byte);
void input_update_gamepad(InputDevice *input);
void input_update_touch(InputDevice *input);
#endif
|