diff options
| author | manuel <manuel@mausz.at> | 2011-04-12 21:40:28 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-04-12 21:40:28 +0200 |
| commit | 33aae787dacf9d87851b71b5859b9f9aa88f80c5 (patch) | |
| tree | 663331ccd7f8200aed7de0b8bac709076afe56bc | |
| parent | 26c2af49cc410b7bd2ea6017a5454381087e960b (diff) | |
| download | foop-33aae787dacf9d87851b71b5859b9f9aa88f80c5.tar.gz foop-33aae787dacf9d87851b71b5859b9f9aa88f80c5.tar.bz2 foop-33aae787dacf9d87851b71b5859b9f9aa88f80c5.zip | |
add siren player
| -rw-r--r-- | pacman-c++/audio.h | 3 | ||||
| -rw-r--r-- | pacman-c++/mainwidget.cpp | 10 | ||||
| -rw-r--r-- | pacman-c++/mainwidget.h | 3 | ||||
| -rw-r--r-- | pacman-c++/pacman.qrc | 1 |
4 files changed, 14 insertions, 3 deletions
diff --git a/pacman-c++/audio.h b/pacman-c++/audio.h index bea7fb8..2e14715 100644 --- a/pacman-c++/audio.h +++ b/pacman-c++/audio.h | |||
| @@ -19,7 +19,8 @@ namespace Sound | |||
| 19 | Intro = 0, | 19 | Intro = 0, |
| 20 | WakaWaka, | 20 | WakaWaka, |
| 21 | EatingCherry, | 21 | EatingCherry, |
| 22 | Die | 22 | Die, |
| 23 | Siren | ||
| 23 | }; | 24 | }; |
| 24 | }; | 25 | }; |
| 25 | 26 | ||
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() |
diff --git a/pacman-c++/mainwidget.h b/pacman-c++/mainwidget.h index 589377b..a3cde3d 100644 --- a/pacman-c++/mainwidget.h +++ b/pacman-c++/mainwidget.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "sceneholder.h" | 4 | #include "sceneholder.h" |
| 5 | #include "constants.h" | 5 | #include "constants.h" |
| 6 | #include "pixmapitem.h" | 6 | #include "audio.h" |
| 7 | #include "pacman.pb.h" | 7 | #include "pacman.pb.h" |
| 8 | #include <QtGui> | 8 | #include <QtGui> |
| 9 | #include <QtCore> | 9 | #include <QtCore> |
| @@ -49,6 +49,7 @@ private: | |||
| 49 | 49 | ||
| 50 | /* game running */ | 50 | /* game running */ |
| 51 | bool m_running; | 51 | bool m_running; |
| 52 | AudioPlayer *m_sirenPlayer; | ||
| 52 | 53 | ||
| 53 | QTcpSocket *m_socket; | 54 | QTcpSocket *m_socket; |
| 54 | SceneHolder *m_scene; | 55 | SceneHolder *m_scene; |
diff --git a/pacman-c++/pacman.qrc b/pacman-c++/pacman.qrc index 4fb542e..c4b18e6 100644 --- a/pacman-c++/pacman.qrc +++ b/pacman-c++/pacman.qrc | |||
| @@ -25,5 +25,6 @@ | |||
| 25 | <file alias="sound2">sound/waka_waka.ogg</file> | 25 | <file alias="sound2">sound/waka_waka.ogg</file> |
| 26 | <file alias="sound3">sound/eating_cherry.ogg</file> | 26 | <file alias="sound3">sound/eating_cherry.ogg</file> |
| 27 | <file alias="sound4">sound/die.ogg</file> | 27 | <file alias="sound4">sound/die.ogg</file> |
| 28 | <file alias="sound5">sound/siren.ogg</file> | ||
| 28 | </qresource> | 29 | </qresource> |
| 29 | </RCC> | 30 | </RCC> |
