deepstone
diff src/keyb.h @ 33:03a0b307706a
added proper keyboard handling
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 23 Sep 2013 04:34:43 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/keyb.h Mon Sep 23 04:34:43 2013 +0300 1.3 @@ -0,0 +1,40 @@ 1.4 +/* 1.5 +DOS interrupt-based keyboard driver. 1.6 +Copyright (C) 2013 John Tsiombikas <nuclear@member.fsf.org> 1.7 + 1.8 +This program is free software: you can redistribute it and/or modify 1.9 +it under the terms of the GNU General Public License as published by 1.10 +the Free Software Foundation, either version 3 of the License, or 1.11 +(at your option) any later version. 1.12 + 1.13 +This program is distributed in the hope that it will be useful, 1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of 1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.16 +GNU General Public License for more details. 1.17 + 1.18 +You should have received a copy of the GNU General Public License 1.19 +along with the program. If not, see <http://www.gnu.org/licenses/> 1.20 +*/ 1.21 +#ifndef KEYB_H_ 1.22 +#define KEYB_H_ 1.23 + 1.24 +#define KB_ANY (-1) 1.25 + 1.26 +int kb_init(int bufsz); /* bufsz can be 0 for no buffered keys */ 1.27 +void kb_shutdown(void); /* don't forget to call this at the end! */ 1.28 + 1.29 +/* Boolean predicate for testing the current state of a particular key. 1.30 + * You may also pass KB_ANY to test if any key is held down. 1.31 + */ 1.32 +int kb_isdown(int key); 1.33 + 1.34 +/* waits for any keypress */ 1.35 +void kb_wait(void); 1.36 + 1.37 +/* removes and returns a signle key from the input buffer. 1.38 + * If buffering is disabled (initialized with kb_init(0)), then it always 1.39 + * returns the last key pressed. 1.40 + */ 1.41 +int kb_getkey(void); 1.42 + 1.43 +#endif /* KEYB_H_ */