论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > C语言程序设计教程
Tag:新手,函数,指针,数据类型,对象,Turbo,入门,运算符,数组,结构,二级,,tc,游戏,试题,问答,编译,视频教程

游戏封面欣赏

文章类别:C语言程序设计 | 发表日期:2008-9-24 14:43:54

这是我位我自己的俄罗斯方块程序设计的一个游戏开始封面~~

我觉得还可以啦~~所以让大家来欣赏欣赏~~可以直接运行~~~

#include <graphics.h>
#include <stdlib.h>
#define SIZE 16
unsigned char zimo[23][32]=   /*封面中文字的字模*/{{0x8,0x20,0x9,0xa8,0xf,0x24,0x11,0x20,0x11,0x24,0x3f,0xfe,0x51,0x20,0x91,0x20,0x11,0xa4,0x13,0x18,0x1d,0x10,0x11,0x30,0x11,0x48,0x11,0xa,0x15,0x6,0x12,0x2}
,{0x0,0x4,0x7f,0xfe,0x44,0x44,0x44,0x44,0x44,0x44,0x7f,0xfc,0x42,0x4,0x2,0x0,0x7,0xf0,0x8,0x10,0x14,0x20,0x62,0xc0,0x1,0x0,0x6,0x0,0x18,0x0,0xe0,0x0}
,{0x22,0x8,0x22,0x1c,0x7f,0x60,0x22,0x40,0x22,0x40,0x3e,0x40,0x22,0x7e,0x22,0x48,0x3e,0x48,0x22,0x48,0x22,0x48,0xff,0x48,0x0,0x88,0x14,0x88,0x23,0x8,0x42,0x8}
,{0x4,0x0,0x3,0x0,0x1,0x0,0x0,0x4,0xff,0xfe,0x4,0x0,0x4,0x10,0x7,0xf8,0x4,0x10,0x4,0x10,0x4,0x10,0x8,0x10,0x8,0x10,0x10,0x10,0x20,0xa0,0x40,0x40}
,{0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x88,0x13,0xfc,0xfc,0x88,0x10,0x88,0x10,0x88,0x10,0x88,0x17,0xfe,0x10,0x80,0x1d,0x40,0xf1,0x20,0x42,0x10,0x4,0xe,0x8,0x4}
,{0x9,0x0,0x9,0x0,0x9,0x4,0x11,0xfe,0x12,0x80,0x32,0x80,0x54,0x90,0x98,0xf8,0x10,0x80,0x10,0x80,0x10,0x88,0x10,0xfc,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80}
,{0x2,0x0,0x2,0x10,0x3f,0xe0,0x2,0x20,0x2,0x44,0xff,0xfe,0x1,0x0,0x2,0x0,0xf,0xf0,0x18,0x10,0x28,0x10,0x4f,0xf0,0x88,0x10,0x8,0x10,0xf,0xf0,0x8,0x10}
,{0x0,0x8,0x7f,0xfc,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x10,0x3f,0xf8,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x4,0xff,0xfe,0x0,0x0}
,{0x2,0x0,0x2,0x10,0x3f,0xe0,0x2,0x20,0x2,0x44,0xff,0xfe,0x1,0x0,0x2,0x0,0xf,0xf0,0x18,0x10,0x28,0x10,0x4f,0xf0,0x88,0x10,0x8,0x10,0xf,0xf0,0x8,0x10}
,{0x0,0x0,0x7c,0x88,0x44,0x48,0x54,0x50,0x55,0xfc,0x55,0x24,0x55,0xac,0x55,0x24,0x55,0xfc,0x54,0x0,0x54,0xf8,0x54,0x88,0x20,0xf8,0x28,0x88,0x44,0xf8,0x80,0x88}
,{0x2,0x8,0x41,0x10,0x30,0xa0,0x17,0xfc,0x0,0x40,0x0,0x40,0xf0,0x44,0x17,0xfe,0x10,0x40,0x10,0x40,0x10,0x80,0x10,0xa0,0x11,0x18,0x2a,0x8,0x44,0x0,0x3,0xfe}
,{0x0,0x4,0x7f,0xfe,0x40,0x4,0x42,0xc,0x62,0x8c,0x54,0x54,0x54,0x54,0x48,0x24,0x48,0x24,0x54,0x54,0x52,0x4c,0x62,0x8c,0x61,0x4,0x42,0x4,0x40,0x14,0x40,0x8}
,{0x4,0x0,0x4,0x0,0x4,0x4,0xff,0xfe,0x4,0x0,0x4,0x0,0xf,0xf0,0x8,0x10,0x14,0x20,0x12,0x20,0x21,0x40,0x40,0x80,0x81,0x40,0x6,0x30,0x18,0xe,0x60,0x4}
,{0x8,0x20,0x8,0x24,0xff,0xfe,0x8,0x20,0x4,0x80,0x24,0xfc,0x25,0x0,0x26,0x40,0x24,0x20,0x4,0x20,0x3f,0xf8,0x24,0x48,0x24,0x48,0x24,0x48,0xff,0xfe,0x0,0x0}
,{0x0,0x40,0x40,0x48,0x27,0xfc,0x20,0x40,0x3,0xf8,0xe0,0x40,0x2f,0xfe,0x20,0x0,0x23,0xf8,0x22,0x8,0x23,0xf8,0x22,0x8,0x2b,0xf8,0x32,0x8,0x22,0x28,0x2,0x10}
,{0x10,0x40,0x10,0x20,0x10,0x0,0x13,0xfe,0xfa,0x2,0x14,0x44,0x10,0x40,0x1b,0xfe,0x30,0x88,0xd0,0x88,0x11,0x10,0x10,0x90,0x10,0x60,0x10,0x50,0x50,0x8c,0x23,0x4}
,{0x8,0x0,0x8,0x18,0xb,0xe0,0x10,0x40,0x10,0x40,0x30,0x40,0x50,0x44,0x9f,0xfe,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x48,0x17,0xfc,0x10,0x0,0x10,0x0}
,{0x1,0x0,0x3f,0xf8,0x8,0x20,0x4,0x44,0xff,0xfe,0x0,0x0,0x1f,0xf0,0x10,0x10,0x1f,0xf0,0x10,0x10,0x1f,0xf0,0x2,0x0,0x51,0x84,0x50,0x92,0x90,0x12,0xf,0xf0}
,{0x20,0x10,0x27,0x10,0x39,0x7c,0x41,0x14,0x82,0xfe,0x7a,0x14,0x24,0x7c,0x27,0x10,0xf9,0x7c,0x21,0x10,0x25,0x10,0x22,0xfe,0x2a,0x10,0x35,0x10,0x28,0x90,0x0,0x7e}
,{0x2,0x20,0x42,0x20,0x22,0x20,0x2f,0xfc,0x2,0x20,0x2,0x20,0xe2,0x20,0x22,0x24,0x2f,0xfe,0x22,0x20,0x22,0x20,0x22,0x20,0x24,0x20,0x50,0x20,0x8f,0xfe,0x0,0x0}
,{0x4,0x0,0x2,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x2,0x80,0x2,0x80,0x2,0x80,0x4,0x40,0x4,0x40,0x8,0x20,0x8,0x20,0x10,0x10,0x20,0x10,0x40,0xe,0x80,0x4}
,{0x2,0x10,0x41,0x10,0x20,0x1e,0x2f,0xe0,0x82,0x40,0x62,0x3e,0x23,0x84,0xa,0x88,0x12,0x88,0x22,0xfe,0xe2,0x88,0x24,0x88,0x24,0x88,0x28,0x88,0x31,0xa8,0x20,0x10}
,{0x0,0x40,0x0,0x50,0x7e,0x48,0x2,0x40,0x43,0xfe,0x24,0x40,0x14,0x44,0x14,0x44,0x8,0x48,0x14,0x48,0x12,0x50,0x22,0x20,0x40,0x60,0x80,0x92,0x1,0xa,0x2,0x6}};
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[]={4,0,5,2,8,2,6,4,7,7,4,5,1,7,2,4,0,2,3,2,4,0},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[]={0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1};
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);
}




视频教程列表
文章教程搜索
 
C语言程序设计推荐教程
C语言程序设计热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058