delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/29/21:00:34

From: "Chia" <chia AT top DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro Keyboard Callback
Date: Wed, 29 Jul 1998 19:50:11 -0500
Organization: 404 Software
Lines: 38
Message-ID: <6poft3$6n9@nnrp1.farm.idt.net>
NNTP-Posting-Host: flex-22.top.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

According to the allegro docs, when I use the allegro key callback, the
function is in this form:

  int keyboard_callback(int key) {}

What format does the "key" argument come in?  I tried a simple program to
print the key argument and it crashed due to sigsegv.

    Here is my program:

    int jgKeyCallback(int key);

    int main(void) {
     allegro_init();
     install_keyboard();
     keyboard_callback = jgKeyCallback;
     while(!key[KEY_ESC]);
     allegro_exit();
     return 0;
    }

    int jgKeyCallback(int key) {
     cout << key;
     return key;
    }

Can someone tell me how to process this correctly?  It'd be nice to be able
to detect the insert key and then be able to keep it globally for
insert/overwrite switching and stuff.

I don't think it's a scancode becuase I tried using that and it didn't work,
so I'm at a loss.

Thanks!

// chia AT top DOT net -- http://www.top.net/chia/


- Raw text -


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