ROLLING.CPP
上传用户:wszmarenbt
上传日期:2013-04-26
资源大小:2552k
文件大小:1k
源码类别:

Windows编程

开发平台:

Visual C++

  1. /*----------------------------ANIMATION-----------------------------*/
  2. /*     NAME:ROLLING    */
  3. /*----------------------------ANIMATION-----------------------------*/
  4. #include<graphics.h>
  5. #include<dos.h>
  6. #include<alloc.h>
  7. #include<stdlib.h>
  8. #include<conio.h>
  9. void main()
  10. {
  11. int driver=DETECT,mode;
  12. int  X=10,Y=190-1,R=10,NUM;
  13. unsigned int SIZE;
  14. char /*far*/ *BUFFER;
  15. registerbgidriver(EGAVGA_driver);
  16. initgraph(&driver,&mode,"");
  17. SIZE=imagesize(0,169,20,189);              /*GET TTHE SIZE OF THE CIRCLE*/
  18. BUFFER=(char far *)malloc(SIZE);           /*REMEMBER THE LOCATION OF THE CIRCLE DATA*/
  19. line(0,200,640,200);
  20. setcolor(11);
  21. circle(X,Y,R);
  22. setfillstyle(1,11);
  23. floodfill(X,Y,11);
  24. getimage(0,179,20,199,BUFFER);             /*STORE THE DATA OF THE CIRCLE*/
  25. for(NUM=0;NUM<32;NUM++)
  26. {
  27. putimage(X-10,Y-10,BUFFER,XOR_PUT);    /*DELETE THE CIRCLE*/
  28. X+=20;
  29. putimage(X-10,Y-10,BUFFER,COPY_PUT);   /*DRAW THE CIRCLE*/
  30. delay(50);
  31. }
  32. getch();      /*PRESS ANY KEY TO RETURN TO TEXT MODE*/
  33. closegraph();
  34. }