summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/tankgame/gameitem.h
blob: 43b8785f16027c74bdb26cba15f4084412f4f9bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef GAMEITEM_H
#define GAMEITEM_H

#include <QGraphicsItem>

class QLineF;
class GameItem: public QObject, public QGraphicsItem
{
    Q_OBJECT
public:
    enum { Type = UserType + 1 };
    int type() const { return Type; }

    GameItem(QObject *parent = 0);

    virtual void idle(qreal elapsed) = 0;

protected:
    QPointF tryMove(const QPointF &requestedPosition, QLineF *collidedLine = 0, 
        QGraphicsItem **collidedItem = 0) const;
};

#endif