Octopuses stay on the screen now
[ghostsoverboard] / timercontrolledtursas.h
1 #ifndef TIMERCONTROLLEDTURSAS_H
2 #define TIMERCONTROLLEDTURSAS_H
3
4 #include <QObject>
5 #include <QGraphicsPixmapItem>
6 #include <QTimer>
7
8 class TimerControlledTursas : public QObject, public QGraphicsPixmapItem
9 {
10     Q_OBJECT
11 public:
12     explicit TimerControlledTursas(QPixmap pixmap = QPixmap(), int speed = 1, QGraphicsItem *parent = 0);
13
14
15 signals:
16
17 public slots:
18
19     void startMoving();
20     void stopMoving();
21
22     /*! Intended to be used internally by connecting to a timer
23       */
24     void move();
25
26     /*! Sets the movement speed of the item
27       @param speed given in pixels per second
28       */
29     void setSpeed(int speed);
30
31
32  protected:
33
34     void changeDirection();
35
36     QTimer timer_;
37
38     enum direction {N, NE, E, SE, S, SW, W, NW};
39
40     direction direction_;
41
42 };
43
44 #endif // TIMERCONTROLLEDTURSAS_H