-
msdos arrow keys?
question: how do i get the arrow keys instead of these shift, alt, and control keys working? i.e. left arrow, right arrow, up arrow, down arrow. help. s.o.s.
Code:
keyboard=*(unsigned short far*)MK_FP(0x40,0x17);
if(kbhit()){a=getch();}
if(keyboard&0x0002)
{
// action.
}
if(keyboard&0x0001)
{
// action.
}
if(keyboard&0x0004)
{
// action.
}
if(keyboard&0x0008)
{
// action.
}
:confused:
-
Here is what I did for my maze game that used arrow keys:
Code:
if(kbhit()) //if a key is pressed
{
key = getch(); //get the key
key_2 = getch();
move = (char)key_2; //change it to an int
}
This below is what you want to do if a certain key is pressed:
Code:
if(move == 77)
{
//do stuff
}
left = 75
right = 77
up = 72
down = 80
Those are the values for each of the keys.
Also, this site has a lot of good info on ASCII values.
EDIT: took out some code that was ony relevant to my program
-
that's a neat little maze game you made there.
-