Re: Key-press detection
- From: jg.campbell.ng@xxxxxxxxx
- Date: Sat, 01 Sep 2007 11:00:06 -0000
On Aug 28, 9:08 pm, "Justin.SpahrSumm...@xxxxxxxxx"
<Justin.SpahrSumm...@xxxxxxxxx> wrote:
On Aug 28, 11:35 am, "David Sweeney" <David.Sween...@xxxxxxxxxxxxxx>
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?
SDL (http://www.libsdl.org) provides some pretty easy facilities for
doing what you want, and may be helpful in developing the rest of your
game as well. As a bonus, it runs on many platforms, so your game will
be portable if you ever decide to take that route, make it more
advanced, etc.
Seconded.
Windows-level APIs will in general be too low-level --- (OP) you'll
just keep running into things that are far more difficult than they
should be; next, unless you have a desire to learn DirectX and invest
the months that this requires, then SDL is your solution.
http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet/index.php
is a good place for tutorials.
There's a book by Ron Penton, Data Structures for Game Programmers,
that teaches some computer science and game programming in a resonably
accessible manner; it uses SDL.
Incidentally, the Python game package Pygame is based on a Python SDL
binding. Andy Harris's book "Game Programming: The L Line", based on
Pygame, looks to me a very fine introduction to game programming ---
I mean no monsters to wrestle with or oceans to cross before you get
to Hello, World.
And, there's a Java SDL binding (but never used it):
http://sdljava.sourceforge.net/
Best regards,
Jon C.
.
- Prev by Date: Re: Key-press detection
- Next by Date: Re: Jumps across functions
- Previous by thread: Re: Key-press detection
- Next by thread: Re: Jumps across functions
- Index(es):
Relevant Pages
|