Renamed KEYBOARD_KEYPRESS/RELEASE -> KEYBOARD_PRESSED/RELEASED

This commit is contained in:
rxi
2016-10-15 16:31:07 +01:00
parent ac83ecf23c
commit d8210bfc35
3 changed files with 7 additions and 7 deletions

View File

@@ -175,7 +175,7 @@ void keyboard_handler() {
code &= ~(1 << 7);
keyboard_keyStates[code] = 0;
e = &keyboard_events.data[keyboard_events.writei & BUFFER_MASK];
e->type = KEYBOARD_KEYRELEASE;
e->type = KEYBOARD_RELEASED;
e->code = code;
e->isrepeat = 0;
keyboard_events.writei++;
@@ -186,7 +186,7 @@ void keyboard_handler() {
if (!isrepeat || keyboard_allowKeyRepeat) {
keyboard_keyStates[code] = 1;
e = &keyboard_events.data[keyboard_events.writei & BUFFER_MASK];
e->type = KEYBOARD_KEYPRESS;
e->type = KEYBOARD_PRESSED;
e->code = code;
e->isrepeat = isrepeat;
keyboard_events.writei++;

View File

@@ -17,8 +17,8 @@ typedef struct {
} keyboard_Event;
enum {
KEYBOARD_KEYPRESS,
KEYBOARD_KEYRELEASE,
KEYBOARD_PRESSED,
KEYBOARD_RELEASED,
KEYBOARD_TEXTINPUT
};

View File

@@ -36,15 +36,15 @@ int l_keyboard_poll(lua_State *L) {
while (keyboard_poll(&e)) {
if (e.type == KEYBOARD_KEYPRESS || e.type == KEYBOARD_KEYRELEASE) {
if (e.type == KEYBOARD_PRESSED || e.type == KEYBOARD_RELEASED) {
lua_newtable(L);
lua_pushstring(L, e.type == KEYBOARD_KEYPRESS ? "down" : "up");
lua_pushstring(L, e.type == KEYBOARD_PRESSED ? "down" : "up");
lua_setfield(L, -2, "type");
lua_pushnumber(L, e.code);
lua_setfield(L, -2, "code");
lua_pushstring(L, e.key);
lua_setfield(L, -2, "key");
if (e.type == KEYBOARD_KEYPRESS) {
if (e.type == KEYBOARD_PRESSED) {
lua_pushboolean(L, e.isrepeat);
lua_setfield(L, -2, "isrepeat");
}