a296710c1ac279c7be3aedd585e2c98bfec44a23
[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
16 public slots:
17
18     /*! Places all needed items for a level to (re)start.
19     Relies on the scene size to be explicitly set to a a value that will persist troughout play.
20     @param ghosts the number of ghosts to be placed on the map
21     @param rocks the number of rocks to be placed on the map
22     @param octopuses number of octopuses to be placed on the map
23     */
24     void setupMap(int ghosts, int rocks, int octopuses);
25
26     void spreadGhosts(int ghosts);
27
28     void removeGhost(QGraphicsItem * pGhost);
29
30     void ghostsDropped(int ghosts);
31
32 protected:
33
34     /*! Gives a pointer to a random position if a free one is found. Otherwise returns NULL.
35         The position is the upper left corner of a free 40x40 pixels slot.
36     */
37
38     QPointF* findRandomFreeSlot();
39
40     const QString ghostImageFilename_;
41     const QString rockImageFilename_;
42     const QString octopusImageFilename_;
43     const QStringList shipImageFilenames_;
44
45     QList<QPointF> freeTiles_;
46
47     int ghostsLeft_;
48
49     QList<QGraphicsItem*> movingItems_;
50
51
52
53
54 };
55
56 #endif // SEASCENE_H