Implemented key_is_down() function.

This commit is contained in:
Nicolás Ortega Froysa 2018-03-25 15:29:48 +02:00
parent ea4f4a97b6
commit d871bcec41
No known key found for this signature in database
GPG Key ID: FEC70E3BAE2E69BF
2 changed files with 9 additions and 1 deletions

View File

@ -132,3 +132,10 @@ void handle_event() {
break; break;
} }
} }
int key_is_down(int code) {
if(code < 0 || code >= KEY_MAX)
return -1;
else
return keys[code];
}

View File

@ -53,6 +53,7 @@ void handle_event();
* *
* @param code The key code. * @param code The key code.
* *
* @return If down 1 will be returned, else 0. * @return If down 1 will be returned, if the keycode is
* invalid then -1 is returned, else 0.
*/ */
int key_is_down(int code); int key_is_down(int code);