From d91ab1f4c9ec54da4f898933720c0bb335c477c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Heli=20Hyv=C3=A4ttinen?= Date: Mon, 26 Sep 2011 14:36:25 +0300 Subject: [PATCH] Added "Choose levelset" to menu. Does not work yet. Shows up a list of available levels, but tapping on the list does not work, it just unpauses the game, the list does not even disappear. The list is not even separated to multiple items for selecting. "Quit" no longer fits the screen. Conflicts: seascene.cpp seascene.h --- levelset.cpp | 5 +++++ seascene.cpp | 32 ++++++++++++++++++++++++++++++++ seascene.h | 5 +++++ 3 files changed, 42 insertions(+) diff --git a/levelset.cpp b/levelset.cpp index 66e0bfe..2cb04b8 100644 --- a/levelset.cpp +++ b/levelset.cpp @@ -48,6 +48,11 @@ bool Levelset::isValid() return true; } +QString Levelset::getName() +{ + return name_; +} + int Levelset::numberOfLevels() { return levels_.length(); diff --git a/seascene.cpp b/seascene.cpp index 74e2d1f..48ca621 100644 --- a/seascene.cpp +++ b/seascene.cpp @@ -140,6 +140,8 @@ void SeaScene::setupMap(int ghosts, int rocks, int octopuses, int octopusSpeed) createAboutBoxItems(); + createSelectLevelsetFromListItems(); + createVictoryItems(); createLevelCompletedItems(); @@ -547,6 +549,12 @@ void SeaScene::handleScreenTapped() { qApp->quit(); } + else if (pItem == pChooseLevelsetItem_) + { + pPausetextItem_->hide(); + pSelectLevelsetFromListItem_->show(); + } + } @@ -578,6 +586,10 @@ void SeaScene::createMenuItems() pRestartLevelItem_->setHtml(tr("Restart
level").prepend(menufonthtml)); prepareForMenu(pRestartLevelItem_); + pChooseLevelsetItem_ = new QGraphicsTextItem; + pChooseLevelsetItem_->setHtml(tr("Choose
levelset").prepend(menufonthtml)); + prepareForMenu(pChooseLevelsetItem_); + pSettingsItem_ = new QGraphicsTextItem; QString vibraText(tr("Turn vibration
effects ")); QString statusText; @@ -801,10 +813,12 @@ void SeaScene::setItemPointersNull() pAboutItem_ = NULL; pQuitItem_ = NULL ; pMinimizeItem_ = NULL; + pChooseLevelsetItem_ = NULL; pAboutBoxItem_ = NULL; pVictoryCongratulationsItem_ = NULL; pLevelCompletedItem_ = NULL; + pVictoryCongratulationsItem_ = NULL; pVictoryScoreItem_ = NULL; @@ -858,4 +872,22 @@ void SeaScene::createLevelCompletedItems() pTapForNextLevelItem->setZValue(1000); pTapForNextLevelItem->setHtml("Tap to start the next level"); + +void SeaScene::createSelectLevelsetFromListItems() +{ + pSelectLevelsetFromListItem_ = new QGraphicsTextItem; + addItem(pSelectLevelsetFromListItem_); + pSelectLevelsetFromListItem_->setPos(40,80); + pSelectLevelsetFromListItem_->setZValue(1000); + pSelectLevelsetFromListItem_->hide(); + + QString list (""); + + foreach (Levelset set, availableLevelsets_) + { + list.append(set.getName()); + list.append("
"); + } + + pSelectLevelsetFromListItem_->setHtml(list); } diff --git a/seascene.h b/seascene.h index fefdfc0..7e6c442 100644 --- a/seascene.h +++ b/seascene.h @@ -111,6 +111,7 @@ protected: void createAboutBoxItems(); void createVictoryItems(); void createLevelCompletedItems(); + void createSelectLevelsetFromListItems(); const QString ghostImageFilename_; const QString rockImageFilename_; @@ -137,13 +138,17 @@ protected: QGraphicsTextItem * pAboutItem_; QGraphicsTextItem * pQuitItem_; QGraphicsTextItem * pMinimizeItem_; + QGraphicsTextItem * pChooseLevelsetItem_; QGraphicsTextItem * pVictoryCongratulationsItem_; QGraphicsTextItem * pVictoryScoreItem_; QGraphicsTextItem * pAboutBoxItem_; + QGraphicsTextItem * pVictoryCongratulationsItem_; QGraphicsTextItem * pLevelCompletedItem_; + QGraphicsTextItem * pSelectLevelsetFromListItem_; + QList availableLevelsets_; Levelset levelset_; -- 1.7.9.5