summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/tankgame/gameitem.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/statemachine/tankgame/gameitem.h')
-rw-r--r--examples/statemachine/tankgame/gameitem.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/statemachine/tankgame/gameitem.h b/examples/statemachine/tankgame/gameitem.h
new file mode 100644
index 0000000..43b8785
--- /dev/null
+++ b/examples/statemachine/tankgame/gameitem.h
@@ -0,0 +1,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