-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqentity.h
44 lines (35 loc) · 1.04 KB
/
qentity.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
#ifndef QENTITY_H
#define QENTITY_H
#include <QObject>
#include <QJSValue>
class EntityManager;
class QJSEngine;
/**
* @brief The wrapper used to reference itself in scripts.
* To access this wrapper use 'me'.
* Example: me.setMesh("suzanne");
* Note: Some functions are overloaded so using 'me' is not required. See JSHelperFunctions.js.
*/
class QEntity : public QObject
{
Q_OBJECT
public:
QEntity(unsigned int _ID, QObject* parent = nullptr);
Q_PROPERTY(unsigned int ID MEMBER mID)
public slots:
/**
* @brief Get the component with the given name. If it doesn't exist the return value is undefined.
*/
QJSValue getComponent(const QString& name);
/**
* @brief Adds a component with the given name. Returns the component. If it already is added the current one will be returned instead.
*/
QJSValue addComponent(const QString& name);
/**
* @brief Requires a sound component with a sound setup through the editor.
*/
void playSound();
private:
unsigned int mID;
};
#endif // QENTITY_H