diff options
28 files changed, 115 insertions, 99 deletions
| @@ -6,4 +6,5 @@ pacman-c++/*.o | |||
| 6 | pacman-c++/*.moc | 6 | pacman-c++/*.moc |
| 7 | *-build-debug | 7 | *-build-debug |
| 8 | *-build-release | 8 | *-build-release |
| 9 | *-build-desktop | ||
| 9 | .*.swp | 10 | .*.swp |
diff --git a/pacman-c++/actor.h b/pacman-c++/actor.h index d2d7875..5bec353 100644 --- a/pacman-c++/actor.h +++ b/pacman-c++/actor.h | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | #define ACTOR_H | 2 | #define ACTOR_H |
| 3 | 3 | ||
| 4 | #include "pixmapitem.h" | 4 | #include "pixmapitem.h" |
| 5 | |||
| 6 | #include "constants.h" | 5 | #include "constants.h" |
| 7 | 6 | ||
| 8 | class Actor | 7 | class Actor |
diff --git a/pacman-c++/animationmanager.cpp b/pacman-c++/animationmanager.cpp index 69bec53..f4ddef7 100644 --- a/pacman-c++/animationmanager.cpp +++ b/pacman-c++/animationmanager.cpp | |||
| @@ -11,46 +11,46 @@ AnimationManager::AnimationManager() | |||
| 11 | 11 | ||
| 12 | AnimationManager *AnimationManager::self() | 12 | AnimationManager *AnimationManager::self() |
| 13 | { | 13 | { |
| 14 | if (!instance) | 14 | if (!instance) |
| 15 | instance = new AnimationManager; | 15 | instance = new AnimationManager; |
| 16 | return instance; | 16 | return instance; |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | void AnimationManager::registerAnimation(QAbstractAnimation *anim) | 19 | void AnimationManager::registerAnimation(QAbstractAnimation *anim) |
| 20 | { | 20 | { |
| 21 | QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); | 21 | QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); |
| 22 | animations.append(anim); | 22 | animations.append(anim); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | void AnimationManager::unregisterAnimation_helper(QObject *obj) | 25 | void AnimationManager::unregisterAnimation_helper(QObject *obj) |
| 26 | { | 26 | { |
| 27 | unregisterAnimation(static_cast<QAbstractAnimation*>(obj)); | 27 | unregisterAnimation(static_cast<QAbstractAnimation*>(obj)); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | void AnimationManager::unregisterAnimation(QAbstractAnimation *anim) | 30 | void AnimationManager::unregisterAnimation(QAbstractAnimation *anim) |
| 31 | { | 31 | { |
| 32 | QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); | 32 | QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); |
| 33 | animations.removeAll(anim); | 33 | animations.removeAll(anim); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | void AnimationManager::unregisterAllAnimations() | 36 | void AnimationManager::unregisterAllAnimations() |
| 37 | { | 37 | { |
| 38 | animations.clear(); | 38 | animations.clear(); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | void AnimationManager::pauseAll() | 41 | void AnimationManager::pauseAll() |
| 42 | { | 42 | { |
| 43 | foreach (QAbstractAnimation* animation, animations) | 43 | foreach (QAbstractAnimation* animation, animations) |
| 44 | { | 44 | { |
| 45 | if (animation->state() == QAbstractAnimation::Running) | 45 | if (animation->state() == QAbstractAnimation::Running) |
| 46 | animation->pause(); | 46 | animation->pause(); |
| 47 | } | 47 | } |
| 48 | } | 48 | } |
| 49 | void AnimationManager::resumeAll() | 49 | void AnimationManager::resumeAll() |
| 50 | { | 50 | { |
| 51 | foreach (QAbstractAnimation* animation, animations) | 51 | foreach (QAbstractAnimation* animation, animations) |
| 52 | { | 52 | { |
| 53 | if (animation->state() == QAbstractAnimation::Paused) | 53 | if (animation->state() == QAbstractAnimation::Paused) |
| 54 | animation->resume(); | 54 | animation->resume(); |
| 55 | } | 55 | } |
| 56 | } | 56 | } |
diff --git a/pacman-c++/animationmanager.h b/pacman-c++/animationmanager.h index eb5b7d0..408395b 100644 --- a/pacman-c++/animationmanager.h +++ b/pacman-c++/animationmanager.h | |||
| @@ -8,26 +8,26 @@ class QAbstractAnimation; | |||
| 8 | QT_END_NAMESPACE | 8 | QT_END_NAMESPACE |
| 9 | 9 | ||
| 10 | class AnimationManager | 10 | class AnimationManager |
| 11 | : public QObject | 11 | : public QObject |
| 12 | { | 12 | { |
| 13 | Q_OBJECT | 13 | Q_OBJECT |
| 14 | public: | 14 | public: |
| 15 | AnimationManager(); | 15 | AnimationManager(); |
| 16 | void registerAnimation(QAbstractAnimation *anim); | 16 | void registerAnimation(QAbstractAnimation *anim); |
| 17 | void unregisterAnimation(QAbstractAnimation *anim); | 17 | void unregisterAnimation(QAbstractAnimation *anim); |
| 18 | void unregisterAllAnimations(); | 18 | void unregisterAllAnimations(); |
| 19 | static AnimationManager *self(); | 19 | static AnimationManager *self(); |
| 20 | 20 | ||
| 21 | public slots: | 21 | public slots: |
| 22 | void pauseAll(); | 22 | void pauseAll(); |
| 23 | void resumeAll(); | 23 | void resumeAll(); |
| 24 | 24 | ||
| 25 | private slots: | 25 | private slots: |
| 26 | void unregisterAnimation_helper(QObject *obj); | 26 | void unregisterAnimation_helper(QObject *obj); |
| 27 | 27 | ||
| 28 | private: | 28 | private: |
| 29 | static AnimationManager *instance; | 29 | static AnimationManager *instance; |
| 30 | QList<QAbstractAnimation *> animations; | 30 | QList<QAbstractAnimation *> animations; |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | #endif // ANIMATIONMANAGER_H | 33 | #endif // ANIMATIONMANAGER_H |
diff --git a/pacman-c++/block.cpp b/pacman-c++/block.cpp index 9d57578..6383b3a 100644 --- a/pacman-c++/block.cpp +++ b/pacman-c++/block.cpp | |||
| @@ -1,18 +1,17 @@ | |||
| 1 | #include "block.h" | 1 | #include "block.h" |
| 2 | |||
| 3 | #include <QtGui> | ||
| 4 | |||
| 5 | #include "constants.h" | 2 | #include "constants.h" |
| 3 | #include <QtGui> | ||
| 6 | 4 | ||
| 7 | std::map<Color, QPixmap> Block::m_pixmaps; | 5 | std::map<Color, QPixmap> Block::m_pixmaps; |
| 8 | 6 | ||
| 9 | Block::Block(Color color, QGraphicsItem *parent) | 7 | Block::Block(Color color, QGraphicsItem *parent) |
| 10 | : PixmapItem(parent) | 8 | : PixmapItem(parent) |
| 11 | { | 9 | { |
| 12 | if (m_pixmaps.find(color) == m_pixmaps.end()) { | 10 | if (m_pixmaps.find(color) == m_pixmaps.end()) |
| 11 | { | ||
| 13 | QString pixmapName = ":/" + QString("block%1").arg(color); | 12 | QString pixmapName = ":/" + QString("block%1").arg(color); |
| 14 | m_pixmaps[color] = QPixmap( pixmapName ); | 13 | m_pixmaps[color] = QPixmap(pixmapName); |
| 15 | } | 14 | } |
| 16 | setPixmap( m_pixmaps.find(color)->second ); | 15 | setPixmap(m_pixmaps.find(color)->second); |
| 17 | qDebug() << "loading block w color: " << color; | 16 | qDebug() << "loading block w color: " << color; |
| 18 | } | 17 | } |
diff --git a/pacman-c++/block.h b/pacman-c++/block.h index 25f4f08..793d4a8 100644 --- a/pacman-c++/block.h +++ b/pacman-c++/block.h | |||
| @@ -3,21 +3,19 @@ | |||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | #include "pixmapitem.h" | 5 | #include "pixmapitem.h" |
| 6 | |||
| 7 | #include <map> | ||
| 8 | |||
| 9 | #include "constants.h" | 6 | #include "constants.h" |
| 7 | #include <map> | ||
| 10 | 8 | ||
| 11 | 9 | ||
| 12 | class Block | 10 | class Block |
| 13 | : public PixmapItem { | 11 | : public PixmapItem |
| 12 | { | ||
| 14 | public: | 13 | public: |
| 15 | Block(Color color, QGraphicsItem *parent=0); | 14 | Block(Color color, QGraphicsItem *parent=0); |
| 16 | 15 | ||
| 17 | private: | 16 | private: |
| 18 | // map for saving QPixmaps for reuse | 17 | // map for saving QPixmaps for reuse |
| 19 | static std::map<Color, QPixmap> m_pixmaps; | 18 | static std::map<Color, QPixmap> m_pixmaps; |
| 20 | |||
| 21 | }; | 19 | }; |
| 22 | 20 | ||
| 23 | #endif // BLOCK_H | 21 | #endif // BLOCK_H |
diff --git a/pacman-c++/bonuspoint.cpp b/pacman-c++/bonuspoint.cpp index efff263..e2fdba0 100644 --- a/pacman-c++/bonuspoint.cpp +++ b/pacman-c++/bonuspoint.cpp | |||
| @@ -1,14 +1,14 @@ | |||
| 1 | #include "bonuspoint.h" | 1 | #include "bonuspoint.h" |
| 2 | 2 | ||
| 3 | namespace { | 3 | namespace |
| 4 | { | ||
| 4 | QPixmap *pixmap = 0; | 5 | QPixmap *pixmap = 0; |
| 5 | } | 6 | } |
| 6 | 7 | ||
| 7 | BonusPoint::BonusPoint(QGraphicsItem *parent) | 8 | BonusPoint::BonusPoint(QGraphicsItem *parent) |
| 8 | : PixmapItem(parent) | 9 | : PixmapItem(parent) |
| 9 | { | 10 | { |
| 10 | if (pixmap == 0) { | 11 | if (pixmap == 0) |
| 11 | pixmap = new QPixmap(":/cherry"); | 12 | pixmap = new QPixmap(":/cherry"); |
| 12 | } | ||
| 13 | setPixmap(*pixmap); | 13 | setPixmap(*pixmap); |
| 14 | } | 14 | } |
diff --git a/pacman-c++/bonuspoint.h b/pacman-c++/bonuspoint.h index ebd1615..b14f582 100644 --- a/pacman-c++/bonuspoint.h +++ b/pacman-c++/bonuspoint.h | |||
| @@ -8,8 +8,6 @@ class BonusPoint | |||
| 8 | { | 8 | { |
| 9 | public: | 9 | public: |
| 10 | BonusPoint(QGraphicsItem *parent=0); | 10 | BonusPoint(QGraphicsItem *parent=0); |
| 11 | private: | ||
| 12 | |||
| 13 | }; | 11 | }; |
| 14 | 12 | ||
| 15 | #endif // BONUSPOINT_H \ No newline at end of file | 13 | #endif // BONUSPOINT_H |
diff --git a/pacman-c++/client.h b/pacman-c++/client.h index 2816ec2..272d110 100644 --- a/pacman-c++/client.h +++ b/pacman-c++/client.h | |||
| @@ -1,9 +1,8 @@ | |||
| 1 | #ifndef CLIENT_H | 1 | #ifndef CLIENT_H |
| 2 | #define CLIENT_H | 2 | #define CLIENT_H |
| 3 | 3 | ||
| 4 | #include <QtGui> | ||
| 5 | |||
| 6 | #include "mainwidget.h" | 4 | #include "mainwidget.h" |
| 5 | #include <QtGui> | ||
| 7 | 6 | ||
| 8 | class Client | 7 | class Client |
| 9 | : public QMainWindow { | 8 | : public QMainWindow { |
| @@ -15,4 +14,4 @@ private: | |||
| 15 | MainWidget *mainWidget; | 14 | MainWidget *mainWidget; |
| 16 | }; | 15 | }; |
| 17 | 16 | ||
| 18 | #endif // CLIENT_H \ No newline at end of file | 17 | #endif // CLIENT_H |
diff --git a/pacman-c++/constants.h b/pacman-c++/constants.h index 088fcb8..d9362d8 100644 --- a/pacman-c++/constants.h +++ b/pacman-c++/constants.h | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | const unsigned int map_size[2] = { 20, 20 }; | 4 | const unsigned int map_size[2] = { 20, 20 }; |
| 5 | const unsigned int field_size[2] = { 16, 16 }; | 5 | const unsigned int field_size[2] = { 16, 16 }; |
| 6 | 6 | ||
| 7 | enum Color { | 7 | enum Color |
| 8 | { | ||
| 8 | noColor = 0, | 9 | noColor = 0, |
| 9 | red = (1 << 0), | 10 | red = (1 << 0), |
| 10 | blue = (1 << 1), | 11 | blue = (1 << 1), |
| @@ -12,8 +13,8 @@ enum Color { | |||
| 12 | }; | 13 | }; |
| 13 | 14 | ||
| 14 | // constants for data transmission to client | 15 | // constants for data transmission to client |
| 15 | namespace transmission { | 16 | namespace transmission |
| 16 | 17 | { | |
| 17 | typedef unsigned int field_t; | 18 | typedef unsigned int field_t; |
| 18 | typedef unsigned int mask_t; | 19 | typedef unsigned int mask_t; |
| 19 | 20 | ||
diff --git a/pacman-c++/main.cpp b/pacman-c++/main.cpp index a34ff97..8c9232a 100644 --- a/pacman-c++/main.cpp +++ b/pacman-c++/main.cpp | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | #include <QtCore> | 4 | #include <QtCore> |
| 5 | #include <QtGui> | 5 | #include <QtGui> |
| 6 | #include <phonon/MediaObject> | 6 | #include <phonon/MediaObject> |
| 7 | #include <phonon/AudioOutput> | ||
| 8 | #include <phonon/BackendCapabilities> | ||
| 7 | 9 | ||
| 8 | int main(int argc, char **argv) | 10 | int main(int argc, char **argv) |
| 9 | { | 11 | { |
| @@ -13,22 +15,18 @@ int main(int argc, char **argv) | |||
| 13 | QGraphicsScene scene(0, 0, 500, 500); | 15 | QGraphicsScene scene(0, 0, 500, 500); |
| 14 | scene.setBackgroundBrush(Qt::black); | 16 | scene.setBackgroundBrush(Qt::black); |
| 15 | 17 | ||
| 16 | Actor *actor1 = new Actor(Actor::Player1); | 18 | Actor *actor1 = new Actor(red); |
| 17 | scene.addItem(actor1); | 19 | scene.addItem(actor1); |
| 18 | actor1->setPos(100, 100); | 20 | actor1->setPos(100, 100); |
| 19 | 21 | ||
| 20 | Actor *actor2 = new Actor(Actor::Player2); | 22 | Actor *actor2 = new Actor(blue); |
| 21 | scene.addItem(actor2); | 23 | scene.addItem(actor2); |
| 22 | actor2->setPos(120, 100); | 24 | actor2->setPos(120, 100); |
| 23 | 25 | ||
| 24 | Actor *actor3 = new Actor(Actor::Player3); | 26 | Actor *actor3 = new Actor(green); |
| 25 | scene.addItem(actor3); | 27 | scene.addItem(actor3); |
| 26 | actor3->setPos(140, 100); | 28 | actor3->setPos(140, 100); |
| 27 | 29 | ||
| 28 | Actor *actor4 = new Actor(Actor::Player4); | ||
| 29 | scene.addItem(actor4); | ||
| 30 | actor4->setPos(160, 100); | ||
| 31 | |||
| 32 | /* | 30 | /* |
| 33 | Block *block1 = new Block(Actor::Player1); | 31 | Block *block1 = new Block(Actor::Player1); |
| 34 | scene.addItem(block1); | 32 | scene.addItem(block1); |
| @@ -36,7 +34,7 @@ int main(int argc, char **argv) | |||
| 36 | */ | 34 | */ |
| 37 | 35 | ||
| 38 | for (unsigned int i=0; i<20; ++i) { | 36 | for (unsigned int i=0; i<20; ++i) { |
| 39 | Block *b = new Block(Actor::Player1); | 37 | Block *b = new Block(red); |
| 40 | scene.addItem(b); | 38 | scene.addItem(b); |
| 41 | b->setPos( 100 + i*16, 200); | 39 | b->setPos( 100 + i*16, 200); |
| 42 | } | 40 | } |
| @@ -53,7 +51,7 @@ int main(int argc, char **argv) | |||
| 53 | mainWin.show(); | 51 | mainWin.show(); |
| 54 | 52 | ||
| 55 | Phonon::MediaObject *music = Phonon::createPlayer(Phonon::MusicCategory, | 53 | Phonon::MediaObject *music = Phonon::createPlayer(Phonon::MusicCategory, |
| 56 | Phonon::MediaSource("/home/totycro/stud/foop/repo/pacman-c++/sound/intro.wav")); | 54 | Phonon::MediaSource("/home/manuel/uni/foop/pacman-c++/sound/eating_cherry.ogg")); |
| 57 | music->play(); | 55 | music->play(); |
| 58 | 56 | ||
| 59 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); | 57 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); |
diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp index cc85416..90d31b2 100644 --- a/pacman-c++/mainwidget.cpp +++ b/pacman-c++/mainwidget.cpp | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | #include "bonuspoint.h" | 5 | #include "bonuspoint.h" |
| 6 | #include "constants.h" | 6 | #include "constants.h" |
| 7 | 7 | ||
| 8 | MainWidget::MainWidget() { | 8 | MainWidget::MainWidget() |
| 9 | 9 | { | |
| 10 | QVBoxLayout *layout = new QVBoxLayout(this); | 10 | QVBoxLayout *layout = new QVBoxLayout(this); |
| 11 | 11 | ||
| 12 | QLabel *lbl = new QLabel("da kommt da spielstand hin", this); | 12 | QLabel *lbl = new QLabel("da kommt da spielstand hin", this); |
| @@ -29,14 +29,17 @@ MainWidget::MainWidget() { | |||
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | // temporary | 31 | // temporary |
| 32 | transmission::map_t createDummyMap() { | 32 | transmission::map_t createDummyMap() |
| 33 | { | ||
| 33 | transmission::map_t map; | 34 | transmission::map_t map; |
| 34 | map = new transmission::field_t*[map_size[0]]; | 35 | map = new transmission::field_t*[map_size[0]]; |
| 35 | for (unsigned int i=0; i<map_size[0]; ++i) { | 36 | for (unsigned int i = 0; i < map_size[0]; ++i) |
| 36 | map[i] = new transmission::field_t[map_size[1]]; | 37 | map[i] = new transmission::field_t[map_size[1]]; |
| 37 | } | 38 | |
| 38 | for (unsigned int x=0; x<map_size[0]; ++x) { | 39 | for (unsigned int x = 0; x < map_size[0]; ++x) |
| 39 | for (unsigned int y=0; y<map_size[1]; ++y) { | 40 | { |
| 41 | for (unsigned int y = 0; y < map_size[1]; ++y) | ||
| 42 | { | ||
| 40 | transmission::field_t &cur = map[x][y]; | 43 | transmission::field_t &cur = map[x][y]; |
| 41 | cur = 0; | 44 | cur = 0; |
| 42 | } | 45 | } |
| @@ -60,52 +63,72 @@ transmission::map_t createDummyMap() { | |||
| 60 | 63 | ||
| 61 | return map; | 64 | return map; |
| 62 | } | 65 | } |
| 66 | |||
| 63 | void MainWidget::loadDummyMap() | 67 | void MainWidget::loadDummyMap() |
| 64 | { | 68 | { |
| 65 | transmission::map_t map = createDummyMap(); | 69 | transmission::map_t map = createDummyMap(); |
| 66 | 70 | ||
| 67 | for (unsigned int x=0; x<map_size[0]; ++x) { | 71 | for (unsigned int x = 0; x < map_size[0]; ++x) |
| 68 | for (unsigned int y=0; y<map_size[1]; ++y) { | 72 | { |
| 73 | for (unsigned int y = 0; y < map_size[1]; ++y) | ||
| 74 | { | ||
| 69 | const transmission::field_t &cur = map[x][y]; | 75 | const transmission::field_t &cur = map[x][y]; |
| 70 | if (cur == 0) { | 76 | if (cur == 0) |
| 71 | continue; | 77 | continue; |
| 72 | } | 78 | qDebug() << "not 0 at x=" << x << ", y=" << y << ", val=" << cur; |
| 73 | qDebug() << "not 0 at " << x << "," << y << ":" << cur; | ||
| 74 | 79 | ||
| 75 | Color color = static_cast<Color>(cur & transmission::color_mask); | 80 | Color color = static_cast<Color>(cur & transmission::color_mask); |
| 76 | qDebug() << "col " << color; | 81 | qDebug() << "col=" << color; |
| 77 | 82 | ||
| 78 | PixmapItem *item = 0; | 83 | PixmapItem *item = 0; |
| 79 | if (cur & transmission::block) { | 84 | if (cur & transmission::block) |
| 80 | item = new Block(color); | 85 | item = new Block(color); |
| 81 | } else if (cur & transmission::bonuspoint) { | 86 | else if (cur & transmission::bonuspoint) |
| 82 | item = new BonusPoint(); | 87 | item = new BonusPoint(); |
| 83 | } else if (cur & transmission::pacman) { | 88 | else if (cur & transmission::pacman) |
| 89 | { | ||
| 84 | Actor *actor = 0; | 90 | Actor *actor = 0; |
| 85 | ActorMap::iterator it = m_actors.find(color); | 91 | ActorMap::iterator it = m_actors.find(color); |
| 86 | if (it != m_actors.end()) { | 92 | if (it != m_actors.end()) |
| 87 | actor = it->second; | 93 | actor = it->second; |
| 88 | } else { | 94 | else |
| 95 | { | ||
| 89 | qDebug() << "new actor of col" << color; | 96 | qDebug() << "new actor of col" << color; |
| 90 | actor = new Actor(color); | 97 | actor = new Actor(color); |
| 91 | m_actors[color] = actor; | 98 | m_actors[color] = actor; |
| 92 | m_scene->addItem(actor); | 99 | m_scene->addItem(actor); |
| 93 | actor->setPos( mapPositionToCoord(x, y) ); | 100 | actor->setPos(mapPositionToCoord(x, y)); |
| 94 | } | 101 | } |
| 102 | |||
| 95 | Actor::Movement direction; | 103 | Actor::Movement direction; |
| 96 | switch (cur & transmission::direction_mask) { | 104 | switch (cur & transmission::direction_mask) |
| 97 | case transmission::direction_left: direction = Actor::Left; break; | 105 | { |
| 98 | case transmission::direction_right: direction = Actor::Right; break; | 106 | case 0: |
| 99 | case transmission::direction_up: direction = Actor::Up; break; | 107 | break; |
| 100 | case transmission::direction_down: direction = Actor::Down; break; | 108 | case transmission::direction_left: |
| 101 | default: Q_ASSERT(false); | 109 | direction = Actor::Left; |
| 110 | break; | ||
| 111 | case transmission::direction_right: | ||
| 112 | direction = Actor::Right; | ||
| 113 | break; | ||
| 114 | case transmission::direction_up: | ||
| 115 | direction = Actor::Up; | ||
| 116 | break; | ||
| 117 | case transmission::direction_down: | ||
| 118 | direction = Actor::Down; | ||
| 119 | break; | ||
| 120 | default: | ||
| 121 | Q_ASSERT(false); | ||
| 102 | } | 122 | } |
| 103 | //actor->move(direction, mapPositionToCoord(x, y); | 123 | //actor->move(direction, mapPositionToCoord(x, y); |
| 104 | } else { Q_ASSERT(false); } | 124 | } |
| 105 | 125 | else | |
| 106 | if(item != 0) { | 126 | Q_ASSERT(false); |
| 127 | |||
| 128 | if(item != 0) | ||
| 129 | { | ||
| 107 | m_scene->addItem(item); | 130 | m_scene->addItem(item); |
| 108 | item->setPos( mapPositionToCoord(x, y) ); | 131 | item->setPos(mapPositionToCoord(x, y)); |
| 109 | } | 132 | } |
| 110 | } | 133 | } |
| 111 | } | 134 | } |
diff --git a/pacman-c++/mainwidget.h b/pacman-c++/mainwidget.h index 184c542..f98cc42 100644 --- a/pacman-c++/mainwidget.h +++ b/pacman-c++/mainwidget.h | |||
| @@ -1,11 +1,10 @@ | |||
| 1 | #ifndef MAINWIDGET_H | 1 | #ifndef MAINWIDGET_H |
| 2 | #define MAINWIDGET_H | 2 | #define MAINWIDGET_H |
| 3 | 3 | ||
| 4 | #include "constants.h" | ||
| 4 | #include <QtGui> | 5 | #include <QtGui> |
| 5 | #include <map> | 6 | #include <map> |
| 6 | 7 | ||
| 7 | #include "constants.h" | ||
| 8 | |||
| 9 | class Actor; | 8 | class Actor; |
| 10 | 9 | ||
| 11 | class MainWidget | 10 | class MainWidget |
| @@ -28,4 +27,4 @@ private: | |||
| 28 | ActorMap m_actors; | 27 | ActorMap m_actors; |
| 29 | }; | 28 | }; |
| 30 | 29 | ||
| 31 | #endif // MAINWIDGET_H \ No newline at end of file | 30 | #endif // MAINWIDGET_H |
diff --git a/pacman-c++/pacman.pro b/pacman-c++/pacman.pro index 6c39033..6282c5d 100644 --- a/pacman-c++/pacman.pro +++ b/pacman-c++/pacman.pro | |||
| @@ -12,11 +12,11 @@ HEADERS += pixmapitem.h \ | |||
| 12 | block.h \ | 12 | block.h \ |
| 13 | client.h \ | 13 | client.h \ |
| 14 | bonuspoint.h \ | 14 | bonuspoint.h \ |
| 15 | mainwidget.h | 15 | mainwidget.h \ |
| 16 | constants.h | ||
| 16 | RESOURCES += pacman.qrc | 17 | RESOURCES += pacman.qrc |
| 17 | 18 | ||
| 18 | OBJECTS_DIR = .obj | 19 | OBJECTS_DIR = .obj |
| 19 | MOC_DIR = .moc | 20 | MOC_DIR = .moc |
| 20 | 21 | ||
| 21 | CONFIG += debug | 22 | CONFIG += debug |
| 22 | |||
diff --git a/pacman-c++/pacman_old.pro b/pacman-c++/pacman_old.pro index 501e924..c44e2c6 100644 --- a/pacman-c++/pacman_old.pro +++ b/pacman-c++/pacman_old.pro | |||
| @@ -7,7 +7,8 @@ SOURCES += pixmapitem.cpp \ | |||
| 7 | HEADERS += pixmapitem.h \ | 7 | HEADERS += pixmapitem.h \ |
| 8 | actor.h \ | 8 | actor.h \ |
| 9 | animationmanager.h \ | 9 | animationmanager.h \ |
| 10 | block.h | 10 | block.h \ |
| 11 | constants.h | ||
| 11 | RESOURCES += pacman.qrc | 12 | RESOURCES += pacman.qrc |
| 12 | 13 | ||
| 13 | OBJECTS_DIR = .obj | 14 | OBJECTS_DIR = .obj |
diff --git a/pacman-c++/sound/die.mp3 b/pacman-c++/sound/die.mp3 deleted file mode 100644 index 14c76bc..0000000 --- a/pacman-c++/sound/die.mp3 +++ /dev/null | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/die.ogg b/pacman-c++/sound/die.ogg new file mode 100644 index 0000000..a698564 --- /dev/null +++ b/pacman-c++/sound/die.ogg | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/eating_cherry.mp3 b/pacman-c++/sound/eating_cherry.mp3 deleted file mode 100644 index d63cb9e..0000000 --- a/pacman-c++/sound/eating_cherry.mp3 +++ /dev/null | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/eating_cherry.ogg b/pacman-c++/sound/eating_cherry.ogg new file mode 100644 index 0000000..daa488e --- /dev/null +++ b/pacman-c++/sound/eating_cherry.ogg | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/intermision.mp3 b/pacman-c++/sound/intermision.mp3 deleted file mode 100644 index 2e89a78..0000000 --- a/pacman-c++/sound/intermision.mp3 +++ /dev/null | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/intermision.ogg b/pacman-c++/sound/intermision.ogg new file mode 100644 index 0000000..0af3567 --- /dev/null +++ b/pacman-c++/sound/intermision.ogg | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/intro.mp3 b/pacman-c++/sound/intro.mp3 deleted file mode 100644 index 7aac980..0000000 --- a/pacman-c++/sound/intro.mp3 +++ /dev/null | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/intro.ogg b/pacman-c++/sound/intro.ogg new file mode 100644 index 0000000..fa8b3e1 --- /dev/null +++ b/pacman-c++/sound/intro.ogg | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/intro.wav b/pacman-c++/sound/intro.wav deleted file mode 100644 index 1fc4231..0000000 --- a/pacman-c++/sound/intro.wav +++ /dev/null | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/siren.mp3 b/pacman-c++/sound/siren.mp3 deleted file mode 100644 index cbe9c4a..0000000 --- a/pacman-c++/sound/siren.mp3 +++ /dev/null | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/siren.ogg b/pacman-c++/sound/siren.ogg new file mode 100644 index 0000000..70a56b2 --- /dev/null +++ b/pacman-c++/sound/siren.ogg | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/waka_waka.mp3 b/pacman-c++/sound/waka_waka.mp3 deleted file mode 100644 index 69791d3..0000000 --- a/pacman-c++/sound/waka_waka.mp3 +++ /dev/null | |||
| Binary files differ | |||
diff --git a/pacman-c++/sound/waka_waka.ogg b/pacman-c++/sound/waka_waka.ogg new file mode 100644 index 0000000..a2b879f --- /dev/null +++ b/pacman-c++/sound/waka_waka.ogg | |||
| Binary files differ | |||
