Re: Key-press detection
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Wed, 29 Aug 2007 05:39:31 +0000
CBFalconer said:
David Sweeney wrote:
I am using C++ (with the Visual C++ compiler) on Windows XP, and
I am hoping to develop a simple computer game. I would like to
know if there is a way to detect which key the user is pressing,
eg, if the user is pressing 'a', can that be transferred into a
character? Can you write:
char c = GetKeyPress();
or something similar?
Not without using something non-standard and system-specific. Most
systems that handle keyboards have means of handling this, but it
can't be standard, because the keyboard may not exist.
If there's no keyboard, it's likely to be quite a short game.
Or perhaps a long one, since the user won't be able to quit! :-)
Note that he did not ask for a standard solution, but for a solution
that works on his platform. (Strictly speaking, he's asking in the
wrong group - he should be over in c.o.m-w.p.w32 - and no doubt this is
the point you're really trying to make.)
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.
- References:
- Key-press detection
- From: David Sweeney
- Re: Key-press detection
- From: CBFalconer
- Key-press detection
- Prev by Date: Re: (Source Code Download) Re: Fast pi program?
- Next by Date: Re: (Source Code Download) Re: Fast pi program?
- Previous by thread: Re: Key-press detection
- Next by thread: Re: Key-press detection
- Index(es):
Relevant Pages
|