Invalid keycodes also return 0 (but print a msg in DEBUG).
This commit is contained in:
parent
d871bcec41
commit
fa9a35444b
@ -135,7 +135,12 @@ void handle_event() {
|
|||||||
|
|
||||||
int key_is_down(int code) {
|
int key_is_down(int code) {
|
||||||
if(code < 0 || code >= KEY_MAX)
|
if(code < 0 || code >= KEY_MAX)
|
||||||
return -1;
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "key_is_down(int): bad key code!\n");
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return keys[code];
|
return keys[code];
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,6 @@ void handle_event();
|
|||||||
*
|
*
|
||||||
* @param code The key code.
|
* @param code The key code.
|
||||||
*
|
*
|
||||||
* @return If down 1 will be returned, if the keycode is
|
* @return If down 1 will be returned, else 0.
|
||||||
* invalid then -1 is returned, else 0.
|
|
||||||
*/
|
*/
|
||||||
int key_is_down(int code);
|
int key_is_down(int code);
|
||||||
|
Loading…
Reference in New Issue
Block a user