www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/10/18:38:44

Message-Id: <199908092020.QAA23378@delorie.com>
From: "Batchex" <thedark1 AT kubrick DOT hotpop DOT com>
Organization: Digital Arts Creatives
To: djgpp AT delorie DOT com
Date: Tue, 10 Aug 1999 03:23:07 +0000
MIME-Version: 1.0
Subject: Re: kebaord input
In-reply-to: <7olkks$ec0$1@garnet.nbnet.nb.ca>
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From:          "guthrie" <guthrie AT nbnet DOT nb DOT ca>
> Subject:       kebaord input
> Date:          Mon, 9 Aug 1999 01:15:32 -0300
> Organization:  NBTel Internet
> To:            djgpp AT delorie DOT com
> Reply-to:      djgpp AT delorie DOT com

> does anyone know how to get input from the keyboard using scancodes etc
> ...to be able to bet input from the arrow keys etc?? ..
>
Use _bios_keybrd() or go stright to assembly and use interrupt 16h
(_bios_keybrd() uses int 16h). The drawback is, you can only track a
single keypress at a time. If you want to track multiple keypresses,
then write your own keyboard handler. 
 
> I know how to get input using getch() function...in the program i'm writing
> i want to be able to have the user to choose any of the keys to use ..and
> not just letter keys.
> 
> any ideas or links to info on this??
> 
Make a char array to store the scanned keypress. The array is one to
one mapping with the scancode. Each element of this array may have
only 2 values, 1 if the corresponding key is pressed and 0 if it
isn't. You can now check the array elements corresponding with the 
user setup for 0 (not pressed) or 1 (pressed).

One possibility of bugs in this approach is, when the user press a 
key at one frame, then the corresponding array element is set (1). At 
the next frame, the user releases that key. If the corresponding 
array element is not then reset (0), you'll know what happen.

> thanks
> 
> Anthony Guthrie
> 
Hope that helps.

 
Batchex
thedark1 AT Phreaker DOT net


- Raw text -


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