Mail Archives: djgpp/1998/06/19/08:15:38
From: | Nicolas Blais <eletech AT netrover DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Here's my function to get a string...
|
Date: | Fri, 19 Jun 1998 07:55:17 -0400
|
Organization: | Elemental Technologies
|
Lines: | 32
|
Message-ID: | <358A51A3.67A96095@netrover.com>
|
NNTP-Posting-Host: | 198.168.87.156
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi, I asked before for someone to write a function to let the user give
a string with Allegro. I already have one, but it has one major
problem; you can't use Backspaces. Is there a way to modify my function
to do so? It uses double buffering (useless but I still brag about
it...)
void get_keys(int leftx, int topy, int Num_ch)
{
clear(screen);
char buf[200];
char msg[2];
int current_num_ch = 0;
do
{
current_num_ch++;
if (current_num_ch == Num_ch) exit(0);
int value = readkey();
sprintf(msg,"%c",(value & 0xFF));
strcat(buf, msg);
int x = text_length(font, buf);
int y = text_height(font)+4;
BITMAP* textbmp = create_bitmap(x,y);
clear(textbmp);
textout((BITMAP*)textbmp,font,buf,0,0,RGB(255,0,0));
blit((BITMAP*)textbmp, screen, 0,0,leftx,topy,textbmp->w,textbmp->h);
destroy_bitmap(textbmp);
}
while (!key[KEY_ENTER]);
}
Hope you can find this error, Nicolas Blais
- Raw text -