Working on cmd bind
This commit is contained in:
@@ -8,6 +8,17 @@
|
||||
#include "input.h"
|
||||
#include "assert/assert.h"
|
||||
#include "util/memory.h"
|
||||
#include "util/string.h"
|
||||
|
||||
char_t INPUT_BIND_NAMES[INPUT_BIND_COUNT][16] = {
|
||||
[INPUT_BIND_UP] = "UP",
|
||||
[INPUT_BIND_DOWN] = "DOWN",
|
||||
[INPUT_BIND_LEFT] = "LEFT",
|
||||
[INPUT_BIND_RIGHT] = "RIGHT",
|
||||
[INPUT_BIND_ACCEPT] = "ACCEPT",
|
||||
[INPUT_BIND_CANCEL] = "CANCEL",
|
||||
[INPUT_BIND_CONSOLE] = "CONSOLE"
|
||||
};
|
||||
|
||||
input_t INPUT;
|
||||
|
||||
@@ -72,4 +83,14 @@ bool_t inputPressed(const inputbind_t bind) {
|
||||
|
||||
bool_t inputReleased(const inputbind_t bind) {
|
||||
return !inputIsDown(bind) && inputWasDown(bind);
|
||||
}
|
||||
|
||||
inputbind_t inputBindGetByName(const char_t *name) {
|
||||
assertNotNull(name, "name must not be NULL");
|
||||
for(inputbind_t i = 0; i < INPUT_BIND_COUNT; i++) {
|
||||
if(stringCompareInsensitive(INPUT_BIND_NAMES[i], name) == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return INPUT_BIND_COUNT;
|
||||
}
|
||||
Reference in New Issue
Block a user