• 博客(0)
  • 资源 (1)

空空如也

MFC实现五子棋二人对弈

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

2014-12-31

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除