1. 首页
  2. 编程语言
  3. C++ 
  4. MFC实现五子棋二人对弈

MFC实现五子棋二人对弈

上传者: 2018-12-07 07:16:07上传 ZIP文件 522.13KB 热度 40次
void CWzqView::vDrawPiece(CPoint pointBoard, int nType, CDC* pDC) { CRgn rgnPiece; CPoint pointView = ptConvertBP2VP(pointBoard); rgnPiece.CreateEllipticRgn( pointView.x - WIDTH_Piece, pointView.y - WIDTH_Piece, pointView.x + WIDTH_Piece, pointView.y + WIDTH_Piece); int pos_x,pos_y; pos_x = pointBoard.x; pos_y = pointBoard.y; CBrush brush; if (map[pos_x][pos_y]!=0) return ; if (nextColor == 1){ // next is black brush.CreateSolidBrush(COLOR_PieceBlack); map[pos_x][pos_y] = 1; nextColor = 2; if (szylover(map,pos_x,pos_y) == 1){ MessageBox("Black win!"); exit(0); } }else{ brush.CreateSolidBrush(COLOR_PieceSZY); map[pos_x][pos_y] = 2; nextColor = 1; if (szylover(map,pos_x,pos_y) == 1){ MessageBox("red win"); exit(0); } } pDC->FillRgn(&rgnPiece, &brush); rgnPiece.DeleteObject(); } // CWzqView::vDrawPiece
用户评论