签到

05月07日
尚未签到

共有回帖数 0

    做月子

    等级:
    #includegraphics.h
    #includedos.h
    #includestdio.h
    #includebios.h
    #includestdlib.h

    #define UP       0x4800
    #define DOWN     0x5000
    #define LEFT     0x4b00
    #define RIGHT    0x4d00
    #define ALT_X    0x2d00

    void *sha();
    void *xia();
    void *zuo();
    void *you();

    main()
    {
       int key,gd=DETECT,gm,pd;
       int z=0,y=0,s=0,x=0,z1=0,y1=0,x1=0,s1=0,zb,sb,xb,yb;
       int size;
       int sd=10;  /*落下的速度越大约快*/
       void *buffer,*zuo1,*you1,*sha1,*xia1;
       initgraph(&gd,&gm,"");
       setfillstyle(1,15);
       bar(380,20,620,460);
       setfillstyle(1,1);
       zuo1=zuo();
       you1=you();
       xia1=xia();
       sha1=sha();
       cleardevice();

       do
       {
       outtextxy(100,240,"ALT_X quit!");
       delay(1000000);
       cleardevice();
       setpalette(0,4);
       setfillstyle(1,15);
       bar(380,20,620,460);
       setcolor(3);
       line(440,20,440,460);    /*竖线三条*/
       line(500,20,500,460);
       line(560,20,560,460);
       line(380,380,620,380);  /*横线*/
       line(380,420,620,420);
       putimage(385,430,zuo1,0);
       putimage(450,430,sha1,0);
       putimage(510,435,xia1,0);
       putimage(570,430,you1,0);

       if(z380)z=0,z1=0;
       if(s380)s=0,s1=0;
       if(x380)x=0,x1=0;
       if(y380)y=0,y1=0;

       if(z340&&z380)zb=1;else zb=0;
       if(s340&&s380)sb=1;else sb=0;
       if(x340&&x380)xb=1;else xb=0;
       if(y340&&y380)yb=1;else yb=0;

       randomize();

       if(z1==0)z1=random(2);
       if(x1==0)x1=random(2);
       if(s1==0)s1=random(2);
       if(y1==0)y1=random(2);


       if(z1==1)
       {
       z+=sd;
       putimage(385,z,zuo1,0);
       }
       if(s1==1)
       {
       s+=sd;
       putimage(450,s,sha1,0);
       }
       if(x1==1)
       {
       x+=sd;
       putimage(510,x,xia1,0);
       }
       if(y1==1)
       {
       y+=sd;
       putimage(570,y,you1,0);
       }

       if(kbhit()!=0)
       {
       key=bioskey(0);
       }
       if(key==ALT_X)exit(0);
       if(key==LEFT)pd=1;
       if(key==UP)pd=2;
       if(key==DOWN)pd=3;
       if(key==RIGHT)pd=4;

       setfillstyle(1,3);
       switch(pd)
       {
           case 1:
           bar(380,420,440,460);
           if(zb==1)z1=0,z=0;
           break;
           case 2:
           bar(440,420,500,460);
           if(sb==1)s1=0,s=0;
           break;
           case 3:
           bar(500,420,560,460);
           if(xb==1)x1=0,x=0;
           break;
           case 4:
           bar(560,420,620,460);
           if(yb==1)y1=0,y=0;
           break;
       }
       }while(1);
    }

    void *zuo()
    {
       int s[]={382,42,402,30,402,35,429,35,429,45,402,45,402,50};
       int size;
       int *zuo;
       fillpoly(7,s);
       size=imagesize(381,29,430,51);
       zuo=malloc(size);
       getimage(381,29,430,51,zuo);
       return zuo;
    }

    void *sha()
    {
       int a[]={470,32,450,42,460,42,460,55,480,55,480,42,490,42};
       int size;
       int *sha;
       fillpoly(7,a);
       size=imagesize(449,30,491,51);
       sha=malloc(size);
       getimage(449,30,491,51,sha);
       return sha;
    }

    void *xia()
    {
       int z[]={517,32,517,42,507,42,527,52,547,42,537,42,537,32};
       int size;
       int *xia;
       fillpoly(7,z);
       size=imagesize(510,30,550,51);
       xia=malloc(size);
       getimage(508,30,547,51,xia);
       return xia;
    }

    void *you()
    {
       int o[]={562,37,562,47,587,47,587,52,607,42,587,32,587,37};
       int size;
       int *you;
       fillpoly(7,o);
       size=imagesize(560,30,610,55);
       you=malloc(size);
       getimage(560,30,610,55,you);
       return you;
    }

    楼主 2016-02-04 13:59 回复

共有回帖数 0
  • 回 帖
  • 表情 图片 视频
  • 发表

登录直线网账号

Copyright © 2010~2015 直线网 版权所有,All Rights Reserved.沪ICP备10039589号 意见反馈 | 关于直线 | 版权声明 | 会员须知