diff options
| -rw-r--r-- | pacman-c++/actor.cpp | 7 | ||||
| -rw-r--r-- | pacman-c++/actor.h | 2 | ||||
| -rw-r--r-- | pacman-c++/main.cpp | 7 | ||||
| -rw-r--r-- | pacman-c++/pacman.pro | 1 | ||||
| -rw-r--r-- | pacman-c++/sound/die.mp3 | bin | 0 -> 27611 bytes | |||
| -rw-r--r-- | pacman-c++/sound/eating_cherry.mp3 | bin | 0 -> 10057 bytes | |||
| -rw-r--r-- | pacman-c++/sound/intermision.mp3 | bin | 0 -> 86125 bytes | |||
| -rw-r--r-- | pacman-c++/sound/intro.mp3 | bin | 0 -> 70217 bytes | |||
| -rw-r--r-- | pacman-c++/sound/intro.wav | bin | 0 -> 10990 bytes | |||
| -rw-r--r-- | pacman-c++/sound/siren.mp3 | bin | 0 -> 29283 bytes | |||
| -rw-r--r-- | pacman-c++/sound/waka_waka.mp3 | bin | 0 -> 12538 bytes |
11 files changed, 13 insertions, 4 deletions
diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp index 4704ed1..5f668fc 100644 --- a/pacman-c++/actor.cpp +++ b/pacman-c++/actor.cpp | |||
| @@ -15,11 +15,12 @@ static QVariant myBooleanInterpolator(const bool &start, const bool &end, qreal | |||
| 15 | return (progress == 1.0) ? end : start; | 15 | return (progress == 1.0) ? end : start; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | Actor::Actor(Type type) | 18 | Actor::Actor(Type type, QGraphicsItem *parent) |
| 19 | : m_type(type), m_direction(Actor::None) | 19 | : PixmapItem(parent), m_type(type), m_direction(Actor::None) |
| 20 | { | 20 | { |
| 21 | m_pix = ":/" + QString("actor%1").arg(m_type); | 21 | m_pix = ":/" + QString("actor%1").arg(m_type); |
| 22 | setSprite(82, 82, SPRITE_PLAYER_WIDTH, SPRITE_PLAYER_HEIGHT); | 22 | // DON'T set any pixmap here. we've a pixmap in the animation |
| 23 | //setPixmap(m_pix); | ||
| 23 | // higher player "over" lower player | 24 | // higher player "over" lower player |
| 24 | setZValue(m_type * 10); | 25 | setZValue(m_type * 10); |
| 25 | 26 | ||
diff --git a/pacman-c++/actor.h b/pacman-c++/actor.h index f5844bb..3cee699 100644 --- a/pacman-c++/actor.h +++ b/pacman-c++/actor.h | |||
| @@ -22,7 +22,7 @@ public: | |||
| 22 | Player4, // yellow | 22 | Player4, // yellow |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | Actor(Type type); | 25 | Actor(Type type, QGraphicsItem *parent = 0); |
| 26 | 26 | ||
| 27 | private: | 27 | private: |
| 28 | QPixmap m_pix; | 28 | QPixmap m_pix; |
diff --git a/pacman-c++/main.cpp b/pacman-c++/main.cpp index 6f6e5df..ed347fe 100644 --- a/pacman-c++/main.cpp +++ b/pacman-c++/main.cpp | |||
| @@ -1,11 +1,14 @@ | |||
| 1 | #include "actor.h" | 1 | #include "actor.h" |
| 2 | #include "block.h" | 2 | #include "block.h" |
| 3 | |||
| 3 | #include <QtCore> | 4 | #include <QtCore> |
| 4 | #include <QtGui> | 5 | #include <QtGui> |
| 6 | #include <phonon/MediaObject> | ||
| 5 | 7 | ||
| 6 | int main(int argc, char **argv) | 8 | int main(int argc, char **argv) |
| 7 | { | 9 | { |
| 8 | QApplication app(argc, argv); | 10 | QApplication app(argc, argv); |
| 11 | app.setApplicationName("pacman"); | ||
| 9 | 12 | ||
| 10 | QGraphicsScene scene(0, 0, 500, 500); | 13 | QGraphicsScene scene(0, 0, 500, 500); |
| 11 | scene.setBackgroundBrush(Qt::black); | 14 | scene.setBackgroundBrush(Qt::black); |
| @@ -40,6 +43,10 @@ int main(int argc, char **argv) | |||
| 40 | mainWin.setCentralWidget(window); | 43 | mainWin.setCentralWidget(window); |
| 41 | mainWin.resize(500, 500); | 44 | mainWin.resize(500, 500); |
| 42 | mainWin.show(); | 45 | mainWin.show(); |
| 46 | |||
| 47 | Phonon::MediaObject *music = Phonon::createPlayer(Phonon::MusicCategory, | ||
| 48 | Phonon::MediaSource("/home/manuel/uni/foop/pacman-c++/sound/intro.wav")); | ||
| 49 | music->play(); | ||
| 43 | 50 | ||
| 44 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); | 51 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); |
| 45 | 52 | ||
diff --git a/pacman-c++/pacman.pro b/pacman-c++/pacman.pro index 99feed0..2bb8629 100644 --- a/pacman-c++/pacman.pro +++ b/pacman-c++/pacman.pro | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | QT += phonon | ||
| 1 | SOURCES += main.cpp \ | 2 | SOURCES += main.cpp \ |
| 2 | pixmapitem.cpp \ | 3 | pixmapitem.cpp \ |
| 3 | actor.cpp \ | 4 | actor.cpp \ |
diff --git a/pacman-c++/sound/die.mp3 b/pacman-c++/sound/die.mp3 new file mode 100644 index 0000000..14c76bc --- /dev/null +++ b/pacman-c++/sound/die.mp3 | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/eating_cherry.mp3 b/pacman-c++/sound/eating_cherry.mp3 new file mode 100644 index 0000000..d63cb9e --- /dev/null +++ b/pacman-c++/sound/eating_cherry.mp3 | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/intermision.mp3 b/pacman-c++/sound/intermision.mp3 new file mode 100644 index 0000000..2e89a78 --- /dev/null +++ b/pacman-c++/sound/intermision.mp3 | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/intro.mp3 b/pacman-c++/sound/intro.mp3 new file mode 100644 index 0000000..7aac980 --- /dev/null +++ b/pacman-c++/sound/intro.mp3 | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/intro.wav b/pacman-c++/sound/intro.wav new file mode 100644 index 0000000..1fc4231 --- /dev/null +++ b/pacman-c++/sound/intro.wav | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/siren.mp3 b/pacman-c++/sound/siren.mp3 new file mode 100644 index 0000000..cbe9c4a --- /dev/null +++ b/pacman-c++/sound/siren.mp3 | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/waka_waka.mp3 b/pacman-c++/sound/waka_waka.mp3 new file mode 100644 index 0000000..69791d3 --- /dev/null +++ b/pacman-c++/sound/waka_waka.mp3 | |||
| Binary files differ | |||
