Mail Archives: djgpp/2000/03/22/13:14:30
From: | Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: ncurses
|
Organization: | Pin Eight Software http://pineight.8m.com/
|
Message-ID: | <urshdso80t583nh6asckbofvbfdb6covd0@4ax.com>
|
References: | <8ba1va$943$1 AT nnrp1 DOT deja DOT com>
|
X-Newsreader: | Forte Agent 1.7/32.534
|
MIME-Version: | 1.0
|
Lines: | 34
|
X-Trace: | /bJ8XTzVWfjIeslaEZ8eRZT1esLM4QE929b9LpDG8XfKTmy37WOsxV7MDSJUgK9Cy2QneJAyrgri!eXia7hpShwApIqm0rUpYaxa1iqKlXdIDOZkg3kUWmrcME4g/b7dIhDgjMpwEkm4IyYIyVS+M4Ls8!yXRYdxI=
|
X-Complaints-To: | abuse AT gte DOT net
|
X-Abuse-Info: | Please be sure to forward a copy of ALL headers
|
X-Abuse-Info: | Otherwise we will be unable to process your complaint properly
|
NNTP-Posting-Date: | Wed, 22 Mar 2000 16:29:42 GMT
|
Distribution: | world
|
Date: | Wed, 22 Mar 2000 16:29:42 GMT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
On Wed, 22 Mar 2000 08:58:24 GMT, wroot AT my-deja DOT com wrote:
>How can I read one keystroke from the keyboard (including but
>not limited to arrow movements, PgUp, PgDn, Del)? I've heard
>it is done with ncurses/curses. If someone could tell me
>which function, header file and namespace I should use, I would
>appreciate it.
If you don't care about porting your program in the future, use conio:
#include <conio.h>
int GetKey()
{
int n = getch();
if(n)
return n;
else
return getch() << 8;
}
This will get regular keypresses in bits 0-7 or extended (Fkey,
arrows, PageUp, etc.) keypresses in bits 8-15.
If you want portability, use PDCurses or Allegro. PDCurses implements
nearly the same API as the ncurses textmode screen control library,
and Allegro runs on DOS, Windows, GNU/Linux, and most UNIXes with X11.
--
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html
This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses. http://www.mcafee.com/
- Raw text -