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

Method center

ChessBoard.cpp:182–192  ·  view source on GitHub ↗

象棋的棋盘的坐标转换成界面坐标

Source from the content-addressed store, hash-verified

180
181//象棋的棋盘的坐标转换成界面坐标
182QPointF ChessBoard::center(int row, int col)
183{
184 const int displayRow = m_bReverseView ? (9 - row) : row;
185 const int displayCol = m_bReverseView ? (8 - col) : col;
186 QPointF rePoint;
187 //这里注意坐标的转换
188 rePoint.setY(displayRow * m_nD + m_nOffSet); // 使用 setY
189 rePoint.setX(displayCol * m_nD + m_nOffSet); // 使用 setX
190
191 return rePoint;
192}
193
194//重载:坐标转换
195QPointF ChessBoard::center(int id)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected