Prog
This commit is contained in:
72
src/input.h
72
src/input.h
@ -8,28 +8,8 @@
|
||||
#pragma once
|
||||
#include "dusk.h"
|
||||
|
||||
typedef enum {
|
||||
INPUT_UP,
|
||||
INPUT_DOWN,
|
||||
INPUT_LEFT,
|
||||
INPUT_RIGHT,
|
||||
INPUT_ACCEPT,
|
||||
INPUT_CANCEL,
|
||||
INPUT_TOGGLE_CONSOLE,
|
||||
} inputbind_t;
|
||||
|
||||
#define INPUT_BIND_COUNT INPUT_TOGGLE_CONSOLE + 1
|
||||
|
||||
typedef struct {
|
||||
const int32_t key;
|
||||
const inputbind_t bind;
|
||||
} inputbindmap_t;
|
||||
|
||||
typedef struct {
|
||||
bool_t current[INPUT_BIND_COUNT];
|
||||
bool_t previous[INPUT_BIND_COUNT];
|
||||
int32_t keyPressed;
|
||||
char_t charPressed;
|
||||
char_t input;
|
||||
} input_t;
|
||||
|
||||
extern input_t INPUT;
|
||||
@ -42,52 +22,4 @@ void inputInit(void);
|
||||
/**
|
||||
* Updates the input system.
|
||||
*/
|
||||
void inputUpdate(void);
|
||||
|
||||
/**
|
||||
* Returns whether a given input is currently pressed.
|
||||
*
|
||||
* @param input The input to check.
|
||||
* @return True if the input is pressed, false otherwise.
|
||||
*/
|
||||
bool_t inputIsDown(const inputbind_t input);
|
||||
|
||||
/**
|
||||
* Returns whether a given input is currently up.
|
||||
*
|
||||
* @param input The input to check.
|
||||
* @return True if the input is up, false otherwise.
|
||||
*/
|
||||
bool_t inputIsUp(const inputbind_t input);
|
||||
|
||||
/**
|
||||
* Returns whether a given input was just pressed.
|
||||
*
|
||||
* @param input The input to check.
|
||||
* @return True if the input was just pressed, false otherwise.
|
||||
*/
|
||||
bool_t inputWasDown(const inputbind_t input);
|
||||
|
||||
/**
|
||||
* Returns whether a given input was just released.
|
||||
*
|
||||
* @param input The input to check.
|
||||
* @return True if the input was just released, false otherwise.
|
||||
*/
|
||||
bool_t inputWasUp(const inputbind_t input);
|
||||
|
||||
/**
|
||||
* Returns whether a given input was just pressed.
|
||||
*
|
||||
* @param input The input to check.
|
||||
* @return True if the input was just pressed, false otherwise.
|
||||
*/
|
||||
bool_t inputIsPressed(const inputbind_t input);
|
||||
|
||||
/**
|
||||
* Returns whether a given input was just released.
|
||||
*
|
||||
* @param input The input to check.
|
||||
* @return True if the input was just released, false otherwise.
|
||||
*/
|
||||
bool_t inputIsReleased(const inputbind_t input);
|
||||
void inputUpdate(void);
|
Reference in New Issue
Block a user