-
keyboard control
if u r using bc++b these are predefined to VK_LEFT, VK_RIGHT and so on...
otherwise, this should help:
#define LEFT_TEXT 0
#define CENTER_TEXT 1
#define RIGHT_TEXT 2
#define BOTTOM_TEXT 0
#define TOP_TEXT 2
#define NORM_WIDTH 1
#define THICK_WIDTH 3
#define DOTTEDLINE_LENGTH 2
#define CENTRELINE_LENGTH 4
#define USER_CHAR_SIZE 0
#define MAXCOLORS 15
#define CLIP_ON 1
#define CLIP_OFF 0
#define TOP_ON 1
#define TOP_OFF 0
// Definitions for the key pad extended keys are added here. I have also
// modified getch() so that when one of these keys are pressed, getch will
// return a zero followed by one of these values. This is the same way
// that it works in conio for dos applications.
// M. Main -- Nov 3, 1998
#define KEY_HOME 71
#define KEY_UP 72
#define KEY_PGUP 73
#define KEY_LEFT 75
#define KEY_CENTER 76
#define KEY_RIGHT 77
#define KEY_END 79
#define KEY_DOWN 80
#define KEY_PGDN 81
#define KEY_INSERT 82
#define KEY_DELETE 83
#define KEY_F1 59
#define KEY_F2 60
#define KEY_F3 61
#define KEY_F4 62
#define KEY_F5 63
#define KEY_F6 64
#define KEY_F7 65
#define KEY_F8 66
#define KEY_F9 67
void main ()
{char ch=0;
ch=getch();
switch(ch)
{case KEY_LEFT:
//....................
}
}
-
Eh, what's the question?
...and it's better to do this:
if(kbhit()) ch=getch();
Then it won't attempt to take the value of getch() unless a key have been pressed.