Re: Key-press detection



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.

.



Relevant Pages

  • Re: Sangband is back.
    ... A few things when trying 1.0 on Mac: ... I got the 1.0 SDL version compiled on my Macbook. ... Set to 2 or 3 the game won't launch. ... some other lists, such as my own item list, and when I finish a deal. ...
    (rec.games.roguelike.angband)
  • Re: Angband: Maintain or Develop?
    ... While it is clearly helpful to have a better interface, prettier graphics etc. etc., Angband remains a complex turn-based game in a world of shiny shallow real-time games. ... Another poster mentioned that SDL exists for the PSP; there is also an SDL version for Symbian S60, which is the 'other' dominant smartphone OS. ... while reading your article I had an epiphany about TMJ and The Game Of Shopping: why not just get rid of stores entirely? ...
    (rec.games.roguelike.angband)
  • Re: Graphics Library/Engine question
    ... I am currently developing an independant game. ... The main advantage of CDX is that it provides hardware acceleration of blitting etc in a window. ... SDL has the advantage that is has lots of nice ad-ons and is cross platform. ... QUESTION: Does anyone know of any other modern, functional, stable, FREE:-P graphics libraries? ...
    (comp.games.development.programming.misc)
  • Re: defmethod with multiple parameters
    ... Luke Crook wrote: ... the the rules of this game are... ... SDL only supports a single window and I think of a background as ...
    (comp.lang.lisp)
  • Re: Learn Japanese RPG - Released
    ... "Maciej Katafiasz" wrote in message ... > and the prophet was numbered among those called Hello Sadness. ... > If you could use something like SDL, ... Since the game requires the .NET Framework, ...
    (sci.lang.japan)