eobish
diff src/dos/keyb.h @ 7:6a350c554e46
started DOS port
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 19 Jan 2015 15:49:14 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/dos/keyb.h Mon Jan 19 15:49:14 2015 +0200 1.3 @@ -0,0 +1,69 @@ 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 +#define KB_ALT (-2) 1.26 +#define KB_CTRL (-3) 1.27 +#define KB_SHIFT (-4) 1.28 + 1.29 +/* special keys */ 1.30 +enum { 1.31 + KB_LALT, KB_RALT, 1.32 + KB_LCTRL, KB_RCTRL, 1.33 + KB_LSHIFT, KB_RSHIFT, 1.34 + KB_F1, KB_F2, KB_F3, KB_F4, KB_F5, KB_F6, 1.35 + KB_F7, KB_F8, KB_F9, KB_F10, KB_F11, KB_F12, 1.36 + KB_CAPSLK, KB_NUMLK, KB_SCRLK, KB_SYSRQ, 1.37 + KB_ESC = 27, 1.38 + KB_INSERT, KB_DEL, KB_HOME, KB_END, KB_PGUP, KB_PGDN, 1.39 + KB_LEFT, KB_RIGHT, KB_UP, KB_DOWN, 1.40 + KB_NUM_DOT, KB_NUM_ENTER, KB_NUM_PLUS, KB_NUM_MINUS, KB_NUM_MUL, KB_NUM_DIV, 1.41 + KB_NUM_0, KB_NUM_1, KB_NUM_2, KB_NUM_3, KB_NUM_4, 1.42 + KB_NUM_5, KB_NUM_6, KB_NUM_7, KB_NUM_8, KB_NUM_9, 1.43 + KB_BACKSP = 127 1.44 +}; 1.45 + 1.46 + 1.47 +#ifdef __cplusplus 1.48 +extern "C" { 1.49 +#endif 1.50 + 1.51 +int kb_init(int bufsz); /* bufsz can be 0 for no buffered keys */ 1.52 +void kb_shutdown(void); /* don't forget to call this at the end! */ 1.53 + 1.54 +/* Boolean predicate for testing the current state of a particular key. 1.55 + * You may also pass KB_ANY to test if any key is held down. 1.56 + */ 1.57 +int kb_isdown(int key); 1.58 + 1.59 +/* waits for any keypress */ 1.60 +void kb_wait(void); 1.61 + 1.62 +/* removes and returns a single key from the input buffer. 1.63 + * If buffering is disabled (initialized with kb_init(0)), then it always 1.64 + * returns the last key pressed. 1.65 + */ 1.66 +int kb_getkey(void); 1.67 + 1.68 +#ifdef __cplusplus 1.69 +} 1.70 +#endif 1.71 + 1.72 +#endif /* KEYB_H_ */