|
|
|
@ -7,6 +7,7 @@ |
|
|
|
|
void Game::draw(QPixmap &output) { |
|
|
|
|
QPainter p(&output); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (auto & spectator : spectators) |
|
|
|
|
spectator.draw(p); |
|
|
|
|
for (auto & wall : walls) |
|
|
|
@ -36,9 +37,15 @@ void Game::removeWalls() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Game::Game() { |
|
|
|
|
for (auto & spectator : spectators){ |
|
|
|
|
Game::eventQueue->registerListener(&spectator); |
|
|
|
|
} |
|
|
|
|
constexpr size_t sCount = 10; |
|
|
|
|
const int w = WIDTH / sCount; |
|
|
|
|
for (size_t i = 0; i < sCount; i++){ |
|
|
|
|
Spectator spec; |
|
|
|
|
spec.pos = QPoint(int(i) * w, SPEC_Y / 2); |
|
|
|
|
spectators.push_back(spec); |
|
|
|
|
} |
|
|
|
|
for (auto & spec : spectators) |
|
|
|
|
Game::eventQueue->registerListener(&spec); |
|
|
|
|
InputWindow::inputQueue->registerListener(&player); |
|
|
|
|
instance = this; |
|
|
|
|
} |
|
|
|
|