delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/09/09:00:34

From: Clemens Valens <c DOT valens AT mindless DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: keyboard handlers?
Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here
X-Originating-Host: 195.154.148.69
X-Wren-Trace: cHFWdmNxLU9nNSVTYT8wODoiMSEuJ2c9JyU+IyE8MXEvLmQ+LmQwMSwkLTopaCJlPmt8cmMgVVl9bD98bjR2ajoyf3U=
Message-ID: <928931198.10341@www.remarq.com>
References: <11841041 DOT 928929837083 DOT JavaMail DOT w-epost AT localhost>
Lines: 25
Date: Wed, 09 Jun 1999 04:26:37 -0800
NNTP-Posting-Host: 10.0.3.195
X-Trace: WReNphoon3 928931445 10.0.3.195 (Wed, 09 Jun 1999 05:30:45 PDT)
NNTP-Posting-Date: Wed, 09 Jun 1999 05:30:45 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Well, you can always try something like this:

while (1) {
  if (kbhit()) {
    switch (getch()) {
      case 'l': go_left(); break;
      case 'r': go_right(); break;
      ...
    }
  }

  ...

}

This will let you handle key input for a simple game.

I have always understood that the use of special keyboard
handlers in games was to speed things up and to have more
control. You can find all about it in the PC Programmer's
Bible or similar books.



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019