这是我位我自己的俄罗斯方块程序设计的一个游戏开始封面~~
我觉得还可以啦~~所以让大家来欣赏欣赏~~可以直接运行~~~
#include <graphics.h>
#include <stdlib.h>
#define SIZE 16
unsigned char zimo[23][32]= /*封面中文字的字模*/
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,};
main()
{
int driver=DETECT,mode,i,x,y,banjin=SIZE,aaa=0,bbb=-1;
registerbgidriver(EGAVGA_driver);
initgraph(&driver,&mode,"");
randomize();
setcolor(GREEN);
biankuang(0);
biankuang(6);
setbkcolor(BLUE);
setcolor(BLUE);
setpalette(YELLOW,YELLOW);
pingbi(zimo[0],80,110);
pingbi(zimo[1],240,110);
pingbi(zimo[2],400,110);
pingbi(zimo[3],160,240);
pingbi(zimo[4],320,240);
for(i=0;i<2;i++)
{ xiezi(zimo[i+5],100+20*i,580);
xiezi(zimo[i+7],150+20*i,580);}
for(i=0;i<9;i++)
xiezi(zimo[i+14],100+20*i,10);
setpalette(DARKGRAY,BLACK);
setbkcolor(DARKGRAY);
while(1)
{ if(kbhit())goto label;
if(aaa==0)
{while(1){
x=random(600)+16;
y=random(440)+16;
if(!(y>=70&&y<=410))break;
}}
for(i=0;i<=SIZE;i++)
{ bbb++;
bbb=bbb%64;
setpalette(BLUE,63-bbb);
setpalette(YELLOW,bbb);
if(aaa==0)
{pingpu(x,y,banjin);
setcolor(WHITE);
setfillstyle(SOLID_FILL,WHITE);
arc((x+SIZE)-(SIZE-i),(y-SIZE)+(SIZE-i),180,270,banjin-(SIZE-i));
arc((x-SIZE)+(SIZE-i),(y-SIZE)+(SIZE-i),270,360,banjin-(SIZE-i));
arc((x-SIZE)+(SIZE-i),(y+SIZE)-(SIZE-i),0,90,banjin-(SIZE-i));
arc((x+SIZE)-(SIZE-i),(y+SIZE)-(SIZE-i),90,180,banjin-(SIZE-i));
floodfill(x,y,WHITE);
delay(500);if(i==SIZE)aaa=1;}
if(aaa==1)
{pingpu(x,y,banjin);
setcolor(WHITE);
setfillstyle(SOLID_FILL,WHITE);
arc((x+SIZE)-i,(y-SIZE)+i,180,270,banjin-i);
arc((x-SIZE)+i,(y-SIZE)+i,270,360,banjin-i);
arc((x-SIZE)+i,(y+SIZE)-i,0,90,banjin-i);
arc((x+SIZE)-i,(y+SIZE)-i,90,180,banjin-i);
floodfill(x,y,WHITE);
delay(500);if(i==SIZE)aaa=0;}
}}
label:
setpalette(BLUE,BLUE);
setpalette(YELLOW,YELLOW);
closegraph();
}
xingxing(int x,int y) /*根据坐标花五角星*/
{
int a[]=,i;
for(i=0;i<22;i++)
{ a[i]=a[i];
if(i%2==0)a[i]=a[i]+x;
else a[i]=a[i]+y;
}
drawpoly(11,a);
setfillstyle(SOLID_FILL,YELLOW);
floodfill(a[0],a[1]+4,BLUE);
}
unsigned char a[]=;
pingbi(unsigned char *ch,int x,int y) /*根据字模在指定的坐标画出由星星所组成的文字*/
{
int i,j,n=-1;
for(i=0;i<32;i++)
{ if(i%2==0)n++;
if(i%2==0)
{ for(j=0;j<8;j++)
if(ch[i]&a[j])
xingxing(j*9+x,y+n*8); }
else
{ for(j=8;j<16;j++)
if(ch[i]&a[j-8])
xingxing(j*9+x,y+n*8);}
}
}
biankuang(int x)
{
setcolor(WHITE);
rectangle(70-x,100-x,570+x,380+x);
rectangle(72-x,102-x,568+x,378+x);
setcolor(LIGHTGREEN);
line(70-x,100-x,570+x,100-x);
line(70-x,100-x,70-x,380+x);
line(568+x,102-x,568+x,378+x);
line(568+x,378+x,72-x,378+x);
}
xiezi(unsigned char *ch,int x,int y)/*根据字模在指定的坐标上写字*/
{
int i,j;
for(i=0;i<32;i++)
{ if(i%2==0){
for(j=0;j<8;j++)
if(ch[i]&a[j])
putpixel(y+j,x+i/2,LIGHTRED);
}
else{
for(j=8;j<16;j++)
if(ch[i]&a[j-8])
putpixel(y+j,x+i/2,LIGHTRED);}
}
}
pingpu(int x,int y,int banjin) /*把显示出来的部分画面,用背景色填充*/
{
setcolor(DARKGRAY);
setfillstyle(SOLID_FILL,DARKGRAY);
bar(x-banjin,y-banjin,x+banjin,y+banjin);
}