40 lines
835 B
C++
40 lines
835 B
C++
#pragma once
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <QObject>
|
|
|
|
#include "app/Singleton.h"
|
|
|
|
#include "xml/tinyxml2.h"
|
|
|
|
class Entity;
|
|
|
|
class EntitiesManager : public QObject, public Singleton<EntitiesManager> {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit EntitiesManager(QObject* parent = nullptr);
|
|
~EntitiesManager();
|
|
void OnDestory();
|
|
|
|
bool Contains(const QString& name) const;
|
|
|
|
bool Parse(const tinyxml2::XMLElement* element, class WorkSpace* workspce);
|
|
|
|
Entity* Create(const QString& name);
|
|
Entity* CreateMesh(const QString& mesh);
|
|
bool DeleteEntity(Entity* entity);
|
|
|
|
Entity* GetEntity(const QString& uuid);
|
|
|
|
Entity* Create(const tinyxml2::XMLElement* element, Entity* parent, WorkSpace* workspce);
|
|
|
|
protected:
|
|
void AddEntity(Entity* entity);
|
|
void RemoveEntity(Entity* entity);
|
|
|
|
private:
|
|
std::unordered_map<QString, Entity*> entities_;
|
|
|
|
}; |