blob: 5b0629f39142e4af7f2b0845ca1d88e03e8b8cea (
plain)
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
|
#pragma once
#include "Components.h"
#include <cstdint>
#include <unordered_map>
#include <vector>
#include <typeindex>
#include <memory>
#include <any>
class ComponentManager {
public:
static ComponentManager& GetInstance();
ComponentManager(const ComponentManager&) = delete;
ComponentManager(ComponentManager&&) = delete;
ComponentManager& operator=(const ComponentManager&) = delete;
ComponentManager& operator=(ComponentManager&&) = delete;
template <typename T, typename... Args>
void AddComponent(std::uint32_t id, Args&&... args);
template <typename T>
std::vector<std::reference_wrapper<T>> GetComponentsOfID(std::uint32_t id);
/*template <typename T>
std::vector<std::uint32_t> GetAllComponentIDs();
template <typename T>
std::vector<T*> GetAllComponentPointer();*/
private:
static ComponentManager mInstance;
ComponentManager();
std::unordered_map<std::type_index, std::vector<std::vector<std::unique_ptr<Component>>>> mComponents;
};
#include "ComponentManager.hpp"
|