2template <
typename ComponentType>
8template <
typename ComponentType>
11 for (
auto& component : m_Components)
13 DeinitializeComponent(component.Borrow());
17template <
typename ComponentType>
20 for (
const auto& pComponent : m_Components)
23 if (pComponent->IsActive())
24 return pComponent.Borrow();
30template <
typename ComponentType>
33 for (
const auto& pComponent : m_Components)
36 if (pComponent->IsActive())
37 return pComponent.Borrow();
44template <
typename ComponentType>
47 return ComponentType::TypeId();
50template <
typename ComponentType>
53 for (
auto& component : m_Components)
55 if (!bOnlyActive || component->IsActive())
57 out_allComponents.
PushBack(component->GetHandle());
62template <
typename ComponentType>
65 for (
auto& component : m_Components)
67 if (!bOnlyActive || component->IsActive())
69 out_allComponents.
PushBack(component.Borrow());
74template <
typename ComponentType>
77 if (!m_Components.IsEmpty())
79 plLog::Warning(
"A component of type '{0}' is already present in this world. Having more than one is not allowed.", plGetStaticRTTI<ComponentType>()->GetTypeName());
82 m_Components.PushBack(PL_NEW(GetAllocator(), ComponentType));
83 return m_Components.PeekBack().Borrow();
86template <
typename ComponentType>
89 out_pMovedComponent = pComponent;
91 for (plUInt32 i = 0; i < m_Components.GetCount(); ++i)
93 if (m_Components[i].Borrow() == pComponent)
95 m_Components.RemoveAtAndCopy(i);
void PushBack(const T &value)
Pushes value at the end of the array.
Definition ArrayBase_inl.h:333
Base class of all component types.
Definition Component.h:25
Base class for all component managers. Do not derive directly from this class, but derive from plComp...
Definition ComponentManager.h:21
Definition DynamicArray.h:81
static void Warning(plLogInterface *pInterface, const plFormatString &string)
A potential problem or a performance warning. Might be possible to ignore it.
Definition Log.cpp:391
A component manager that does no update at all on components and expects only a single instance to be...
Definition SettingsComponentManager.h:14
virtual void CollectAllComponents(plDynamicArray< plComponentHandle > &out_allComponents, bool bOnlyActive) override
Adds all components that this manager handles to the given array (array is not cleared)....
Definition SettingsComponentManager_inl.h:51
ComponentType * GetSingletonComponent()
Returns the first component of this type that has been created.
Definition SettingsComponentManager_inl.h:18
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22