can do
i'll send the whole routine:
Code:
char *txtInput(int sx,int sy,FONT font)
{
char *temp1;
char *temp;
int i,j,k;
int keyGroup;
int xVal;
int len;
setVGA();
temp1="0";
temp="";
len=0;
xVal=0;
while (!xVal)
{
while (1)
{
k=getch();
if ( (k >= 97) && (k <= 122) )
{
keyGroup=1;
break;
}
if ( (k >= 65) && (k <= 90) )
{
keyGroup=2;
break;
}
if ( (k >= 48) && (k <= 57) )
{
keyGroup=3;
break;
}
if (k==13)
{
keyGroup=4;
break;
}
if (k==8)
{
keyGroup=5;
break;
}
}
temp1[0]=k;
switch (keyGroup)
{
case 1:
case 2:
case 3:
dispText(temp1,font,sx,sy);
temp[len]=k;
len++;
temp[len]=0;
sx+=6;
break;
case 4:
xVal=1;
break;
case 5:
if (len==0) break;
sx-=6;
Wipe(sx,sy,5,8);
temp[len]=0;
len--;
break;
}
}
return temp;
}
thats it. ill explain some of the functions:
'Wipe' blacks out a triangle on the screen(this is mode 13)
'dispText' displays a string at a certain point in a certain font
if you know a better way of taking an input from getch(), then adding it to a temporary string, forget about my code and tell me!