图形函数问题,好像通过COPY_PUT后,原来的图形还在,怎么处理?
我原来是准备做一个简单的动画(建设初期),可是,在运行这个半成品的时候,去发现原来的那个图形在putimage之后还是存在?不知道为什么,我也看过很一些源代码,却没有这个问题。
帮忙解决一下,问题部分我在后面附注了:
源代码如下:
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <string.h>
#include <dos.h>
main()
{ int gdriver,gmode,ierror;
char str1[100],str2[100],str3[100];
strcpy(str1,"The Route of The Emanant Missile");
strcpy(str2,"Please press any key to continue...");
strcpy(str3,"Press any key to Exit...");
gdriver=VGA;
gmode=2;
initgraph(&gdriver,&gmode,"");
ierror=graphresult();
if(ierror!=0)
{printf("graphics error: %s\n",grapherrormsg(ierror));
printf("Please any key to halt.");
getch();
exit(1);
}
setbkcolor(0);
setbkcolor(1);
cleardevice();
setcolor(14);
setlinestyle(2,0,4);
rectangle(0,0,getmaxx(),479);
getch();
settextstyle(0,0,1);
outtextxy(0,15,str1);
setcolor(11);
line(0,29,639,29);
line(0,479-20,639,479-20);
settextstyle(0,0,0);
outtextxy(0,464,str2);
setviewport(0,29,639,469,0);
interface();
getch();
start();
getch();
closegraph();
}
interface()
{ rectangle(20,430-20,80,430);
rectangle(30,430-25,70,430-20);
line(20+25,430-25,20+34,430-51);
line(20+35,430-25,20+44,430-51);
line(20+34,430-51,20+44,430-51);
rectangle(500,430-20,540,430);
settextstyle(0,0,1);
setfillstyle(11,12);
floodfill(21,430-19,11);
floodfill(501,430-15,11);
outtextxy(80,420,"launch pad");
outtextxy(542,420,"enemy");
}
start()
{char *w;
int i;
setfillstyle(1,8);
pieslice(20+39+3,430-51-6,0,360,5);
w=malloc(imagesize(20+39+3-5,430-57-6,20+39+3+5,430-57-5));
getimage(57,430-62,67,430-52,w);
for(i=0;i<=400;i++)/*这里出问题了*/
{putimage(58+i,430-62,w,1);
}
}