//Update the color of a tile given x,y coords in tile coordinates void meshSystem::updateTileColor(int x, int y) { sf::Color color; if (SHOW_MATERIAL) { if (mesh[x][y].alpha == 1.22e-3f) color = COLOR_MAP[PYRITE]; else color = COLOR_MAP[ALUMINUM]; } else { if (mesh[x][y].isBorder) color = tempToColor(-1.0f); else color = tempToColor(mesh[x][y].nextTemperature); } sf::Vertex* quad = getQuad(x, y); //Set colors // define its 4 corners quad[0].color = color; quad[1].color = color; quad[2].color = color; quad[3].color = color; }
void SchedulePoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * /*widget*/) { // draw point itself if(option->state & QStyle::State_Selected) { } if(m_disabled) { painter->setBrush(QColor(150,150,150)); painter->setPen(QColor(110,110,110)); } else if(m_selected) { pen.setWidth(3); pen.setColor(QColor(255, 189, 43)); painter->setPen(pen); myBackgroundColor = tempToColor(temp); painter->setBrush(myBackgroundColor); } else { myBackgroundColor = tempToColor(temp); pen.setColor(Qt::white); pen.setWidth(1); painter->setPen(pen); painter->setBrush(myBackgroundColor); } QRectF rect = outlineRect(); painter->drawRoundRect(rect, roundness(rect.width()), roundness(rect.height())); painter->setPen(Qt::white); painter->drawText(rect, Qt::AlignCenter, myText); }