delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/04/18:32:45

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Hooking the keyboard interrupt?
Date: Thu, 4 Jun 1998 20:24:13 +0100
Organization: None
Message-ID: <SSIjeOAdRvd1EwXm@talula.demon.co.uk>
References: <19980603235734 DOT AAD6210 AT ppp104 DOT cartsys DOT com>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 23
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Nate Eldredge writes:
>>Is there also a way to hook the keyboard in Allegro?
>
>It has a built in keyboard hooking system, see the "Keyboard" section. If
>you want to write your own handler, see the functions `install_keyboard_hooks'.

The install_keyboard_hooks() function is actually a bit different from
this: it is intended for people who want to use BIOS keyboard input or
maybe write their own handler, but still be able to read keyboard events
using the Allegro keypressed() and readkey() functions. This is mostly
useful if someone is trying to mix the Allegro GUI functions (that call
readkey()) with some other keyboard input module.

If you want to be notified of each keypress, you should use the Allegro
install_keyboard() function and then set the keyboard_callback()
function pointer to some handler routine of your own. I don't really
recommend doing this, though: it is usually much better to use the
readkey() function or key[] array to access the input.


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Miracles are nothing if you've got the wrong intentions" - Mike Keneally

- Raw text -


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