-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinput.h
50 lines (42 loc) · 877 Bytes
/
input.h
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
#ifndef INPUT_H
#define INPUT_H
#include <efi.h>
#include <efilib.h>
#include "config.h"
typedef enum READ_INPUT_KEY_STATUS {
INPUT_KEY_NONE, // no input key
INPUT_KEY_ERROR, // failed to read
INPUT_KEY_SUCCESS // successfully read
} READ_INPUT_KEY_STATUS;
typedef enum INPUT_KEY {
MOVE_DOWN = 0,
MOVE_LEFT,
MOVE_RIGHT,
ROTATE_CCW,
ROTATE_CW,
FALL,
QUIT,
UNKNOWN,
INPUT_KEY_MAX
} INPUT_KEY;
typedef struct input_manager_t {
EFI_SIMPLE_TEXT_IN_PROTOCOL * const protocol;
} input_manager_t;
/**
* \brief
* Loads an input manager from UEFI.
*/
input_manager_t load_input_manager(EFI_STATUS * status);
/**
* \brief
* Reads a key.
*
* \returns
* - `1` if a key was read.
* - `0` if no key was read.
* - `-1` if an error occurred.
*/
READ_INPUT_KEY_STATUS read_input_key(
input_manager_t * const input,
INPUT_KEY * const key);
#endif