回 帖 发 新 帖 刷新版面

主题:一个比较古怪的清屏

#include "graphics.h"
#include "stdlib.h"
#include "stdio.h"
/* This c program is copyright by PingYuan Colege computer Mr.Li Fuke */

/* Please type this chars
   void clslltp(int x1, int y1, int x2, int y2, int color1, int color2, int color3)
   int x1 , y1   .... this cls star of x1 , y1
   int x2 , y2   .... this cls end  of x2 , y2
   int color1    .... this cls first color
   int color2    .... this cls sened color
   int color3    .... this cls terea color

   THANK YOU FOR USE THIS PROGRAM !!!
Mr.Li
   97.3.31            */



void clslltp(int x1, int y1, int x2, int y2, int color1, int color2, int color3)
{
int x,y,i,j;
int maxline,minline,thistime;
x=(x1+x2)/2-((x1+x2)%2)/2;i=x+1;
y=(y1+y2)/2-((y1+y2)%2)/2;j=y+1;
minline=(y2-y1)/2;
maxline=(x2-x1)/2;


for(thistime=0;thistime<=500;thistime++)
{
delay(500);
/** the first windows **/
if(thistime<=maxline)
{
setcolor(color1);
if(thistime<=minline)
{
line(x,y,i,y);
line(i,y,i,j);
line(i,j,x,j);
line(x,j,x,y);
x--;y--;i++;j++;
}
if(thistime>minline)
   {
    line((x2-x1)/2+x1-thistime,y1,(x2-x1)/2+x1-thistime,y2);
    line((x2-x1)/2+x1+thistime,y1,(x2-x1)/2+x1+thistime,y2);
     }
  }/* end the first windows */



  /**  the sened windows **/
if(thistime<=(maxline*4/3)&thistime>(maxline/3))
{
  setcolor(color2);
  if((thistime-maxline/3)<=minline)
{
line(x,y,i,y);
line(i,y,i,j);
line(i,j,x,j);
line(x,j,x,y);
x--;y--;i++;j++;
}
if((thistime-maxline/3)>minline)
   {
    line((x2-x1)/2+x1-(thistime-maxline/3),y1,(x2-x1)/2+x1-(thistime-maxline/3),y2);
    line((x2-x1)/2+x1+(thistime-maxline/3),y1,(x2-x1)/2+x1+(thistime-maxline/3),y2);
     }
  }/* end the sened windows */



}

}



main()
{
int a=VGA;
int b=2;
registerbgidriver(EGAVGA_driver);
initgraph(&a,&b,"");
setfillstyle(1,7);
bar(0,0,639,479);
clslltp(0,0,639,479,12,3,5);
getch();
}  

回复列表 (共1个回复)

沙发

一个有趣的清屏
void clrscr(void)
{
    printf("\033[2J");                         /* Clear the entire screen */
    printf("\033[0;0f");                        /* Move cursor to the top left hand corner */
    fflush(stdout);                            /* flush the std_out stream */
}

我来回复

您尚未登录,请登录后再回复。点此登录或注册