c++ win32 API实现方块联机游戏历程
作者 佚名技术
来源 程序设计
浏览
发布时间 2012-06-29
VS % d",Game_Point,Child_Point); unsigned short int count=0,i=0; while(szChar[i] != ''\0'') { count++; i++; } TextOut(hDC,NEXT_L+20,NEXT_T+185,szChar,count); } void Gameframe::Draw_Frame(HDC hDC,HWND hwnd,HBRUSH G_brush)//主游戏框架+内容 { SetDCBrushColor(hDC,RGB(0,0,0)); FillRect(hDC,&F,G_brush); for(unsigned short int o=0;o<10;o++) { for(unsigned short int p=0;p<20;p++) { if(1==Gframe[o][p]) { SetDCBrushColor (hDC,G_BasicColor[Gframe_Color[o][p]]); SetRect (&re,FRAME_L+o*30+1,FRAME_T+p*30+1,FRAME_L+o*30+29,FRAME_T+p*30+29) ; FillRect (hDC,&re,G_brush); } } } if(G_Over) { if(G_Level>9) { G_Level=1; TextOut (hDC,FRAME_L+100,FRAME_T+270,"通关了!厉害",strlen(" ")); } else { if(!Arrive) { TextOut (hDC,FRAME_L+100,FRAME_T+270,"GAME OVER",strlen("GAME OVER")); } else { TextOut (hDC,FRAME_L+100,FRAME_T+270,"YOU''RE WINNER",strlen ("YOU''RE WINNER")); } } } } void Gameframe::Draw_Message(HDC hDC,HWND hwnd,HBRUSH G_brush) { SetDCBrushColor(hDC,RGB(255,255,255)); SetTextColor(hDC,RGB(0,0,0)); FillRect(hDC,&Info,G_brush); DrawText(hDC,InfoChar,strlen (InfoChar),&Info,DT_LEFT); } void Gameframe::Draw_Child(HDC hDC,HWND hwnd,HBRUSH G_brush) { SetDCBrushColor(hDC,RGB(0,0,0)); SetRect(&re,0,0,200,400); FillRect(hDC,&re,G_brush); for(unsigned short int o=0;o<10;o++) { for(unsigned short int p=0;p<20;p++) { if(0!=Child_Frame[o][p]) { SetDCBrushColor (hDC,G_BasicColor[Child_Frame[o][p]-1]); SetRect (&re,o*20+1,p*20+1,o*20+19,p*20+19); FillRect (hDC,&re,G_brush); } } } } Gameframe::Gameframe() { //主游戏框初始化 SetRect (&F,FRAME_L,FRAME_T,MAIN_SIZE_R,MAIN_SIZE_B); SetRect (&N,NEXT_L,NEXT_T,NEXT_SIZE_R,NEXT_SIZE_B); //下一个框 SetRect (&Total,NEXT_L,NEXT_T+170,NEXT_SIZE_R,NEXT_SIZE_B+80); //得分框 SetRect (&Info,NEXT_SIZE_R+FRAME_L+FRAME_L,FRAME_T+400+20,NEXT_SIZE_R+FRAME _L+FRAME_L+200,FRAME_T+400+20+100); //消息框 G_BasicColor[0] = RGB(220, 39, 75); // 红 G_BasicColor[1] = RGB(232, 123, 20 |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: C++编程杂谈之二:面向对象下一篇: 禁用设备
关于c++ win32 API实现方块联机游戏历程的所有评论