mirror of
https://gitlab.com/voidframe/voidframe-cpp.git
synced 2026-10-11 23:10:08 -04:00
Add Entity::HasComponents() wrapper
This commit is contained in:
1 parent
1166bc8911
commit
650925b4e1
2 files changed
+5
No files matched your search
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user