delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/11/08:27:40

From: "Al Morgan" <muaddib AT proaxis DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: kebaord input
Date: Tue, 10 Aug 1999 14:52:58 -0700
Organization: Posted via Supernews, http://www.supernews.com
Lines: 57
Message-ID: <rqvtgvgvkur15@corp.supernews.com>
References: <7olkks$ec0$1 AT garnet DOT nbnet DOT nb DOT ca>
X-Complaints-To: newsabuse AT supernews DOT com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

You can use allegro to do stuff, but I'll explain it anyway so you know how
it works:

It's simple: when you press an arrow key, or some other key that doesn't
have a corrisponding ASCII character, it first returns a NULL (0), then you
getch() again, it it will return the scancode.  The scancodes or arrows are
in the late 70s and early 80s range, I think.  I'm not completely sure.

void main()
    {
    blah blah here's the routine that gets the key

    IS_SCANKEY = FALSE;
    char c = getch();
    if(c == 0)
        {
        IS_SCANKEY = TRUE;
        c = getch();
        }

    // here's where it's parsed.

    if(!IS_SCANKEY)
        {
        if(c == 'd')
            digfortreausre();
        }
        else // if the key is an abnormal key.
        {
        if(c == SCANCODE_ARROW_UP)
            moveup();
        ...
        }
    }

I'm not very good at explaining stuff, but email me if it's too confusing.


guthrie <guthrie AT nbnet DOT nb DOT ca> wrote in message
news:7olkks$ec0$1 AT garnet DOT nbnet DOT nb DOT ca...
> does anyone know how to get input from the keyboard using scancodes etc
> ...to be able to bet input from the arrow keys etc?? ..
>
> 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??
>
> thanks
>
> Anthony Guthrie
>
>


- Raw text -


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