summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/errorstate/tank.h
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-04-24 15:35:35 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-04-24 15:41:43 (GMT)
commitc3290381a1dba7971dd70b7220a71e6feceb3f4c (patch)
tree136f68ab9da00b4571118f18875b3d53928eee46 /examples/statemachine/errorstate/tank.h
parentdfe6974c1e7103ad46fa1162d7c9fd6a426894b7 (diff)
downloadQt-c3290381a1dba7971dd70b7220a71e6feceb3f4c.zip
Qt-c3290381a1dba7971dd70b7220a71e6feceb3f4c.tar.gz
Qt-c3290381a1dba7971dd70b7220a71e6feceb3f4c.tar.bz2
Unfinished tank AI game. The idea is that you plug in AIs for the tanks, and
one such plugin will have a run time error, so the game server needs to use errorState for handling errors.
Diffstat (limited to 'examples/statemachine/errorstate/tank.h')
-rw-r--r--examples/statemachine/errorstate/tank.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/statemachine/errorstate/tank.h b/examples/statemachine/errorstate/tank.h
new file mode 100644
index 0000000..9def6df
--- /dev/null
+++ b/examples/statemachine/errorstate/tank.h
@@ -0,0 +1,31 @@
+#ifndef TANK_H
+#define TANK_H
+
+#include <QObject>
+#include <QLineF>
+
+class Tank: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal direction READ direction)
+ Q_PROPERTY(qreal distanceToObstacle READ distanceToObstacle)
+public:
+ Tank(QObject *parent = 0) : QObject(parent) {}
+
+ virtual qreal direction() const = 0;
+ virtual qreal distanceToObstacle() const = 0;
+
+signals:
+ void collision(const QLineF &collidedLine) const;
+ void actionCompleted();
+ void tankSpotted(qreal otherTankDirection, qreal distance);
+
+public slots:
+ virtual void moveForwards(qreal length) = 0;
+ virtual void moveBackwards(qreal length) = 0;
+ virtual void turn(qreal newDirection) = 0;
+ virtual void stop() = 0;
+ virtual void fireCannon(qreal distance) = 0;
+};
+
+#endif