Home > Archive > Unix Programming > May 2004 > Detecting multiple keypresses
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Detecting multiple keypresses
|
|
| kstahl 2004-05-12, 9:08 pm |
| Howdy,
I would like to get down to the nitty-gritty of the keyboard's operation.
Specifically, I would like to poll only a few keys on the keyboard, and I
would like to know when more than one key is pressed. In other words, I
would like to know how to access the keyboard's scan lines, so that if, for
example, the user is holding two of the arrow keys pressed simultaneously, I
will get a continuously changing response of Left-Right-Left-Right-and so
on. So far, all that comes to mind is scanf(), but this is clearly
inadequate.
Thanks for your help,
-Karl
| |
| Måns Rullgård 2004-05-12, 9:08 pm |
| "kstahl" <kstahl@stanford.edu> writes:
> Howdy,
>
> I would like to get down to the nitty-gritty of the keyboard's operation.
> Specifically, I would like to poll only a few keys on the keyboard, and I
> would like to know when more than one key is pressed. In other words, I
> would like to know how to access the keyboard's scan lines, so that if, for
> example, the user is holding two of the arrow keys pressed simultaneously, I
> will get a continuously changing response of Left-Right-Left-Right-and so
> on. So far, all that comes to mind is scanf(), but this is clearly
> inadequate.
I don't know a portable way to do it, but keep in mind that many
keyboards are unable to report all combinations of three or more
keys. Any two keys are usually fine.
--
Måns Rullgård
mru@kth.se
| |
| Alex Sisson 2004-05-13, 6:31 am |
| "kstahl" <kstahl@stanford.edu> wrote in message news:<c7tv99$fh8$1@news.Stanford.EDU>...
> Howdy,
>
> I would like to get down to the nitty-gritty of the keyboard's operation.
> Specifically, I would like to poll only a few keys on the keyboard, and I
> would like to know when more than one key is pressed. In other words, I
> would like to know how to access the keyboard's scan lines, so that if, for
> example, the user is holding two of the arrow keys pressed simultaneously, I
> will get a continuously changing response of Left-Right-Left-Right-and so
> on. So far, all that comes to mind is scanf(), but this is clearly
> inadequate.
>
> Thanks for your help,
> -Karl
SDL may be able to help, as that is geared towards gaming. see http://libsdl.org.
|
|
|
|
|