rayzor
diff src/keyb.h @ 0:2a5340a6eee4
rayzor first commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 05 Apr 2014 08:46:27 +0300 |
parents | |
children | a826bf0fb169 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/keyb.h Sat Apr 05 08:46:27 2014 +0300 1.3 @@ -0,0 +1,48 @@ 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 +#ifdef __cplusplus 1.27 +extern "C" { 1.28 +#endif 1.29 + 1.30 +int kb_init(int bufsz); /* bufsz can be 0 for no buffered keys */ 1.31 +void kb_shutdown(void); /* don't forget to call this at the end! */ 1.32 + 1.33 +/* Boolean predicate for testing the current state of a particular key. 1.34 + * You may also pass KB_ANY to test if any key is held down. 1.35 + */ 1.36 +int kb_isdown(int key); 1.37 + 1.38 +/* waits for any keypress */ 1.39 +void kb_wait(void); 1.40 + 1.41 +/* removes and returns a single key from the input buffer. 1.42 + * If buffering is disabled (initialized with kb_init(0)), then it always 1.43 + * returns the last key pressed. 1.44 + */ 1.45 +int kb_getkey(void); 1.46 + 1.47 +#ifdef __cplusplus 1.48 +} 1.49 +#endif 1.50 + 1.51 +#endif /* KEYB_H_ */