Invalid keycodes also return 0 (but print a msg in DEBUG).

This commit is contained in:
Nicolás Ortega Froysa
2018-03-25 15:34:53 +02:00
parent d871bcec41
commit fa9a35444b
2 changed files with 7 additions and 3 deletions

View File

@ -135,7 +135,12 @@ void handle_event() {
int key_is_down(int code) {
if(code < 0 || code >= KEY_MAX)
return -1;
{
#ifdef DEBUG
fprintf(stderr, "key_is_down(int): bad key code!\n");
#endif
return 0;
}
else
return keys[code];
}