aboutsummaryrefslogtreecommitdiff
path: root/mwe/ecs-memory-efficient/src/ComponentManager.cpp
diff options
context:
space:
mode:
authorMax-001 <80035972+Max-001@users.noreply.github.com>2024-10-05 12:07:18 +0200
committerMax-001 <80035972+Max-001@users.noreply.github.com>2024-10-05 12:07:18 +0200
commitc767ef1e3d1d78e50eb1b6d9824b1c8961d68524 (patch)
tree13fe577b71a31dc82a3d31dc300a8e14d6d0fcb3 /mwe/ecs-memory-efficient/src/ComponentManager.cpp
parentc39adf3040c3f2f7cfcab5ce5b7e39b815e8131d (diff)
First setup
Diffstat (limited to 'mwe/ecs-memory-efficient/src/ComponentManager.cpp')
-rw-r--r--mwe/ecs-memory-efficient/src/ComponentManager.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/mwe/ecs-memory-efficient/src/ComponentManager.cpp b/mwe/ecs-memory-efficient/src/ComponentManager.cpp
index 16cc2b6..20d0ce0 100644
--- a/mwe/ecs-memory-efficient/src/ComponentManager.cpp
+++ b/mwe/ecs-memory-efficient/src/ComponentManager.cpp
@@ -8,14 +8,14 @@ ComponentManager& ComponentManager::GetInstance() {
ComponentManager::ComponentManager() {}
-void ComponentManager::DeleteAllComponentsOfId(std::uint32_t id) {
- for(auto& [type, componentArray] : mComponents) { //Loop through all the types (in the unordered_map<>)
- if (id < componentArray.size()) { //Make sure that the id (that we are looking for) is within the boundaries of the vector<>
- componentArray[id].clear(); //Clear the components at this specific id
- }
- }
+std::vector<std::reference_wrapper<Sprite>> ComponentManager::getAllSpriteReferences() {
+ return mSpriteContainer.getAllReferences();
}
-void ComponentManager::DeleteAllComponents() {
- mComponents.clear(); //Clear the whole unordered_map<>
+std::vector<std::reference_wrapper<Rigidbody>> ComponentManager::getAllRigidbodyReferences() {
+ return mRigidbodyContainer.getAllReferences();
+}
+
+std::vector<std::reference_wrapper<Colider>> ComponentManager::getAllColiderReferences() {
+ return mColiderContainer.getAllReferences();
}