Mail Archives: djgpp/1999/08/11/08:27:40
You can use allegro to do stuff, but I'll explain it anyway so you know how
it works:
It's simple: when you press an arrow key, or some other key that doesn't
have a corrisponding ASCII character, it first returns a NULL (0), then you
getch() again, it it will return the scancode. The scancodes or arrows are
in the late 70s and early 80s range, I think. I'm not completely sure.
void main()
{
blah blah here's the routine that gets the key
IS_SCANKEY = FALSE;
char c = getch();
if(c == 0)
{
IS_SCANKEY = TRUE;
c = getch();
}
// here's where it's parsed.
if(!IS_SCANKEY)
{
if(c == 'd')
digfortreausre();
}
else // if the key is an abnormal key.
{
if(c == SCANCODE_ARROW_UP)
moveup();
...
}
}
I'm not very good at explaining stuff, but email me if it's too confusing.
guthrie <guthrie AT nbnet DOT nb DOT ca> wrote in message
news:7olkks$ec0$1 AT garnet DOT nbnet DOT nb DOT ca...
> does anyone know how to get input from the keyboard using scancodes etc
> ...to be able to bet input from the arrow keys etc?? ..
>
> I know how to get input using getch() function...in the program i'm
writing
> i want to be able to have the user to choose any of the keys to use ..and
> not just letter keys.
>
> any ideas or links to info on this??
>
> thanks
>
> Anthony Guthrie
>
>
- Raw text -