45 lines
746 B
C
45 lines
746 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "dusk.h"
|
|
#include <termios.h>
|
|
|
|
#define INPUT_UP (1 << 0)
|
|
#define INPUT_DOWN (1 << 1)
|
|
#define INPUT_LEFT (1 << 2)
|
|
#define INPUT_RIGHT (1 << 3)
|
|
#define INPUT_ACTION (1 << 4)
|
|
#define INPUT_CANCEL (1 << 5)
|
|
|
|
#define INPUT_BUFFER_SIZE 128
|
|
|
|
typedef struct {
|
|
uint8_t current;
|
|
uint8_t previous;
|
|
bool_t isRawMode;
|
|
struct termios origin;
|
|
} input_t;
|
|
|
|
extern input_t INPUT;
|
|
|
|
typedef struct {
|
|
char_t *key;
|
|
uint8_t value;
|
|
} inputmap_t;
|
|
|
|
extern inputmap_t INPUT_MAP[];
|
|
|
|
/**
|
|
* Initializes the input system.
|
|
*/
|
|
void inputInit();
|
|
|
|
/**
|
|
* Updates the input system.
|
|
*/
|
|
void inputUpdate(); |