BG implemented
This commit is contained in:
@ -1,60 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "input.h"
|
||||
#include "raylib.h"
|
||||
|
||||
typedef struct {
|
||||
int32_t key;
|
||||
uint8_t flag;
|
||||
} inputmap_t;
|
||||
|
||||
const inputmap_t INPUT_MAP[] = {
|
||||
{ KEY_W, INPUT_UP },
|
||||
{ KEY_S, INPUT_DOWN },
|
||||
{ KEY_A, INPUT_LEFT },
|
||||
{ KEY_D, INPUT_RIGHT },
|
||||
|
||||
{ KEY_SPACE, INPUT_ACTION },
|
||||
{ KEY_E, INPUT_ACTION },
|
||||
{ KEY_ENTER, INPUT_ACTION },
|
||||
|
||||
{ KEY_ESCAPE, INPUT_CANCEL },
|
||||
{ KEY_Q, INPUT_CANCEL },
|
||||
{ KEY_BACKSPACE, INPUT_CANCEL },
|
||||
|
||||
{ KEY_UP, INPUT_UP },
|
||||
{ KEY_DOWN, INPUT_DOWN },
|
||||
{ KEY_LEFT, INPUT_LEFT },
|
||||
{ KEY_RIGHT, INPUT_RIGHT },
|
||||
{ KEY_ENTER, INPUT_ACTION },
|
||||
{ KEY_BACKSPACE, INPUT_CANCEL },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
void inputInit() {
|
||||
|
||||
}
|
||||
|
||||
void inputUpdate() {
|
||||
uint8_t state = 0;
|
||||
inputmap_t *map = INPUT_MAP;
|
||||
|
||||
do {
|
||||
if(IsKeyDown(map->key)) {
|
||||
state |= map->flag;
|
||||
}
|
||||
map++;
|
||||
} while(map->key != 0);
|
||||
|
||||
INPUT.previous = INPUT.current;
|
||||
INPUT.current = state;
|
||||
}
|
||||
|
||||
void inputDispose() {
|
||||
|
||||
}
|
Reference in New Issue
Block a user