Add Entity::HasComponents() wrapper

This commit is contained in:
Maple Redleaf
2025-11-10 12:19:38 -06:00
parent 1166bc8911
commit 650925b4e1
2 changed files with 5 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ public:
template <typename CompT, typename... Args>
Component *AddComponent(Args &&...args);
template <typename CompT> CompT *GetComponent();
template <typename CompT> bool HasComponent();
void Update();

View File

@@ -17,3 +17,7 @@ template <typename CompT> CompT *Entity::GetComponent() {
return dynamic_cast<CompT *>(comp_ptr.get());
}
}
template <typename CompT> bool Entity::HasComponent() {
return GetComponent<CompT>() != nullptr;
}