本文整理汇总了C++中Stone::hide方法的典型用法代码示例。如果您正苦于以下问题:C++ Stone::hide方法的具体用法?C++ Stone::hide怎么用?C++ Stone::hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stone
的用法示例。
在下文中一共展示了Stone::hide方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeStone
bool StoneHandler::removeStone(int x, int y, bool hide)
{
if (!hasStone(x, y))
return false;
if (!hide)
{
// We delete the killed stones only if we want to update the board (i.e. : not if we are browsing the game)
if (boardHandler->getDisplay_incoming_move()) //SL added eb 9
if (!stones->remove(Matrix::coordsToKey(x, y)))
{
qWarning(" *** Key for stone %d, %d not found! ***", x, y);
return false;
}
}
else
{
Stone *s;
if ((s = stones->find(Matrix::coordsToKey(x, y))) == NULL)
{
qWarning(" *** Key for stone %d, %d not found! ***", x, y);
return false;
}
s->hide();
}
return true;
}
示例2: updateAll
bool StoneHandler::updateAll(Matrix *m, bool toDraw)
{
// qDebug("StoneHandler::updateAll(Matrix *m) - toDraw = %d", toDraw);
CHECK_PTR(m);
// m->debug();
Stone *stone;
bool modified = false, fake = false;
short data;
/*
* Synchronize the matrix with the stonehandler data and
* update the canvas.
* This is usually called when navigating through the tree.
*/
for (int y=1; y<=boardHandler->board->getBoardSize(); y++)
{
for (int x=1; x<=boardHandler->board->getBoardSize(); x++)
{
// Extract the data for the stone from the matrix
data = abs(m->at(x-1, y-1) % 10);
switch (data)
{
case stoneBlack:
if ((stone = stones->find(Matrix::coordsToKey(x, y))) == NULL)
{
addStone(boardHandler->board->addStoneSprite(stoneBlack, x, y, fake), true, false);
modified = true;
break;
}
else if (!stone->isVisible())
{
stone->show();
modified = true;
}
if (stone->getColor() == stoneWhite)
{
stone->setColor(stoneBlack);
modified = true;
}
break;
case stoneWhite:
if ((stone = stones->find(Matrix::coordsToKey(x, y))) == NULL)
{
addStone(boardHandler->board->addStoneSprite(stoneWhite, x, y, fake), true, false);
modified = true;
break;
}
else if (!stone->isVisible())
{
stone->show();
modified = true;
}
if (stone->getColor() == stoneBlack)
{
stone->setColor(stoneWhite);
modified = true;
}
break;
case stoneNone:
case stoneErase:
if ((stone = stones->find(Matrix::coordsToKey(x, y))) != NULL &&
stone->isVisible())
{
stone->hide();
modified = true;
}
break;
default:
qWarning("Bad matrix data <%d> at %d/%d in StoneHandler::updateAll(Matrix *m) !",
data, x, y);
}
// Skip mark drawing when reading sgf
if (!toDraw)
continue;
// Extract the mark data from the matrix
data = abs(m->at(x-1, y-1) / 10);
switch (data)
{
case markSquare:
modified = true;
boardHandler->board->setMark(x, y, markSquare, false);
break;
case markCircle:
modified = true;
boardHandler->board->setMark(x, y, markCircle, false);
break;
//.........这里部分代码省略.........