void CGameDlg::OnDown() { }
void CGameDlg::OnLeft() { }
void CGameDlg::OnRight() { }
void CGameDlg::OnUp() { }
void CGameDlg::MoveOn(int n) {
// TODO: Add your message handler code here and/or call default CDC *pDC=GetDC(); ASSERT(pDC!=NULL);
DeleteGroup(object);int b_x=object.x,b_y=object.y; switch(n) {
- -
15
if(!Runing)
return;
MoveOn(3);
ObjectGroup(object); KillTimer(11);
SetTimer(11, 10, NULL);
if(!Runing)
return;
MoveOn(4);
if(!Runing)
return;
MoveOn(2);
if(!Runing)
return;
MoveOn(1);
}
void CGameDlg::ClearUp() {
CDC *pDC=GetDC(); ASSERT(pDC!=NULL);
COLORREF color=RGB(233,230,214); CPen pen;
- -
16
case 1:
ChangeShape(object); ObjectGroup(object); break;
case 2:
object.x = object.x < M-1 ? object.x+1 : M-1; if(check1())
object.x=b_x;
ObjectGroup(object); break;
case 3:
object.y=object.y case 4: object.x=object.x>1?object.x-1:0; if(check1())object.x=b_x; ObjectGroup(object); break; case 5: } Show(object); ReleaseDC(pDC); object.y=object.y>1?object.y-1:0; if(check2())object.y=b_y; ObjectGroup(object); break; //清空预备显示 地方 } CBrush brush; pen.CreatePen(PS_SOLID,1,color); brush.CreateSolidBrush (color); pDC->SelectObject(pen); pDC->SelectObject(brush); pDC->Rectangle(J_x,J_y,J_x+118,J_y+155); DeleteObject(brush); DeleteObject(pen); ReleaseDC(pDC); (5)收埋功能模块 此模块用来收藏游戏界面。 实现此功能相关代码如下: void CGameDlg::OnTimer(UINT nIDEvent) //处理往下运动过程 { //===========================2往右收埋 if(nIDEvent==2) { } if(nIDEvent==6) { - - MoveWindow(p1.x,p1.y,m_W,m_H); p1.x+=10; if(p1.x>desktopRect.Width()) { } KillTimer(2); Set=2; Si.left=LW-T; Si.top=Sj.top; Si.right=LW; Si.bottom=Sj.bottom; 17 MoveWindow(p1.x,p1.y,m_W,m_H); p1.x-=10; if(p1.x<=pp.x) KillTimer(6); } //=============================3 if(nIDEvent==3) { } if(nIDEvent==7) { } //=========================1 if(nIDEvent==1) { MoveWindow(p1.x,p1.y,m_W,m_H); p1.y-=10; if(p1.y+m_H+10<0) { - - 18 往上收埋 MoveWindow(p1.x,p1.y,m_W,m_H); p1.y+=10; if(p1.y>desktopRect.Height()) { } KillTimer(3); Set=3; Si.left=Sj.left; Si.top=LH-T; Si.right=Sj.right; Si.bottom=LH; MoveWindow(p1.x,p1.y,m_W,m_H); p1.y-=10; if(p1.y<=pp.y) KillTimer(7); 往下收埋