伊索的代表作有什么:在C程序编程中 如何使图形运动?

来源:百度文库 编辑:高考问答 时间:2024/05/03 10:38:35
建立一个圆 让它沿轨迹运动
可不可以让图象不要闪动太快,让他保持连续运动

其实就是用延时和从新画圆的过程啊
你可以先计算出圆心的轨迹
然后再延时,擦除原来的圆,在画

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>

int main(void)
{
int gdriver = DETECT, gmode, errorcode;
int midx, midy,a,b;
int radius = 100;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());
for(a=0,b=0;a<midx,b<midy;a++,b++)
{circle(a, b, radius);
cleardevice();
delay(500);
}
getch();
closegraph();
return 0;
}