-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponentSet.cpp
More file actions
60 lines (60 loc) · 1.81 KB
/
ComponentSet.cpp
File metadata and controls
60 lines (60 loc) · 1.81 KB
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
50
51
52
53
54
55
56
57
58
59
60
#include "ComponentSet.h"
//#include <iostream>
//#include <typeinfo>
//
//template <class T>
//ComponentSet<T>::ComponentSet()
//{
//
// std::cout << "Component has been made\n";
// for (uint8_t i = 0; i < Sets::MAX_ENTITIES; i++)
// this->sparseArray[i] = Sets::MAX_ENTITIES + 1;
//}
//template <class T>
//bool ComponentSet<T>::HasEntity(unsigned short entityID)
//{
// return entityID < (sizeof(this->sparseArray) / sizeof(this->sparseArray[0]))
// && this->sparseArray[entityID] != Sets::MAX_ENTITIES + 1
// && this->entities.Count > 0
// && this->entities.Get(this->sparseArray[entityID]) == entityID;
//}
//template <class T>
//bool ComponentSet<T>::RemoveEntity(unsigned short entityID)
//{
// unsigned short pindex = this->sparseArray[entityID];
// if (this->HasEntity(entityID))
// {
// // EntityManager.RemoveComponentKey(entity, ComponentKey<T>.key);
// unsigned short swapID = this->entities.Get(this->entities.Count - 1);
// this->entities.Remove(pindex);
// this->components.Remove(pindex);
// this->sparseArray[swapID] = pindex;
// this->sparseArray[entityID] = -1;
// this->count = this->entities.Count;
// return true;
// }
// return false;
//}
//template <class T>
//bool ComponentSet<T>::AddEntity(unsigned short entityID, T newComponent)
//{
// if (!this->HasEntity(entityID))
// {
// // EntityManager.AddComponentKey(newEntity, ComponentKey<T>.key);
// this->sparseArray[entityID] = this->entities.Count;
// this->entities.Add(entityID);
// this->components.Add(newComponent);
// this->count = this->entities.Count;
// return true;
// }
// return false;
//}
//template <class T>
//T ComponentSet<T>::GetComponent(unsigned short entityID)
//{
// return this->components.Get(this->sparseArray[entityID]);
//}
//template <class T>
//std::string ComponentSet<T>::ComponentName() {
// return typeid(T).name();
//}