|
From: Paul H. <dra...@ne...> - 2003-10-29 09:20:38
|
I've created a program in Dev-C++ and have no problem runing it! But =
when i try to run it from the .EXE file it seems to behave differently. =
The problem is I've created a function similar to 'cin.getline()' but =
for 'BGI' graphics, the function works fine when i run it in Dev-C++.=20
[code]
void bgi_getline(int x, int y, char get_string[70], int num)
{
for(int LOOP2=3D0; LOOP2<70; LOOP2++)
{
get_string[LOOP2]=3D0;
}
void *image;
bool special_key_press=3DFALSE;
char any_string[20];
int size_string_height=3Dtextheight(any_string);
image=3Dnew char[imagesize(x-3,y-2,getmaxx(),y+size_string_height+5)];
getimage(x-3,y-2,getmaxx(),y+size_string_height+5,image);
for(int LOOP=3D0; LOOP<num; LOOP++)
{
get_string[LOOP]=3Dgetch();
if(get_string[LOOP]=3D=3D0)
{
special_key_press=3DTRUE;
getch();
LOOP--;
}
else if((int)get_string[LOOP]=3D=3D13)
{
get_string[LOOP]=3D0;
return;
}
else if((int)get_string[LOOP]=3D=3D8)
{
if(LOOP=3D=3D0)
{
get_string[LOOP]=3D0;
LOOP--;
}
else
{
get_string[LOOP]=3D0;
putimage(x-3,y-2,image,COPY_PUT);
get_string[LOOP-1]=3D0;
LOOP=3DLOOP-2;
}
}
else if(!(((int)get_string[LOOP]>=3D97) && =
((int)get_string[LOOP]<=3D122)))
{
if(!(((int)get_string[LOOP]>=3D65) && ((int)get_string[LOOP]<=3D90)))
{
if((int)get_string[LOOP]!=3D32)
{
get_string[LOOP]=3D0;
LOOP--;
}
}
}
if(special_key_press=3D=3DFALSE)
{
outtextxy(x, y, get_string);
}
special_key_press=3DFALSE;
}
}
[end code]
When i run this in Dev-C++ it works fine but when i run the program from =
the .EXE file it has a problem with the delete feature in 'void =
bgi_getline(int, int, char, int)' As you can see in the code it gets =
the image of the background first with 'getimage()' then puts it back =
with 'putimage()' so you can see the new string. In the .EXE file it =
deletes but you can still see the old string there! For some weird =
reason it is not using the 'getimage()' and 'putimage()' functions =
properly!
If anyone can help me in any way that would be great! Thank You!
=
=20
Paul |