You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
385 B
25 lines
385 B
#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);
|
|
}
|