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