Changed some comments
[ghostsoverboard] / seascene.h
1 /**************************************************************************
2         Ghosts Overboard - a game for 'Meego 1.2 Harmattan'
3
4         Copyright (C) 2011  Heli Hyvättinen
5
6         This file is part of Ghosts Overboard
7
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.
12
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.
17
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/>.
20
21 **************************************************************************/
22
23
24 #ifndef SEASCENE_H
25 #define SEASCENE_H
26
27 #include <QGraphicsScene>
28 #include<QGraphicsItemGroup>
29 #include "screenlitkeeper.h"
30 #include "level.h"
31 #include <QAction>
32 #include <QTimer>
33
34 class SeaScene : public QGraphicsScene
35 {
36     Q_OBJECT
37 public:
38     explicit SeaScene(QObject *parent = 0);
39
40 signals:
41
42     void allGhostsPicked();
43     void pauseOn();
44     void pauseOff();
45     void vibrationActivated(bool on);
46
47 public slots:
48
49     /*! Places all needed items for a level to (re)start.
50     Relies on the scene size to be explicitly set to a a value that will persist troughout play.
51     @param ghosts the number of ghosts to be placed on the map
52     @param rocks the number of rocks to be placed on the map
53     @param octopuses number of octopuses to be placed on the map
54     */
55     void setupMap(int ghosts, int rocks, int octopuses, int octopusSpeed);
56
57     void setupMap(Level level);
58
59     void spreadGhosts(int ghosts);
60
61     void removeGhost(QGraphicsItem * pGhost);
62
63     void ghostsDropped(int ghosts);
64
65     void pause (bool paused);
66
67     void vibrationActivate(bool);
68
69     void handleScreenTapped();
70
71     void about();
72
73     void restartLevel();
74
75     void nextLevel();
76
77     void restartGame();
78
79     void forcePause();
80
81     void softContinue();
82
83     void createAboutBoxItems();
84     void createVictoryItems();
85
86     void setItemPointersNull();
87
88
89
90 protected:
91
92     /*! Gives a pointer to a random position if a free one is found. Otherwise returns NULL.
93         The position is the upper left corner of a free 40x40 pixels slot.
94     */
95
96     QPointF* findRandomFreeSlot();
97
98     void createMenuItems();
99     void prepareForMenu(QGraphicsItem * pItem);
100
101     const QString ghostImageFilename_;
102     const QString rockImageFilename_;
103     const QString octopusImageFilename_;
104     const QStringList shipImageFilenames_;
105
106     QList<QPointF> freeTiles_;
107
108     int ghostsLeft_;
109
110     QList<QGraphicsItem*> movingItems_;
111
112     bool paused_;
113
114     ScreenLitKeeper screenLitKeeper_;
115
116
117     int menuItemCount_;
118
119     QGraphicsTextItem * pPausetextItem_;
120
121     QGraphicsTextItem * pRestartLevelItem_;
122     QGraphicsTextItem * pRestartGameItem_;
123     QGraphicsTextItem * pSettingsItem_;
124     QGraphicsTextItem * pAboutItem_;
125     QGraphicsTextItem * pQuitItem_;
126
127     QGraphicsTextItem * pAboutBoxItem_;
128     QGraphicsTextItem * pVictoryCongratulationsItem_;
129
130     QList<Level> levelList_;
131
132     int currentLevel_;
133
134
135     QAction* pVibrateAction_;
136
137     QAction* pPauseAction_;
138
139     bool pauseForced_;
140
141     QTimer autopauseTimer;
142
143 };
144
145 #endif // SEASCENE_H