template<typename TComponent> inline void addComponent(TEntityId id, TComponent component)
		{
			auto componentName = GetNameOfComponent<TComponent>();

			componentEntityMap.insert(std::make_pair(componentName, id));
			entityComponentMap[id].insert(std::make_pair(componentName, MakeComponentPtr(component)));
		}
示例#2
0
文件: ecs.hpp 项目: respu/microecs
	void AddComponent(T* c) {
		static_assert(std::is_base_of<Component, T>::value, "AddComponent needs a subclass of Component");
		componentMap.insert({&typeid(T), MakeComponentPtr(c)});
	}
示例#3
0
文件: ecs.hpp 项目: respu/microecs
	void AddComponent(Args&&... args) {
		static_assert(std::is_base_of<Component, T>::value, "AddComponent needs a subclass of Component");
		auto component = MakeComponentPtr(new T(std::forward<Args>(args)...));
		componentMap.insert({&typeid(T), std::move(component)});
	}