这只是一部分,待所有部分完成后,再整合到main()函数中去:
#define ViewLeft 20
#define ViewRigeht 520
#define ViewTop 15
#define ViewBotton 464
#define DateViewX ViewRigeht
#define DateViewY ViewTop+40
#define DateH 40
void Loading()
{
int i,j,l;
Interface();
setfillstyle(1,0);
bar(200,110,400,230);
settextstyle(0,0,1);
outtextxy(250,207,"Loading");
for(l=0;l<6;l++)
{
setcolor(15);
rectangle(237+l*15,225,244+l*15,235);
}
l=0;
j=1;
while(j!=480-j)
{
j++;
if(j%40==0)
{
setfillstyle(1,RED);
bar(237+l*15,225,244+l*15,235);
l++;
}
setfillstyle(1,0);
bar(0,0,getmaxx(),j);
bar(0,480,getmaxx(),480-j);
delay(1000);
}
delay(60000);
clearviewport();
}
void PlayViewPort()
{
int i;
cleardevice();
setcolor(CYAN);
for(i=0;i<3;i++)
rectangle(ViewLeft-10-i,ViewTop-10-i,ViewRigeht+110+i,ViewBotton+10+i);
/*利用循环画矩形外框,目的是为了让外框显示有厚度*/
rectangle(ViewLeft,ViewTop,ViewRigeht+100,ViewBotton);
/*画内框,与外框相差10像素*/
setfillstyle(XHATCH_FILL,YELLOW);/*设置填充样式和颜色*/
floodfill(ViewLeft-1,ViewTop-1,CYAN);
setcolor(WHITE);
for(i=0;i<3;i++)
rectangle(ViewLeft-i,ViewTop-i,ViewRigeht+100+i,ViewBotton+i);
/*用和填充外框厚度的方法填充内框的厚度*/
line(ViewRigeht,ViewTop,ViewRigeht,ViewBotton);
/*用直线吧视图区和数据区分开*/
settextstyle(0,0,0);
/*对数据区各个区域的内容进行描述*/
rectangle(DateViewX,DateViewY,DateViewX+100,DateViewY+DateH );
rectangle(DateViewX,DateViewY+DateH ,DateViewX+100,DateViewY+2*DateH );
rectangle(DateViewX,DateViewX+2*DateH ,DateViewX+100,DateViewY+3*DateH );
outtextxy(DateViewX+10,DateViewY+10,"Hit");
outtextxy(DateViewX+10,DateViewY+DateH +10,"Lose");
outtextxy(DateViewX+10,DateViewY+DateH *2+10,"PreKey");
}