| home
| contents
| previous
| next page
| send comment
| send link
| add bookmark |
input.h
/*-------------------------------------------------------------------------*
INPUT.H
common definitions for console input module
by: Stephen R. Schmitt
*-------------------------------------------------------------------------*/
// #define DEBUG_INPUT
// #define TEST_INPUT
// messages
#define MSG_CHARACTER 1
#define MSG_FUNCTION 2
#define MSG_MOUSE_LF 3
#define MSG_MOUSE_RT 4
#define MSG_MOUSE_MD 5
#define MSG_MOUSE_MOVE 6
#define MSG_PAINT 7
#define MSG_COMMAND 8
// special keyboard character codes < 256
#define BELL 7 // console beep
#define BACKSPACE 8
#define TAB 9
#define ENTER 13
#define ESCAPE 27
// keyboard function key codes >= 256
#define MAX_ASCII 255 // used to compute function key codes below
#define F1_KEY MAX_ASCII + 59
#define F2_KEY MAX_ASCII + 60
#define F3_KEY MAX_ASCII + 61
#define F4_KEY MAX_ASCII + 62
#define F5_KEY MAX_ASCII + 63
#define F6_KEY MAX_ASCII + 64
#define F7_KEY MAX_ASCII + 65
#define F8_KEY MAX_ASCII + 66
#define F9_KEY MAX_ASCII + 67
#define F10_KEY MAX_ASCII + 68
#define F11_KEY MAX_ASCII + 133
#define F12_KEY MAX_ASCII + 134
#define SHIFT_F1 MAX_ASCII + 84
#define SHIFT_F2 MAX_ASCII + 85
#define SHIFT_F3 MAX_ASCII + 86
#define SHIFT_F4 MAX_ASCII + 87
#define SHIFT_F5 MAX_ASCII + 88
#define SHIFT_F6 MAX_ASCII + 89
#define SHIFT_F7 MAX_ASCII + 90
#define SHIFT_F8 MAX_ASCII + 91
#define SHIFT_F9 MAX_ASCII + 92
#define SHIFT_F10 MAX_ASCII + 93
#define SHIFT_F11 MAX_ASCII + 135
#define SHIFT_F12 MAX_ASCII + 136
#define CTRL_F1 MAX_ASCII + 94
#define CTRL_F2 MAX_ASCII + 95
#define CTRL_F3 MAX_ASCII + 96
#define CTRL_F4 MAX_ASCII + 97
#define CTRL_F5 MAX_ASCII + 98
#define CTRL_F6 MAX_ASCII + 99
#define CTRL_F7 MAX_ASCII + 100
#define CTRL_F8 MAX_ASCII + 101
#define CTRL_F9 MAX_ASCII + 102
#define CTRL_F10 MAX_ASCII + 103
#define CTRL_F11 MAX_ASCII + 137
#define CTRL_F12 MAX_ASCII + 138
#define ALT_F1 MAX_AXCII + 104
#define ALT_F2 MAX_ASCII + 105
#define ALT_F3 MAX_ASCII + 106
#define ALT_F4 MAX_ASCII + 107
#define ALT_F5 MAX_ASCII + 108
#define ALT_F6 MAX_ASCII + 109
#define ALT_F7 MAX_ASCII + 110
#define ALT_F8 MAX_ASCII + 111
#define ALT_F9 MAX_ASCII + 112
#define ALT_F10 MAX_ASCII + 113
#define ALT_F11 MAX_ASCII + 139
#define ALT_F12 MAX_ASCII + 140
#define ALT_1 MAX_ASCII + 120
#define ALT_2 MAX_ASCII + 121
#define ALT_3 MAX_ASCII + 122
#define ALT_4 MAX_ASCII + 123
#define ALT_5 MAX_ASCII + 124
#define ALT_6 MAX_ASCII + 125
#define ALT_7 MAX_ASCII + 126
#define ALT_8 MAX_ASCII + 127
#define ALT_9 MAX_ASCII + 128
#define ALT_0 MAX_ASCII + 129
#define ALT_HYPHEN MAX_ASCII + 130
#define ALT_EQUALS MAX_ASCII + 131
#define ALT_Q MAX_ASCII + 16
#define ALT_W MAX_ASCII + 17
#define ALT_E MAX_ASCII + 18
#define ALT_R MAX_ASCII + 19
#define ALT_T MAX_ASCII + 20
#define ALT_Y MAX_ASCII + 21
#define ALT_U MAX_ASCII + 22
#define ALT_I MAX_ASCII + 23
#define ALT_O MAX_ASCII + 24
#define ALT_P MAX_ASCII + 25
#define ALT_A MAX_ASCII + 30
#define ALT_S MAX_ASCII + 31
#define ALT_D MAX_ASCII + 32
#define ALT_F MAX_ASCII + 33
#define ALT_G MAX_ASCII + 34
#define ALT_H MAX_ASCII + 35
#define ALT_J MAX_ASCII + 36
#define ALT_K MAX_ASCII + 37
#define ALT_L MAX_ASCII + 38
#define ALT_Z MAX_ASCII + 44
#define ALT_X MAX_ASCII + 45
#define ALT_C MAX_ASCII + 46
#define ALT_V MAX_ASCII + 47
#define ALT_B MAX_ASCII + 48
#define ALT_N MAX_ASCII + 49
#define ALT_M MAX_ASCII + 50
#define SHIFT_TAB MAX_ASCII + 15
#define HOME MAX_ASCII + 71
#define UP_ARROW MAX_ASCII + 72
#define PAGE_UP MAX_ASCII + 73
#define LF_ARROW MAX_ASCII + 75
#define RT_ARROW MAX_ASCII + 77
#define END MAX_ASCII + 79
#define DN_ARROW MAX_ASCII + 80
#define PAGE_DN MAX_ASCII + 81
#define INSERT MAX_ASCII + 82
#define DELETE MAX_ASCII + 83
#define CTRL_PRT_SCN MAX_ASCII + 114
#define CTRL_LF_ARROW MAX_ASCII + 115
#define CTRL_RT_ARROW MAX_ASCII + 116
#define CTRL_END MAX_ASCII + 117
#define CTRL_PAGE_DN MAX_ASCII + 118
#define CTRL_HOME MAX_ASCII + 119
#define CTRL_PAGE_UP MAX_ASCII + 132
#define CTRL_UP_ARROW MAX_ASCII + 141
#define CTRL_MINUS MAX_ASCII + 142
#define CTRL_KP5 MAX_ASCII + 143
#define CTRL_PLUS MAX_ASCII + 144
#define CTRL_DN_ARROW MAX_ASCII + 145
#define CTRL_INSERT MAX_ASCII + 146
#define CTRL_DELETE MAX_ASCII + 147
#define CTRL_TAB MAX_ASCII + 148
#define CTRL_SLASH MAX_ASCII + 149
#define CTRL_ASTERISK MAX_ASCII + 150
#define CTRL_ENTER MAX_ASCII + 224
#define ALT_HOME MAX_ASCII + 151
#define ALT_UP_ARROW MAX_ASCII + 152
#define ALT_PAGE_UP MAX_ASCII + 153
#define ALT_LF_ARROW MAX_ASCII + 155
#define ALT_RT_ARROW MAX_ASCII + 157
#define ALT_END MAX_ASCII + 159
#define ALT_DN_ARROW MAX_ASCII + 160
#define ALT_PAGE_DN MAX_ASCII + 161
#define ALT_INSERT MAX_ASCII + 162
#define ALT_DELETE MAX_ASCII + 163
#define ALT_SLASH MAX_ASCII + 164
#define ALT_TAB MAX_ASCII + 165
#define ALT_ENTER MAX_ASCII + 166
#define CTRL_LETTER 511 // used to Ctrl + letter key codes below
#define CTRL_A CTRL_LETTER + 1
#define CTRL_B CTRL_LETTER + 2
#define CTRL_C CTRL_LETTER + 3
#define CTRL_D CTRL_LETTER + 4
#define CTRL_E CTRL_LETTER + 5
#define CTRL_F CTRL_LETTER + 6
#define CTRL_G CTRL_LETTER + 7
#define CTRL_H CTRL_LETTER + 8
#define CTRL_I CTRL_LETTER + 9
#define CTRL_J CTRL_LETTER + 10
#define CTRL_K CTRL_LETTER + 11
#define CTRL_L CTRL_LETTER + 12
#define CTRL_M CTRL_LETTER + 13
#define CTRL_N CTRL_LETTER + 14
#define CTRL_O CTRL_LETTER + 15
#define CTRL_P CTRL_LETTER + 16
#define CTRL_Q CTRL_LETTER + 17
#define CTRL_R CTRL_LETTER + 18
#define CTRL_S CTRL_LETTER + 19
#define CTRL_T CTRL_LETTER + 20
#define CTRL_U CTRL_LETTER + 21
#define CTRL_V CTRL_LETTER + 22
#define CTRL_W CTRL_LETTER + 23
#define CTRL_X CTRL_LETTER + 24
#define CTRL_Y CTRL_LETTER + 25
#define CTRL_Z CTRL_LETTER + 26
#define CTRL_SPACE CTRL_LETTER + 32
// keyboard modifiers
#define MOD_RIGHT 0x01 // right shift key
#define MOD_LEFT 0x02 // left shift key
#define MOD_CTRL 0x04 // either ctrl key
#define MOD_ALT 0x08 // either alt key
/*-------------------------------------------------------------------------*
* "input" is the class used for input from the console by either the
* keyboard or the mouse.
*/
class input
{
int present; // 0 if mouse not present
int buttons; // number of buttons on mouse
int delta; // mouse movement step size
void read_mouse( int *, int *, int * );
void mouse_move( int *, int * );
int xbios_key( int );
public:
input();
unsigned int message( int *, int *, int * );
void mouse_reset();
void set_mouse( int, int );
void mouse_cursor_on();
void mouse_cursor_off();
void post_key( int );
};
| home
| contents
| previous
| next page
| send comment
| send link
| add bookmark |
Copyright © 2004, Stephen R. Schmitt