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

#include <QGraphicsItem>

QT_BEGIN_NAMESPACE
class QLineF;
QT_END_NAMESPACE
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