Collision detection works
[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     void setBoundaries(QRectF boundaryrect);
25
26     /*! sets what QGraphicsItems to treat as obstacles not to move on top of
27         @param key The key to be used with QGraphicsItem::data() to find the correct value to compare
28         @param values The values received from QGraphicsItem::data() to treat as obstacles
29     */
30     void setObstacles(int key, QList<QVariant> values);
31
32
33 private:
34
35     QRotationSensor rotationSensor_;
36
37     QRectF boundaryrect_;
38
39     int obstacleKey_;
40     QList<QVariant> obstacleValues_;
41
42 };
43
44 #endif // ORIENTATIONCONTROLLEDGRAPHICSPIXMAPOBJECT_H