void PlayerIndicator::unhighlight(){ if(highlightedPlayer == -1 || highlightedPlayer >= (int)playerList.size()){ return; } Player* targetPlayer = playerList.at(highlightedPlayer); QGraphicsPolygonItem* polyItem = playerTriangles.at(highlightedPlayer); polyItem->setScale(1); QBrush brush(QColor(targetPlayer->playerColorSet->getFillColor())); polyItem->setBrush(brush); highlightedPlayer = -1; }
void PlayerIndicator::highlightPlayer(Player* targetPlayer){ int highlightNext = findPlayer(targetPlayer); if(highlightNext != -1){ if(highlightedPlayer == highlightNext){ return; } unhighlight(); QGraphicsPolygonItem* polyItem = playerTriangles.at(highlightNext); polyItem->setScale(SCALE); QBrush brush(QColor(targetPlayer->playerColorSet->getHighlightColor())); polyItem->setBrush(brush); highlightedPlayer = highlightNext; } }