Mail Archives: djgpp/1997/10/17/05:28:25
At 19.21 1997-10-16 GMT, you wrote:
>I got here some simple code which dosen't run as I expect it to work:
>
>#include <stdio.h>
>#include <allegro.h>
>
>void main()
>{
> allegro_init();
> install_keyboard();
>
> if (readkey() == 'a') {
> printf ("a was pressed");
> } else {
> printf ("a wasn't pressed");
> }
>}
Well, the "problem" here is that readkey() returns an integer with
information in the lower 16-bits. The high byte of this contains the
scancode, i.e. ESC = 1 and so on. The low byte contains the Ascii
character, so converting this to a char is neccessary if you just want the
character. This is covered in the docs too AFAIK, read them! :)
-- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se --
*****************************************************
* A brief description of DJGPP: *
* NEVER BEFORE HAS SO FEW DONE SO MUCH FOR SO MANY! *
*****************************************************
- Raw text -