mirror of
https://gitlab.com/voidframe/voidframe-cpp.git
synced 2026-06-28 18:15:16 -04:00
Add Entity::HasComponents() wrapper
This commit is contained in:
@@ -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