ef1eac578ca517c751722dafa43ad659494c7637
[ghostsoverboard] / seascene.h
1 #ifndef SEASCENE_H
2 #define SEASCENE_H
3
4 #include <QGraphicsScene>
5
6 class SeaScene : public QGraphicsScene
7 {
8     Q_OBJECT
9 public:
10     explicit SeaScene(QObject *parent = 0);
11
12 signals:
13
14     void allGhostsPicked();
15     void pauseOn();
16     void pauseOff();
17
18 public slots:
19
20     /*! Places all needed items for a level to (re)start.
21     Relies on the scene size to be explicitly set to a a value that will persist troughout play.
22     @param ghosts the number of ghosts to be placed on the map
23     @param rocks the number of rocks to be placed on the map
24     @param octopuses number of octopuses to be placed on the map
25     */
26     void setupMap(int ghosts, int rocks, int octopuses);
27
28     void spreadGhosts(int ghosts);
29
30     void removeGhost(QGraphicsItem * pGhost);
31
32     void ghostsDropped(int ghosts);
33
34     void pause (bool paused);
35
36 protected:
37
38     /*! Gives a pointer to a random position if a free one is found. Otherwise returns NULL.
39         The position is the upper left corner of a free 40x40 pixels slot.
40     */
41
42     QPointF* findRandomFreeSlot();
43
44     const QString ghostImageFilename_;
45     const QString rockImageFilename_;
46     const QString octopusImageFilename_;
47     const QStringList shipImageFilenames_;
48
49     QList<QPointF> freeTiles_;
50
51     int ghostsLeft_;
52
53     QList<QGraphicsItem*> movingItems_;
54
55     bool paused_;
56
57
58
59
60 };
61
62 #endif // SEASCENE_H