MCPcopy Create free account
hub / github.com/XMuli/ChineseChess / isChecked

Method isChecked

ChessBoard.cpp:165–178  ·  view source on GitHub ↗

是否选中该枚棋子。pt为输入参数; row, col为输出参数

Source from the content-addressed store, hash-verified

163
164//是否选中该枚棋子。pt为输入参数; row, col为输出参数
165bool ChessBoard::isChecked(QPointF pt, int &row, int &col)
166{
167 for (row = 0; row <= 9; row++) {
168 for (col = 0; col <= 8; col++) {
169 QPointF temp = center(row, col);
170 qreal dx = temp.x() - pt.x(); // 使用 qreal
171 qreal dy = temp.y() - pt.y(); // 使用 qreal
172 if (dx * dx + dy * dy < m_nR * m_nR) {
173 return true;
174 }
175 }
176 }
177 return false;
178}
179
180
181//象棋的棋盘的坐标转换成界面坐标

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected