Bigger quit and about menu buttons and about box icon back
[ghostsoverboard] / seascene.h
1 /**************************************************************************
2         Ghosts Overboard - a game for Maemo 5
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
33 class SeaScene : public QGraphicsScene
34 {
35     Q_OBJECT
36 public:
37     explicit SeaScene(QObject *parent = 0);
38
39 signals:
40
41     void allGhostsPicked();
42     void pauseOn();
43     void pauseOff();
44     void vibrationActivated(bool on);
45
46 public slots:
47
48     /*! Places all needed items for a level to (re)start.
49     Relies on the scene size to be explicitly set to a a value that will persist troughout play.
50     @param ghosts the number of ghosts to be placed on the map
51     @param rocks the number of rocks to be placed on the map
52     @param octopuses number of octopuses to be placed on the map
53     */
54     void setupMap(int ghosts, int rocks, int octopuses, int octopusSpeed);
55
56     void setupMap(Level level);
57
58     void spreadGhosts(int ghosts);
59
60     void removeGhost(QGraphicsItem * pGhost);
61
62     void ghostsDropped(int ghosts);
63
64     void pause (bool paused);
65
66     void vibrationActivate(bool);
67
68     void handleScreenTapped();
69
70     void about();
71
72     void restartLevel();
73
74     void nextLevel();
75
76     void restartGame();
77
78     void forcePause();
79
80     void softContinue();
81
82
83
84 protected:
85
86     /*! Gives a pointer to a random position if a free one is found. Otherwise returns NULL.
87         The position is the upper left corner of a free 40x40 pixels slot.
88     */
89
90     QPointF* findRandomFreeSlot();
91
92     void createMenuItems();
93     void prepareForMenu(QGraphicsItem * pItem);
94
95     const QString ghostImageFilename_;
96     const QString rockImageFilename_;
97     const QString octopusImageFilename_;
98     const QStringList shipImageFilenames_;
99
100     QList<QPointF> freeTiles_;
101
102     int ghostsLeft_;
103
104     QList<QGraphicsItem*> movingItems_;
105
106     bool paused_;
107
108     ScreenLitKeeper screenLitKeeper_;
109
110
111     int menuItemCount_;
112
113     QGraphicsTextItem * pPausetextItem_;
114
115     QGraphicsTextItem * pRestartLevelItem_;
116     QGraphicsTextItem * pRestartGameItem_;
117     QGraphicsTextItem * pSettingsItem_;
118     QGraphicsTextItem * pAboutItem_;
119     QGraphicsTextItem * pQuitItem_;
120
121     QList<Level> levelList_;
122
123     int currentLevel_;
124
125
126     QAction* pVibrateAction_;
127
128     QAction* pPauseAction_;
129
130     bool pauseForced_;
131
132
133 };
134
135 #endif // SEASCENE_H