| 49 | } |
| 50 | |
| 51 | void |
| 52 | Triangle::paint(QPainter& painter) { |
| 53 | painter.setBrush(brush_); |
| 54 | painter.setPen(pen_); |
| 55 | |
| 56 | std::vector<QPoint> plist = dynamics_->getPositionList(); |
| 57 | std::vector<QPoint>::iterator idx = plist.begin(); |
| 58 | |
| 59 | QBrush black( QColor(0x33, 0x33, 0x33), Qt::SolidPattern); |
| 60 | QBrush white( QColor(0xFF, 0xFF, 0xFF), Qt::SolidPattern); |
| 61 | QBrush brush; |
| 62 | |
| 63 | while (idx != plist.end()) { |
| 64 | painter.translate(idx->x() - bounds_.width()/2, |
| 65 | idx->y() - bounds_.height()/2); |
| 66 | painter.drawPolygon(triangle_); |
| 67 | painter.translate(-(idx->x() - bounds_.width()/2), |
| 68 | -(idx->y() - bounds_.height()/2)); |
| 69 | |
| 70 | if (targeted_) |
| 71 | brush = black; |
| 72 | else |
| 73 | brush = white; |
| 74 | |
| 75 | painter.setBrush(brush); |
| 76 | int X0 = idx->x(); |
| 77 | int Y0 = idx->y() + (bounds_.height()/6); |
| 78 | int W = bounds_.width()/3; |
| 79 | int H = bounds_.height()/3; |
| 80 | painter.setBrush(brush); |
| 81 | painter.drawEllipse(X0 - W/2, |
| 82 | Y0 - H/2, |
| 83 | W, |
| 84 | H); |
| 85 | painter.setBrush(brush_); |
| 86 | painter.setBrush(brush_); |
| 87 | |
| 88 | ++idx; |
| 89 | } |
| 90 | } |