diff options
Diffstat (limited to 'pacman-c++/mainwidget.cpp')
| -rw-r--r-- | pacman-c++/mainwidget.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp index 89cbd58..5ef37e3 100644 --- a/pacman-c++/mainwidget.cpp +++ b/pacman-c++/mainwidget.cpp | |||
| @@ -2,13 +2,20 @@ | |||
| 2 | #include "actor.h" | 2 | #include "actor.h" |
| 3 | #include "block.h" | 3 | #include "block.h" |
| 4 | #include "constants.h" | 4 | #include "constants.h" |
| 5 | #include "audio.h" | ||
| 6 | #include "util.h" | 5 | #include "util.h" |
| 7 | #include "pacman.pb.h" | 6 | #include "pacman.pb.h" |
| 8 | 7 | ||
| 9 | MainWidget::MainWidget(QWidget *parent) | 8 | MainWidget::MainWidget(QWidget *parent) |
| 10 | : QWidget(parent), m_currentKey(Transmission::none), m_running(false) | 9 | : QWidget(parent), m_currentKey(Transmission::none), m_running(false) |
| 11 | { | 10 | { |
| 11 | /* create audio player */ | ||
| 12 | m_sirenPlayer = new AudioPlayer(this); | ||
| 13 | if (m_sirenPlayer->isWorking()) | ||
| 14 | { | ||
| 15 | m_sirenPlayer->setLoop(Sound::Siren); | ||
| 16 | AudioManager::self()->registerAudioPlayer(m_sirenPlayer); | ||
| 17 | } | ||
| 18 | |||
| 12 | Color::Color color = connectToServer(); | 19 | Color::Color color = connectToServer(); |
| 13 | if (color == Color::none) | 20 | if (color == Color::none) |
| 14 | { | 21 | { |
| @@ -192,6 +199,7 @@ void MainWidget::keyReleaseEvent(QKeyEvent* event) | |||
| 192 | void MainWidget::startGame() | 199 | void MainWidget::startGame() |
| 193 | { | 200 | { |
| 194 | m_running = true; | 201 | m_running = true; |
| 202 | m_sirenPlayer->play(); | ||
| 195 | } | 203 | } |
| 196 | 204 | ||
| 197 | void MainWidget::playerScoreClicked() | 205 | void MainWidget::playerScoreClicked() |
