1 /**************************************************************************
2 Ghosts Overboard - a game for Maemo 5
4 Copyright (C) 2011 Heli Hyvättinen
6 This file is part of Ghosts Overboard
8 Ghosts Overboard is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 **************************************************************************/
27 #include <QGraphicsScene>
28 #include<QGraphicsItemGroup>
29 #include "screenlitkeeper.h"
34 class SeaScene : public QGraphicsScene
38 explicit SeaScene(QObject *parent = 0);
42 void allGhostsPicked();
45 void vibrationActivated(bool on);
46 void minimizeRequested();
47 void fullscreenRequested();
51 /*! Places all needed items for a level to (re)start.
52 Relies on the scene size to be explicitly set to a a value that will persist troughout play.
53 @param ghosts the number of ghosts to be placed on the map
54 @param rocks the number of rocks to be placed on the map
55 @param octopuses number of octopuses to be placed on the map
57 void setupMap(int ghosts, int rocks, int octopuses, int octopusSpeed);
59 void setupMap(Level level);
61 void spreadGhosts(int ghosts);
63 void removeGhost(QGraphicsItem * pGhost);
65 void ghostsDropped(int ghosts);
67 void pause (bool paused);
69 void vibrationActivate(bool);
71 void handleScreenTapped();
85 void createAboutBoxItems();
87 void createVictoryItems();
89 void setItemPointersNull();
95 /*! Gives a pointer to a random position if a free one is found. Otherwise returns NULL.
96 The position is the upper left corner of a free 40x40 pixels slot.
99 QPointF* findRandomFreeSlot();
101 void createMenuItems();
102 void prepareForMenu(QGraphicsItem * pItem);
104 const QString ghostImageFilename_;
105 const QString rockImageFilename_;
106 const QString octopusImageFilename_;
107 const QStringList shipImageFilenames_;
109 QList<QPointF> freeTiles_;
113 QList<QGraphicsItem*> movingItems_;
117 ScreenLitKeeper screenLitKeeper_;
122 QGraphicsTextItem * pPausetextItem_;
124 QGraphicsTextItem * pRestartLevelItem_;
125 QGraphicsTextItem * pRestartGameItem_;
126 QGraphicsTextItem * pSettingsItem_;
127 QGraphicsTextItem * pAboutItem_;
128 QGraphicsTextItem * pQuitItem_;
129 QGraphicsTextItem * pMinimizeItem_;
131 QGraphicsTextItem * pVictoryCongratulationsItem_;
132 QGraphicsTextItem * pAboutBoxItem_;
134 QList<Level> levelList_;
139 QAction* pVibrateAction_;
141 QAction* pPauseAction_;
145 QTimer autopauseTimer;