在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 用鏈表實現(xiàn)的屏幕飄雪程序

            用鏈表實現(xiàn)的屏幕飄雪程序

            作者: 時間:2016-12-01 來源:網(wǎng)絡(luò) 收藏
            #include
            #include
            #include
            #define D 1 //雪花下降速度
            COLORREF snowcolor=0x2711EE; //雪花顏色
            COLORREF snowcolor1=0x0000FF; //積雪顏色
            int FENG; //風(fēng)向風(fēng)速值
            int MINX; //屏幕X坐標(biāo)最大值
            int MINY; //屏幕Y坐標(biāo)最大值
            ////////////////////////////////////////////////////////////////////////////////
            //獲取屏幕分辨率
            int getXY(int *MINX,int *MINY)
            {
            HDC hdc=GetDC(NULL);
            int t=1;
            int x=600;
            int y=600;
            for(;t;)
            {
            if(GetPixel(hdc,x,100)==CLR_INVALID) t=0;
            x++;
            }
            t=1;
            for(;t;)
            {
            if(GetPixel(hdc,100,y)==CLR_INVALID) t=0;
            y++;
            }
            *MINX=x;
            *MINY=y;
            ReleaseDC(NULL, hdc);
            return 0;
            }
            //雪花點屬性結(jié)構(gòu)體
            struct xue {
            int x; //雪花的當(dāng)前坐標(biāo)點
            int y;
            COLORREF oldcolor; //當(dāng)前雪花點的原始顏色值
            int del; //是否刪除該節(jié)點標(biāo)志值不等于0則刪除此節(jié)點
            int nextx; //將要移動到的坐標(biāo)點
            int nexty;
            int shudu; //下降速度
            };
            //雪花布局鏈表標(biāo)準(zhǔn)節(jié)點
            struct xhbiao { //此結(jié)構(gòu)體用于創(chuàng)建雪花的布局鏈表
            struct xue xh;
            struct xhbiao *next; //后繼
            struct xhbiao *quet; //前驅(qū)
            };
            //初始化單點雪花
            int huaxue (struct xue *xuehua) //函數(shù)功能是初始化一個新的雪花點
            {
            HDC hdc=GetDC(NULL);
            xuehua->y=0;
            xuehua->x=(int)(rand()%MINX);
            xuehua->oldcolor=GetPixel(hdc,xuehua->x,xuehua->y);
            xuehua->shudu=(int)((rand()%10)*D+1);
            xuehua->del=0;
            ReleaseDC(NULL,hdc);
            return 0;
            }
            //創(chuàng)建鏈表
            int link(struct xhbiao **tou,struct xhbiao **wei)
            {
            struct xhbiao *p;
            p=(struct xhbiao*)malloc(sizeof(struct xhbiao));
            huaxue(&p->xh);
            p->next=NULL;
            p->quet=NULL;
            (*tou)=p;
            (*wei)=p;
            return 0;
            }
            //插入節(jié)點
            int linkCHA(struct xhbiao **tou,struct xhbiao **wei)
            {
            if((*tou)!=NULL)
            {
            struct xhbiao *p;
            p=(struct xhbiao*)malloc(sizeof(struct xhbiao));
            huaxue(&p->xh);
            p->next=NULL;
            p->quet=(*wei);
            (*wei)->next=p;
            (*wei)=p;
            }
            return 0;
            }
            //刪除節(jié)點
            int linkDEL(struct xhbiao *del)
            {
            del->quet->next=del->next;
            del->next->quet=del->quet;
            free(del);
            return 0;
            }
            //維護雪堆鏈表清除需要刪除的雪粒節(jié)點
            int linkWUI(struct xhbiao **tou,struct xhbiao **wei)
            {
            struct xhbiao *p;
            p=(*tou);
            for(;p!=NULL;)
            {

            if(p->xh.del!=0)
            {
            if(p==(*tou))
            {
            (*tou)=p->next;
            p->next->quet=NULL;
            free(p);
            }else if(p==(*wei))
            {
            (*wei)=p->quet;
            p->quet->next=NULL;
            free(p);
            }else {
            linkDEL(p);
            }
            }
            p=p->next;
            }
            return 0;
            }
            //物理信息處理

            上一頁 1 2 下一頁

            關(guān)鍵詞: 鏈表幕飄雪程

            評論


            技術(shù)專區(qū)

            關(guān)閉