Separated actual collision detection into subclass Ship
[ghostsoverboard] / orientationcontrolledgraphicspixmapobject.h
1 #ifndef ORIENTATIONCONTROLLEDGRAPHICSPIXMAPOBJECT_H
2 #define ORIENTATIONCONTROLLEDGRAPHICSPIXMAPOBJECT_H
3
4 #include <QGraphicsPixmapItem>
5 #include <QRotationSensor>
6
7 QTM_USE_NAMESPACE
8
9
10
11 class OrientationControlledGraphicsPixmapObject : public QObject, public QGraphicsPixmapItem
12 {
13     Q_OBJECT
14 public:
15 //    explicit OrientationControlledGraphicsPixmapObject(QGraphicsItem *parent = 0);
16     explicit OrientationControlledGraphicsPixmapObject(QPixmap pixmap = 0, QGraphicsItem *parent = 0);
17
18 signals:
19
20 public slots:
21     void startMoving();
22     void stopMoving();
23     void readRotationSensor();
24
25
26 protected:
27     /*! Returns true if the new position is to be maintained and false if a revert back to the old position is needed.
28         This stub always just returns true. Actual collision handling is left for subclasses to implement (by reimplementing this function).
29 */
30     virtual bool handleCollisions();
31
32 private:
33
34     QRotationSensor rotationSensor_;
35
36
37
38
39 };
40
41 #endif // ORIENTATIONCONTROLLEDGRAPHICSPIXMAPOBJECT_H