From c910e2267d3af30f10b9c659b2d9f9349c596e0d Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 12 Apr 2011 21:53:36 +0200 Subject: remove animationmanager (for now?) --- pacman-c++/actor.cpp | 25 +++--------------- pacman-c++/animationmanager.cpp | 56 ----------------------------------------- pacman-c++/animationmanager.h | 33 ------------------------ pacman-c++/pacman.pro | 2 -- pacman-c++/pacman.server.pro | 2 -- 5 files changed, 3 insertions(+), 115 deletions(-) delete mode 100644 pacman-c++/animationmanager.cpp delete mode 100644 pacman-c++/animationmanager.h (limited to 'pacman-c++') diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp index 7b77851..6ca981c 100644 --- a/pacman-c++/actor.cpp +++ b/pacman-c++/actor.cpp @@ -1,5 +1,4 @@ #include "actor.h" -#include "animationmanager.h" #include #include #include @@ -122,7 +121,7 @@ void Actor::move(Actor::Movement direction) if (Constants::server) return moveByServer(direction); - /* stop current animation */ + /* stop current animation if direction changed */ if (direction != m_direction) { /* hide all pictures */ @@ -130,10 +129,7 @@ void Actor::move(Actor::Movement direction) m_images.at(i)->setVisible(false); if (m_eating[m_direction] != NULL) - { m_eating[m_direction]->stop(); - //AnimationManager::self()->unregisterAnimation(m_eating[m_direction]); - } } QPointF endpos(0, 0); @@ -165,7 +161,7 @@ void Actor::move(Actor::Movement direction) } setPos(pos() + endpos); - /* start new animation */ + /* start new animation if direction changed */ if (direction != m_direction) { if (direction == Actor::None) @@ -174,24 +170,9 @@ void Actor::move(Actor::Movement direction) m_eating[direction]->start(); } + /* start moving animation */ if (direction != Actor::None) - { - //if (m_local && m_player->isWorking() && m_player->state() != Phonon::PlayingState) - // m_player->play(); m_moving->start(); - } - else if (direction != m_direction) - { - //if (m_local && m_player->isWorking() && m_player->state() != Phonon::PausedState) - // m_player->pause(); - } - - if (direction == Actor::None) - { - //TODO - qDebug() << "pause"; - //m_wakaPlayer->pause(); - } m_direction = direction; } diff --git a/pacman-c++/animationmanager.cpp b/pacman-c++/animationmanager.cpp deleted file mode 100644 index 3880b08..0000000 --- a/pacman-c++/animationmanager.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "animationmanager.h" -#include -#include - -// the universe's only animation manager -AnimationManager *AnimationManager::instance = NULL; - -AnimationManager::AnimationManager() -{ -} - -AnimationManager *AnimationManager::self() -{ - if (!instance) - instance = new AnimationManager; - return instance; -} - -void AnimationManager::registerAnimation(QAbstractAnimation *anim) -{ - QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); - animations.append(anim); -} - -void AnimationManager::unregisterAnimation_helper(QObject *obj) -{ - unregisterAnimation(static_cast(obj)); -} - -void AnimationManager::unregisterAnimation(QAbstractAnimation *anim) -{ - QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*))); - animations.removeAll(anim); -} - -void AnimationManager::unregisterAllAnimations() -{ - animations.clear(); -} - -void AnimationManager::pauseAll() -{ - foreach (QAbstractAnimation* animation, animations) - { - if (animation->state() == QAbstractAnimation::Running) - animation->pause(); - } -} -void AnimationManager::resumeAll() -{ - foreach (QAbstractAnimation* animation, animations) - { - if (animation->state() == QAbstractAnimation::Paused) - animation->resume(); - } -} diff --git a/pacman-c++/animationmanager.h b/pacman-c++/animationmanager.h deleted file mode 100644 index 408395b..0000000 --- a/pacman-c++/animationmanager.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef ANIMATIONMANAGER_H -#define ANIMATIONMANAGER_H - -#include - -QT_BEGIN_NAMESPACE -class QAbstractAnimation; -QT_END_NAMESPACE - -class AnimationManager - : public QObject -{ - Q_OBJECT -public: - AnimationManager(); - void registerAnimation(QAbstractAnimation *anim); - void unregisterAnimation(QAbstractAnimation *anim); - void unregisterAllAnimations(); - static AnimationManager *self(); - -public slots: - void pauseAll(); - void resumeAll(); - -private slots: - void unregisterAnimation_helper(QObject *obj); - -private: - static AnimationManager *instance; - QList animations; -}; - -#endif // ANIMATIONMANAGER_H diff --git a/pacman-c++/pacman.pro b/pacman-c++/pacman.pro index f8beb4a..b5492cd 100644 --- a/pacman-c++/pacman.pro +++ b/pacman-c++/pacman.pro @@ -5,7 +5,6 @@ VERSION = 0.1 QT += phonon network SOURCES += pixmapitem.cpp \ actor.cpp \ - animationmanager.cpp \ block.cpp \ client.cpp \ bonuspoint.cpp \ @@ -18,7 +17,6 @@ SOURCES += pixmapitem.cpp \ gameentity.cpp HEADERS += pixmapitem.h \ actor.h \ - animationmanager.h \ block.h \ client.h \ bonuspoint.h \ diff --git a/pacman-c++/pacman.server.pro b/pacman-c++/pacman.server.pro index 075f44d..2224d9a 100644 --- a/pacman-c++/pacman.server.pro +++ b/pacman-c++/pacman.server.pro @@ -8,7 +8,6 @@ TARGET = pacman-server QT += phonon network SOURCES += pixmapitem.cpp \ actor.cpp \ - animationmanager.cpp \ block.cpp \ server.cpp \ bonuspoint.cpp \ @@ -20,7 +19,6 @@ SOURCES += pixmapitem.cpp \ gameentity.cpp HEADERS += pixmapitem.h \ actor.h \ - animationmanager.h \ block.h \ server.h \ bonuspoint.h \ -- cgit v1.2.3