delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/25/03:47:57

From: Alistair Phillips <al AT bohm DOT anu DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro Loop Code (unlooping)
Date: Fri, 25 Jul 1997 14:52:55 +1000
Organization: Australian National University
Lines: 36
Message-ID: <33D83128.57D2@bohm.anu.edu.au>
References: <33d79d7b DOT 1282088 AT news DOT videotron DOT ca>
Reply-To: a DOT phillips AT student DOT anu DOT edu DOT au
NNTP-Posting-Host: 150.203.21.88
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi There,

The problem is you are waiting for a key press before the loop will
continue. Try this...

void main(void)
{
init variables;
while(!game_over)
{
printf("whatever");
if(key_pressed())
{
/* find out which key */
if(key(KEY_X))game_over=TRUE;
.
.
etc.
.
} /* End if */

You might need to clear the keyboard buffer before the end of the loop
as if you don't the program will go through the if again. Plus it might
be a good idea to put a rest(); in there otherwise you will get alot of
data flowing onto the screen and scrolling off before you can read it.

Hope I've helped,
Alistair

-- 
_____________________________________________________________________
Alistair Phillips              | Email: a DOT phillips AT student DOT anu DOT edu DOT au
IT Student Consultant,         | "I was drunk and,             ,_o
Ba/Bsc Undergraduate.          |  I'm a little hazy."        _ \<,_
Australian National University |  -Darlingheart             ( )/ ( )
_____________________________________________________________________

- Raw text -


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