X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=seascene.cpp;fp=seascene.cpp;h=a00b2c0a827c84c2bac8feb89e220a91ac18c460;hb=fc59090da28a9adeb50ddefc25aac843c4dfff99;hp=b7f921110fa4dabece2c034d91e641808046a32a;hpb=7b6d7bf80f942b862b224227891bf586f4a65720;p=ghostsoverboard diff --git a/seascene.cpp b/seascene.cpp index b7f9211..a00b2c0 100644 --- a/seascene.cpp +++ b/seascene.cpp @@ -43,6 +43,9 @@ const QString octopusImageFilename_= ":/pix/tursas.png"; SeaScene::SeaScene(QObject *parent) : QGraphicsScene(parent) { + + setItemPointersNull(); + paused_ = false; screenLitKeeper_.keepScreenLit(true); @@ -100,8 +103,12 @@ void SeaScene::setupMap(int ghosts, int rocks, int octopuses, int octopusSpeed) clear(); + setItemPointersNull(); + createMenuItems(); + createAboutBoxItems(); + createVictoryItems(); @@ -391,6 +398,18 @@ void SeaScene::handleScreenTapped() return; } + //If the game is paused and about box is shown, close it and show the pause text and menu again + + if(pAboutBoxItem_) + { + if(pAboutBoxItem_->isVisible()) + { + pAboutBoxItem_->hide(); + pPausetextItem_->show(); + } + } + + //If the game is paused, check if the victory item is being shown if(pVictoryCongratulationsItem_) { @@ -563,16 +582,8 @@ void SeaScene::prepareForMenu(QGraphicsItem * pItem) void SeaScene::about() { - QMessageBox::about(NULL, tr("About %1").arg(QApplication::applicationName()), - tr("Version %1" - "
Copyright 2011 Heli Hyvättinen" - "
License: General Public License v2" - "
Bug Reports: https://bugs.maemo.org/ "
- "enter_bug.cgi?product=Ghosts%20Overboard"
- ).arg(QApplication::applicationVersion()));
-
-
-
+ pPausetextItem_->hide();
+ pAboutBoxItem_->show();
}
@@ -634,6 +645,7 @@ void SeaScene::softContinue()
pause(pPauseAction_->isChecked());
}
+
void SeaScene::createVictoryItems()
{
pVictoryCongratulationsItem_ = new QGraphicsTextItem;
@@ -654,5 +666,35 @@ void SeaScene::createVictoryItems()
" Copyright 2011 Heli Hyvättinen"
+ " License: General Public License v2"
+ " Bug Reports:
Tap to play again ");
pTextItem->setPos(-50,100);
pTextItem->setZValue(1000);
+}
+void SeaScene::createAboutBoxItems()
+{
+ pAboutBoxItem_ = new QGraphicsTextItem;
+ addItem(pAboutBoxItem_);
+ pAboutBoxItem_->setPos(25,50);
+ pAboutBoxItem_->setZValue(1000);
+ pAboutBoxItem_->hide();
+
+ pAboutBoxItem_->setHtml(tr(""
+ "%1
Version %2"
+ "
https://bugs.maemo.org/ "
+ "enter_bug.cgi?product=Ghosts%20Overboard"
+ ).arg(QApplication::applicationName(),QApplication::applicationVersion()));
+
+}
+
+void SeaScene::setItemPointersNull()
+{
+ pPausetextItem_ = NULL;
+ pRestartLevelItem_ = NULL;
+ pRestartGameItem_ = NULL;
+ pSettingsItem_ = NULL;
+ pAboutItem_ = NULL;
+ pQuitItem_ = NULL ;
+ pMinimizeItem_ = NULL;
+
+ pAboutBoxItem_ = NULL;
}