-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameobject.h
49 lines (37 loc) · 903 Bytes
/
gameobject.h
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef GAMEOBJECT_H
#define GAMEOBJECT_H
#include <QObject>
#include <QUrl>
class QQmlApplicationEngine;
class QQuickItem;
class QUrl;
class GameObject : public QObject
{
Q_OBJECT
public:
enum class Type : int {
Background = 0,
Wisp,
Obstruction,
Invalid
};
Q_ENUM(Type)
explicit GameObject(QObject *parent, Type objType, const QUrl &qmlFileUrl);
virtual ~GameObject() = default;
signals:
// void updated();
public slots:
virtual void update() = 0;
public:
void registerAsQmlGameObject(QQmlApplicationEngine *engine);
QQuickItem *getQmlComponent() const { return qmlComponent; }
protected:
QQuickItem *qmlComponent = nullptr;
const Type type = Type::Invalid;
const QUrl qmlFilename;
double posX = 0;
double posY = 0;
double rotPhi = 0;
bool rotatable = false;
};
#endif // GAMEOBJECT_H