www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/25/12:15:29

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Commande boiskey
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <d4bcls06josmpr3q7ceopkjvajectf3dgt@4ax.com>
References: <hCp55.1139$jT5 DOT 7422 AT wagner DOT videotron DOT net> <hpacls8oit3njiu9698ts9gk8umau5on3o AT 4ax DOT com>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 45
X-Trace: +rhFIp3iBJRHRU9X5biZzLCY2IOp8E3iKBK3QtxWsUQlf1E3DM/ovc9iy7FTkNCfJRnh+YDk76xE!Eb9Mw3+YY7NNp/0Ryl5FL/iYWFrSfIaZdEXQCinaAe0AT0q4FvK9rosMdzIeqdI5v5fdTcyn/gx+!ebIT
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Sun, 25 Jun 2000 16:05:48 GMT
Distribution: world
Date: Sun, 25 Jun 2000 16:05:48 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Sun, 25 Jun 2000 11:33:51 -0400, "Redouane Zrari"
<zrari AT hotmail DOT com> wrote:

>Hello everyone.
>
>In a small program, I try to make an object move by the left and right
>arrow keys.  I test them with bioskey().  The problem:  even after
>having released the cursor, the object continues to move in the
>direction of the first pressed key (even if I press the other way).  I
>had to understand that keypresses remain in the "keyboard buffer"
>but.....  What to make of this?
>
>I use the Djgpp compiler.
>
>Thanks in advance

I haven't used bioskey(), but you need to "get" the keypress after you
have found out that the key was pressed; this pulls it out of the
"keyboard buffer".

Before I found Allegro, I used kbhit() to see if the user pressed a
key, then getch() to get it, through this function I wrote:

int GetKey()
{
  int n;

  if(!kbhit())
    return 0;
  n = getch();
  if(n)
    return n;
  return getch() << 8;
}

It returns 0 for no keypress, the ASCII value of a standard key, or
the scancode (shifted left 8 bits) for an extended key.

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


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