本文整理汇总了C++中Chess::getColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Chess::getColor方法的具体用法?C++ Chess::getColor怎么用?C++ Chess::getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chess
的用法示例。
在下文中一共展示了Chess::getColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: displayPossiblePath
void GUI::displayPossiblePath(Chess* ch, const Map& map)
{
COORD bufferSize = { 34, 21 };
COORD characterBufferSize = { 34, 21 };
COORD characterPosition = { 0, 0 };
SMALL_RECT consoleWriteArea = { CHESS_BOARD_X, CHESS_BOARD_Y, CHESS_BOARD_X + 34 - 1, CHESS_BOARD_Y + 21 - 1 };
CHAR_INFO consoleBuffer[34 * 21];
SetConsoleScreenBufferSize(hConsole, bufferSize);
for (int y = 0; y < (21); ++y) {
for (int x = 0; x < 34; ++x) {
consoleBuffer[x + 34 * y].Attributes = ((y == 0 || y == 20) ? WD_Purple_BG_WHITE : WD_BLACK_BG_WHITE);
consoleBuffer[x + 34 * y].Char.AsciiChar = ChessScreenChar[y][x];
}
}
for (int x = 0; x < ROW_SIZE; x++)
for (int y = 0; y < COLUMN_SIZE; y++)
if (map.pChess[x][y] != NULL) {
consoleBuffer[(x * 4) + 34 * (y * 2 + 1)].Attributes = ((map.pChess[x][y]->getColor() == true) ? CHESS_RED : CHESS_BLACK);
consoleBuffer[(x * 4) + 34 * (y * 2 + 1) + 1].Attributes = ((map.pChess[x][y]->getColor() == true) ? CHESS_RED : CHESS_BLACK);
consoleBuffer[(x * 4) + 34 * (y * 2 + 1)].Char.AsciiChar = map.pChess[x][y]->getName().at(0);
consoleBuffer[(x * 4) + 34 * (y * 2 + 1) + 1].Char.AsciiChar = map.pChess[x][y]->getName().at(1);
}
for (unsigned int i = 0; i < ch->access.size(); i++)
{
int x = ch->access.at(i).X;
int y = ch->access.at(i).Y;
Chess *tempch = map.pChess[ch->access.at(i).X][ch->access.at(i).Y];
consoleBuffer[(x * 4) + 34 * (y * 2 + 1)].Attributes = (tempch == NULL ? 120 : (tempch->getColor() ? 60 : 48));
consoleBuffer[(x * 4) + 34 * (y * 2 + 1) + 1].Attributes = (tempch == NULL ? 120 : (tempch->getColor() ? 60 : 48));
if (tempch != NULL) {
consoleBuffer[(x * 4) + 34 * (y * 2 + 1)].Char.AsciiChar = tempch->getName().at(0);
consoleBuffer[(x * 4) + 34 * (y * 2 + 1) + 1].Char.AsciiChar = tempch->getName().at(1);
}
}
WriteConsoleOutputA(hConsole, consoleBuffer, characterBufferSize, characterPosition, &consoleWriteArea);
}