|
|
|
@ -4,11 +4,11 @@ |
|
|
|
|
#include "Game.h" |
|
|
|
|
|
|
|
|
|
void Spectator::OnWallJumped(WallJumpEvent *event) { |
|
|
|
|
std::cout << "Wall jump at " << event->time << std::endl; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Spectator::OnWallCrashed(WallCrashEvent *event) { |
|
|
|
|
std::cout << "Wall crash at " << event->time << std::endl; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -16,7 +16,27 @@ void Spectator::draw(QPainter &painter) const { |
|
|
|
|
painter.save(); |
|
|
|
|
|
|
|
|
|
painter.translate(pos); |
|
|
|
|
painter.drawText(0, 0, QString("Hello")); |
|
|
|
|
QSize figureSize = size / 3; |
|
|
|
|
painter.translate(QPoint(figureSize.width() / 2, 0)); |
|
|
|
|
int r = figureSize.width() / 2.5; |
|
|
|
|
painter.drawEllipse(QPoint(0, r + 5), r, r); |
|
|
|
|
int base = 2 * r + 5 + figureSize.height() / 2; |
|
|
|
|
|
|
|
|
|
// main
|
|
|
|
|
painter.drawLine(0, 2 * r + 5, 0, base); |
|
|
|
|
|
|
|
|
|
// arms
|
|
|
|
|
int armY = (2 * r + 5 + base) / 2; |
|
|
|
|
painter.drawLine(0, armY, -r, armY - figureSize.height() / 3); |
|
|
|
|
painter.drawLine(0, armY, r, armY - figureSize.height() / 3); |
|
|
|
|
|
|
|
|
|
// legs
|
|
|
|
|
painter.drawLine(0, base, -r, base + figureSize.height() / 2); |
|
|
|
|
painter.drawLine(0, base, r, base + figureSize.height() / 2); |
|
|
|
|
|
|
|
|
|
painter.translate(QPoint(figureSize.width() / 2, 0)); |
|
|
|
|
QSize textArea = 2 * size / 3; |
|
|
|
|
painter.drawText(QRect(QPoint(), textArea), Qt::AlignCenter, QString::fromStdString(currentMessage)); |
|
|
|
|
|
|
|
|
|
painter.restore(); |
|
|
|
|
} |
|
|
|
|