Commits

ascetic85 committed 4625011

modify: change the class name begins with an uppercase

Comments (0)

Files changed (24)

 #include "action.h"
 
-action::action() {
+Action::Action() {
 }
 
-action* action::FuncCall(QObject* targeted,const char *slot) {
-    action *newAction = new action;
+Action* Action::FuncCall(QObject* targeted,const char *slot) {
+    Action *newAction = new Action;
     newAction->slotCall = slot;
     newAction->actionTypeV = actionTypeFuncCall;
     newAction->target = targeted;
     return newAction;
 }
 
-action* action::moveTo(float duration,qreal x,qreal y) {
-    action *newAction = new action;
+Action* Action::moveTo(float duration,qreal x,qreal y) {
+    Action *newAction = new Action;
     newAction->actionTypeV = actionTypeMoveTo;
     newAction->endValue[0] = x;
     newAction->endValue[1] = y;
     return newAction;
 }
 
-action* action::moveBy(float duration,qreal x,qreal y) {
-    action *newAction = new action;
+Action* Action::moveBy(float duration,qreal x,qreal y) {
+    Action *newAction = new Action;
     newAction->actionTypeV = actionTypeMoveBy;
     newAction->endValue[0] = x;
     newAction->endValue[1] = y;
 
 }
 
-action* action::scaleTo(float duration,qreal scale) {
-    action *newAction = new action;
+Action* Action::scaleTo(float duration,qreal scale) {
+    Action *newAction = new Action;
     newAction->actionTypeV = actionTypeScaleTo;
     newAction->endValue[0] = scale;
     newAction->animation.setDuration(1000*duration);
 
 }
 
-action* action::scaleBy(float duration,qreal scale) {
-    action *newAction = new action;
+Action* Action::scaleBy(float duration,qreal scale) {
+    Action *newAction = new Action;
     newAction->actionTypeV = actionTypeScaleBy;
     newAction->endValue[0] = scale;
     newAction->animation.setDuration(1000*duration);
 
 }
 
-action* action::fadeTo(float duration,qreal value) {
-    action *newAction = new action;
+Action* Action::fadeTo(float duration,qreal value) {
+    Action *newAction = new Action;
     newAction->actionTypeV = actionTypeFadeTo;
     newAction->endValue[0] = value;
     newAction->animation.setDuration(1000*duration);
 
 }
 
-action* action::fadeBy(float duration,qreal value) {
-    action *newAction = new action;
+Action* Action::fadeBy(float duration,qreal value) {
+    Action *newAction = new Action;
     newAction->actionTypeV = actionTypeFadeBy;
     newAction->endValue[0] = value;
     newAction->animation.setDuration(1000*duration);
 
 }
 
-action* action::rotateTo(float duration,qreal angle) {
-    action *newAction = new action;
+Action* Action::rotateTo(float duration,qreal angle) {
+    Action *newAction = new Action;
     newAction->actionTypeV = actionTypeRotateTo;
     newAction->endValue[0] = angle;
     newAction->animation.setDuration(1000*duration);
 
 }
 
-action* action::rotateBy(float duration,qreal angle) {
-    action *newAction = new action;
+Action* Action::rotateBy(float duration,qreal angle) {
+    Action *newAction = new Action;
     newAction->actionTypeV = actionTypeRotateBy;
     newAction->endValue[0] = angle;
     newAction->animation.setDuration(1000*duration);
 }
 
 
-action* action::easein(action* withAction,int rate) {
+Action* Action::easein(Action* withAction,int rate) {
     if (rate < 0) {
         rate = 0;
         qDebug() << "GameEngine :: easing rate should have a range between 0 and 5, range has been set to 0 for you this time";
     return withAction;
 }
 
-action* action::easeout(action* withAction,int rate) {
+Action* Action::easeout(Action* withAction,int rate) {
     if (rate < 0) {
         rate = 0;
         qDebug() << "GameEngine :: easing rate should have a range between 0 and 5, range has been set to 0 for you this time";
     return withAction;
 }
 
-action* action::easeinout(action* withAction,int rate) {
+Action* Action::easeinout(Action* withAction,int rate) {
     if (rate < 0) {
         rate = 0;
         qDebug() << "GameEngine :: easing rate should have a range between 0 and 5, range has been set to 0 for you this time";
 }
 
 
-void action::setTarget(Node *targeted) {
+void Action::setTarget(Node *targeted) {
     if (actionTypeV == actionTypeFuncCall) {
-        connect(this,SIGNAL(animationFinished(action*)),target,slotCall);
+        connect(this,SIGNAL(animationFinished(Action*)),target,slotCall);
         delete_self();
     }
     else {
 }
 
 
-void action::delete_self() {
+void Action::delete_self() {
         emit animationFinished(this);
 }
 
-void action::stopAnimation() {
+void Action::stopAnimation() {
     animation.stop();
 }
 
 class Node;
 
-class action : public QObject
+class Action : public QObject
 {
     Q_OBJECT
 
 public:
 
-    static action* FuncCall(QObject* targeted,const char* slot);
-    static action* moveTo(float duration,qreal x,qreal y);
-    static action* moveBy(float duration,qreal x,qreal y);
-    static action* scaleTo(float duration,qreal scale);
-    static action* scaleBy(float duration,qreal scale);
-    static action* fadeTo(float duration,qreal value);
-    static action* fadeBy(float duration,qreal value);
-    static action* rotateTo(float duration,qreal angle);
-    static action* rotateBy(float duration,qreal angle);
-    static action* easein(action* withAction,int rate = 4);
-    static action* easeout(action* withAction,int rate = 4);
-    static action* easeinout(action* withAction,int rate = 4);
+    static Action* FuncCall(QObject* targeted,const char* slot);
+    static Action* moveTo(float duration,qreal x,qreal y);
+    static Action* moveBy(float duration,qreal x,qreal y);
+    static Action* scaleTo(float duration,qreal scale);
+    static Action* scaleBy(float duration,qreal scale);
+    static Action* fadeTo(float duration,qreal value);
+    static Action* fadeBy(float duration,qreal value);
+    static Action* rotateTo(float duration,qreal angle);
+    static Action* rotateBy(float duration,qreal angle);
+    static Action* easein(Action* withAction,int rate = 4);
+    static Action* easeout(Action* withAction,int rate = 4);
+    static Action* easeinout(Action* withAction,int rate = 4);
     void setTarget(Node *targeteted);
     void stopAnimation();
 
         actionTypeFuncCall
     };
     QObject *target;
-    action();
+    Action();
     //this is the animation variable
     QPropertyAnimation animation;
     actionType actionTypeV;
 public slots:
     void delete_self();
 signals:
-    void animationFinished(action *finishedAction);
+    void animationFinished(Action *finishedAction);
 };
 
 #endif // ACTION_H

Srcs/audiomanager.cpp

 for more info, please use wav 22050 kHz, 2 channels, signed 16 bit PCM.
 */
 
-GE::AudioOut * audioManager::m_audioOut;
-GE::AudioMixer audioManager::m_mixer;
+GE::AudioOut * AudioManager::m_audioOut;
+GE::AudioMixer AudioManager::m_mixer;
 #ifdef Q_OS_SYMBIAN
 QTimer audioManager::m_audioPullTimer;
 #endif
 
-audioManager::audioManager(QObject *parent) :
+AudioManager::AudioManager(QObject *parent) :
     QObject(parent)
 {
 
 }
 
-void audioManager::playSound(QString path) {
+void AudioManager::playSound(QString path) {
     if (m_audioOut->state() != GE::AudioOut::NotRunning)
     {
         GE::AudioBuffer* m_someSample = GE::AudioBuffer::loadWav(path);
     }
 }
 
-void audioManager::setUpAudioManager() {
+void AudioManager::setUpAudioManager() {
     m_audioOut = new GE::AudioOut(&m_mixer);
 #ifdef Q_OS_SYMBIAN
     m_audioPullTimer.setInterval(5);
     connect(&m_audioPullTimer, SIGNAL(timeout()), m_audioOut, SLOT(tick()));
 #endif
     if (m_audioOut->state() != GE::AudioOut::NotRunning)
-        audioManager::enableSounds(true);
+        AudioManager::enableSounds(true);
 }
 
-void audioManager::enableSounds(bool enable)
+void AudioManager::enableSounds(bool enable)
 {
+    if (m_audioOut->state() == GE::AudioOut::NotRunning)
+        return;
+
     if (enable) {
 #ifdef Q_OS_SYMBIAN
         m_audioPullTimer.start();

Srcs/audiomanager.h

 #include "GEAudioOut.h"
 #include "GEAudioBufferPlayInstance.h"
 
-class audioManager : public QObject
+class AudioManager : public QObject
 {
     Q_OBJECT
 public:
     static void setUpAudioManager();
     static void enableSounds(bool);
 private:
-    explicit audioManager(QObject *parent = 0);
+    explicit AudioManager(QObject *parent = 0);
     static GE::AudioOut *m_audioOut;
     static GE::AudioMixer m_mixer;
 #ifdef Q_OS_SYMBIAN

Srcs/director.cpp

 //        desk.setX(0);
 //        desk.setY(0);
         //set graphics view to screen size
-        scene = new graphicsScene;
+        scene = new GraphicsScene;
         GraphicView->setScene(scene);
         scene->setItemIndexMethod(QGraphicsScene::NoIndex);
         scene->addRect(desk,Qt::NoPen,QColor(0,0,0,255))->setZValue(-1000);
     }
 }
 
-graphicsScene * Director::sharedGraphicScene() {
+GraphicsScene * Director::sharedGraphicScene() {
     return scene;
 }
 
     QTimer frameSchedular;
     static MyFasterGraphicView *GraphicView;
     bool isRuning;
-    graphicsScene *scene;
+    GraphicsScene *scene;
     QGLWidget* openGLwidget;
     int updateLessTimes;
 public:
     void setupDirector();
     QGraphicsView* sharedGraphicView();
-    graphicsScene* sharedGraphicScene();
+    GraphicsScene* sharedGraphicScene();
     static Director* sharedDirector();
     QRect winSizeInPixels();
     void startWithScene(Scene *scene);

Srcs/graphicsscene.cpp

 #include <QGraphicsSceneMouseEvent>
 #include "director.h"
 
-graphicsScene::graphicsScene(QObject *parent) :
+GraphicsScene::GraphicsScene(QObject *parent) :
     QGraphicsScene(parent)
 {
     mouseDown = 0;
     setSceneRect(0,0,Director::sharedDirector()->winSizeInPixels().width(),Director::sharedDirector()->winSizeInPixels().height());
 }
 
-void graphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event) {
+void GraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event) {
     emit signaltouchpressed(event);
     mouseDown = 1;
 }
-void graphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
+void GraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
     if (mouseDown) emit signaltouchmoved(event);
 }
-void graphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
+void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
     emit signaltouchreleased(event);
     mouseDown = 0;
 }

Srcs/graphicsscene.h

 
 #include <QGraphicsScene>
 
-class graphicsScene : public QGraphicsScene
+class GraphicsScene : public QGraphicsScene
 {
     Q_OBJECT
 public:
-    explicit graphicsScene(QObject *parent = 0);
+    explicit GraphicsScene(QObject *parent = 0);
 protected:
     void mousePressEvent(QGraphicsSceneMouseEvent *event);
     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);

Srcs/menuitemimage.cpp

 
 MenuItemImage::MenuItemImage(const QString &filename,const QString &clickedfilename,QObject* target,const char* slot) {
     if (filename.compare(clickedfilename)==0)
-        item = new spriteItem(filename,1,"");
+        item = new SpriteItem(filename,1,"");
     else
-        item = new spriteItem(filename,1,clickedfilename);
+        item = new SpriteItem(filename,1,clickedfilename);
     Node::setGraphicsItem(item);
     Node::setW(item->width());
     Node::setH(item->height());

Srcs/menuitemimage.h

 
 private:
     MenuItemImage(const QString &filename,const QString &clickedfilename,QObject* target = 0,const char* slot = 0);
-    spriteItem* item;
+    SpriteItem* item;
     qreal getwidth();
     qreal getheight();
     bool touchable;

Srcs/menuitemlabel.cpp

             //we have to check if our finger is on our item
             if (contains(event->scenePos())) {
                 stopAction(currAction);
-                currAction = runAction(action::scaleTo(0.075,originalscal*1.5));
+                currAction = runAction(Action::scaleTo(0.075,originalscal*1.5));
                 click = true;
             }
         }
             //we have to check if our finger is on our item
             if (!contains(event->scenePos())) {
                 stopAction(currAction);
-                currAction = runAction(action::scaleTo(0.075,originalscal));
+                currAction = runAction(Action::scaleTo(0.075,originalscal));
                 click = false;
             }
         }
         // our item is clicked, do something
         buttonClicked();
         stopAction(currAction);
-        currAction = runAction(action::scaleTo(0.075,originalscal));
+        currAction = runAction(Action::scaleTo(0.075,originalscal));
     }
     click = false;
 }

Srcs/menuitemlabel.h

     bool touchable;
     bool click;
     bool contains(QPointF point);
-    action* currAction;
+    Action* currAction;
 public slots:
     virtual void touchBegin(QGraphicsSceneMouseEvent *event);
     virtual void touchMove(QGraphicsSceneMouseEvent *event);
 
 
 
-action* Node::runAction(action* actionPara) {
+Action* Node::runAction(Action* actionPara) {
     actionPara->setTarget(this);
     actions.append(actionPara);
     return actionPara;
 }
 
-void Node::actionDone(action* doneAction) {
+void Node::actionDone(Action* doneAction) {
     bool found = false;
     for (int i=0;i<=actions.size()&&!found;i++) {
         if(actions.at(i) == doneAction) {
 }
 
 
-void Node::stopAction(action* stopAction) {
+void Node::stopAction(Action* stopAction) {
     bool found = false;
     for (int i=0;i<actions.size()&&!found;i++) {
         if(actions.at(i) == stopAction) {
 }
 
 void Node::stopAllActions() {
-    action* tempaction;
+    Action* tempaction;
     while (!actions.isEmpty()) {
         tempaction = actions.takeFirst();
         tempaction->stopAnimation();
 #include "sequence.h"
 #include "director.h"
 
-class action;
+class Action;
 class Sequence;
 
 class Node : public QObject
     virtual void setScale ( qreal factor );
     virtual void setZ ( int zValue );
     virtual void setRotation ( qreal rotationDegree );
-    virtual action* runAction(action* actionPara);
+    virtual Action* runAction(Action* actionPara);
     virtual void runSequence(Sequence* sequencePara);
-    virtual void stopAction(action* stopAction);
+    virtual void stopAction(Action* stopAction);
     virtual void stopAllActions();
     void schedualUpdate();
     void unSchedualUpdate();
     void updateChildsOpacity();
 
 public slots:
-    void actionDone(action* doneAction);
+    void actionDone(Action* doneAction);
     virtual void update(double delta);
 public slots:
     void updateMyPos();
     int max_local_z;
     Node *parent;
     QList <Node *> childs;
-    QList <action *> actions;
+    QList <Action *> actions;
     QGraphicsItem *graphicsItem;
     QPointF     realTimePos() const;
     qreal     realTimeScale() const;

Srcs/sequence.cpp

 Sequence::Sequence() {
 }
 
-Sequence* Sequence::sequenceWithActions(action* actionItem,...) {
+Sequence* Sequence::sequenceWithActions(Action* actionItem,...) {
 
     if (actionItem != NULL) {
         Sequence* newSeq = new Sequence;
         newSeq->actionList.append(actionItem);
-        action* addAction;
+        Action* addAction;
         va_list list;
         va_start(list,actionItem);
-        addAction = va_arg(list,action*);
+        addAction = va_arg(list, Action*);
         while (addAction != NULL) {
         newSeq->actionList.append(addAction);
-        addAction = va_arg(list,action*);
+        addAction = va_arg(list, Action*);
         }
         va_end(list);
         return newSeq;
 
 void Sequence::runNextAction() {
     if (!actionList.isEmpty()) {
-        action* nextAction = actionList.takeFirst();
-        connect(nextAction,SIGNAL(animationFinished(action*)),this,SLOT(oneActionisDone()));
+        Action* nextAction = actionList.takeFirst();
+        connect(nextAction,SIGNAL(animationFinished(Action*)),this,SLOT(oneActionisDone()));
         targetNode->runAction(nextAction);
     }
     else {
 #include "action.h"
 
 class Node;
-class action;
+class Action;
 
 class Sequence : public QObject
 {
     Q_OBJECT
 public:
-    static Sequence* sequenceWithActions(action* action,...);
+    static Sequence* sequenceWithActions(Action* Action,...);
     void setTarget(Node *target);
 
 signals:
     void oneActionisDone();
 private:
     explicit Sequence();
-    QList <action*> actionList;
+    QList <Action*> actionList;
     Node *targetNode;
     void runNextAction();
 
 #include "sprite.h"
 
 Sprite::Sprite(const QString &filename) {
-    item = new spriteItem(filename,0,"");
+    item = new SpriteItem(filename,0,"");
     Node::setGraphicsItem(item);
     Node::setW(item->width());
     Node::setH(item->height());
     ~Sprite();
 private:
     Sprite(const QString &filename);
-    spriteItem* item;
+    SpriteItem* item;
     QGraphicsScene* getSharedGraphicScene(){ return 0; }
     void setSharedGraphicScene(QGraphicsScene* graphicscene){ return; }
     qreal getwidth();

Srcs/spriteitem.cpp

 #include "graphicsscene.h"
 #include <QTransform>
 
-spriteItem::spriteItem(const QString &filename,bool button,const QString &clickedFileName) {
+SpriteItem::SpriteItem(const QString &filename,bool button,const QString &clickedFileName) {
     bool load = QPixmapCache::find(filename,&normal);
     if (!load) {
         load = normal.load(filename);
     setEnabled(0);
     setCacheMode(QGraphicsItem::NoCache);
 }
-spriteItem::~spriteItem() {
+SpriteItem::~SpriteItem() {
 
 }
 
-qreal spriteItem::height() {
+qreal SpriteItem::height() {
     return this->pixmap().height();
 }
-qreal spriteItem::width() {
+qreal SpriteItem::width() {
     return this->pixmap().width();
 }
 
 
-void spriteItem::setParent(MenuItem *parent) {
+void SpriteItem::setParent(MenuItem *parent) {
     parentMenuItem = parent;
 }
 

Srcs/spriteitem.h

 #include <QPixmapCache>
 #include "menuitem.h"
 
-class spriteItem : public QGraphicsPixmapItem
+class SpriteItem : public QGraphicsPixmapItem
 {
 public:
-    spriteItem(const QString &filename, bool button, const QString &clickedFileName);
-    ~spriteItem();
+    SpriteItem(const QString &filename, bool button, const QString &clickedFileName);
+    ~SpriteItem();
     qreal width();
     qreal height();
     void setClickedImage(){ setPixmap(clicked);}

Srcs/transitionscene.cpp

 void transitionScene::setCurrScene(Scene *scene) {
     currScene = scene;
     currScene->mainLayer->onExitTransitionDidStart();
-    action* firststep = action::fadeTo(dur/2,0);
-    action* gotostep2 = action::FuncCall(this,SLOT(FadeTransition_half_done()));
+    Action* firststep = Action::fadeTo(dur/2,0);
+    Action* gotostep2 = Action::FuncCall(this,SLOT(FadeTransition_half_done()));
     scene->runSequence(Sequence::sequenceWithActions(firststep,gotostep2,NULL));
 }
 
 void transitionScene::FadeTransition_half_done() {
-    action* firststep = action::fadeTo(dur/2,origFade);
-    action* gotostep3 = action::FuncCall(this,SLOT(transition_done()));
+    Action* firststep = Action::fadeTo(dur/2,origFade);
+    Action* gotostep3 = Action::FuncCall(this,SLOT(transition_done()));
     nextScene->runSequence(Sequence::sequenceWithActions(firststep,gotostep3,NULL));
 }
 void transitionScene::transition_done() {
     FileUtils::shareFileUtils()->setResourceDirectory("resource");
 
     //set up audio playback
-    audioManager::setUpAudioManager();
+    AudioManager::setUpAudioManager();
     //here is the second main_menu to change
-    Director::sharedDirector()->startWithScene(main_menu::scene());
+    Director::sharedDirector()->startWithScene(MainMenu::scene());
     return app.exec();
 }
 #include "main_menu.h"
 
-Scene* main_menu::scene() {
+Scene* MainMenu::scene() {
     Scene *scene = Scene::node();
-    main_menu* layer = new main_menu;
+    MainMenu* layer = new MainMenu;
     scene->addChild(layer);
     return scene;
 }
 
 
-main_menu::main_menu()
+MainMenu::MainMenu()
 {
     qDebug() << Q_FUNC_INFO;
     //taking screen size, saving it to variable called winSize
     animation();
 }
 
-void main_menu::animation() {
+void MainMenu::animation() {
     if (counter < cards.size()) {
-        cards.at(counter)->runSequence(Sequence::sequenceWithActions(action::easeinout(action::moveBy(0.5,300,200)),action::FuncCall(this,SLOT(animation())),NULL));
-        cards.at(counter)->runAction(action::easeinout(action::rotateBy(0.5,360)));
-        audioManager::playSound("alert.wav");
-        audioManager::playSound("play_card.wav");
+        cards.at(counter)->runSequence(Sequence::sequenceWithActions(Action::easeinout(Action::moveBy(0.5,300,200)),Action::FuncCall(this,SLOT(animation())),NULL));
+        cards.at(counter)->runAction(Action::easeinout(Action::rotateBy(0.5,360)));
+        AudioManager::playSound("alert.wav");
+        AudioManager::playSound("play_card.wav");
         counter++;
     }
 }
 
-void main_menu::update(double delta) {
+void MainMenu::update(double delta) {
 //    runAction(action::rotateBy(4,360));
-    runAction(action::easeinout(action::scaleTo(1,1)));
-    runAction(action::fadeTo(1,100));
+    runAction(Action::easeinout(Action::scaleTo(1,1)));
+    runAction(Action::fadeTo(1,100));
     unSchedualUpdate();
 }
 
 
-void main_menu::onEnterTransitionDidStart() {
+void MainMenu::onEnterTransitionDidStart() {
     qDebug() << Q_FUNC_INFO;
 }
 
-void main_menu::onEnterTransitionDidFinish() {
+void MainMenu::onEnterTransitionDidFinish() {
     qDebug() << Q_FUNC_INFO;
 }
 
-void main_menu::onExitTransitionDidStart() {
+void MainMenu::onExitTransitionDidStart() {
     qDebug() << Q_FUNC_INFO;
 }
 
-void main_menu::onExitTransitionDidFinish() {
+void MainMenu::onExitTransitionDidFinish() {
     qDebug() << Q_FUNC_INFO;
 }
 
 #include "Srcs/game_engine.h"
 #include <QList>
 
-class main_menu : public Layer
+class MainMenu : public Layer
 {
     Q_OBJECT
 
 public:
     static Scene* scene();
-    explicit main_menu();
+    explicit MainMenu();
 //    void onEnterTransitionDidFinish();
 //    void onExitTransitionDidFinish();
     void onEnterTransitionDidStart();