diff --git a/Player.cpp b/Player.cpp new file mode 100644 index 0000000..f4db714 --- /dev/null +++ b/Player.cpp @@ -0,0 +1,24 @@ +#include "Player.h" + +void Player::init(Chess* chess) +{ + this->chess = chess; +} + +void Player::go() +{ + MOUSEMSG msg; + ChessPos pos; + while (1) + { + //获取鼠标点击信息 + msg = GetMouseMsg(); + + //判断落子是否有效,以及实现落子 + if (msg.uMsg == WM_LBUTTONDOWN && chess->clickBoard(msg.x, msg.y, &pos)) + break; + } + + //落子 + chess->ChessMove(&pos, CHESS_BLACK); +}