Plasma Engine  2.0
Loading...
Searching...
No Matches
Component_inl.h
1#include <Foundation/Logging/Log.h>
2
3PL_ALWAYS_INLINE plComponent::plComponent() = default;
4
5PL_ALWAYS_INLINE plComponent::~plComponent()
6{
8 m_pManager = nullptr;
9 m_pOwner = nullptr;
10 m_InternalId.Invalidate();
11}
12
13PL_ALWAYS_INLINE bool plComponent::IsDynamic() const
14{
15 return m_ComponentFlags.IsSet(plObjectFlags::Dynamic);
16}
17
18PL_ALWAYS_INLINE bool plComponent::GetActiveFlag() const
19{
20 return m_ComponentFlags.IsSet(plObjectFlags::ActiveFlag);
21}
22
23PL_ALWAYS_INLINE bool plComponent::IsActive() const
24{
25 return m_ComponentFlags.IsSet(plObjectFlags::ActiveState);
26}
27
28PL_ALWAYS_INLINE bool plComponent::IsActiveAndInitialized() const
29{
31}
32
34{
35 return m_pManager;
36}
37
39{
40 return m_pManager;
41}
42
44{
45 return m_pOwner;
46}
47
48PL_ALWAYS_INLINE const plGameObject* plComponent::GetOwner() const
49{
50 return m_pOwner;
51}
52
54{
55 return plComponentHandle(m_InternalId);
56}
57
58PL_ALWAYS_INLINE plUInt32 plComponent::GetUniqueID() const
59{
60 return m_uiUniqueID;
61}
62
63PL_ALWAYS_INLINE void plComponent::SetUniqueID(plUInt32 uiUniqueID)
64{
65 m_uiUniqueID = uiUniqueID;
66}
67
68PL_ALWAYS_INLINE bool plComponent::IsInitialized() const
69{
70 return m_ComponentFlags.IsSet(plObjectFlags::Initialized);
71}
72
73PL_ALWAYS_INLINE bool plComponent::IsInitializing() const
74{
75 return m_ComponentFlags.IsSet(plObjectFlags::Initializing);
76}
77
78PL_ALWAYS_INLINE bool plComponent::IsSimulationStarted() const
79{
80 return m_ComponentFlags.IsSet(plObjectFlags::SimulationStarted);
81}
82
const plRTTI * m_pMessageDispatchType
Messages will be dispatched to this type. Default is what GetDynamicRTTI() returns,...
Definition Component.h:222
bool GetActiveFlag() const
Checks whether the 'active flag' is set on this component. Note that this does not mean that the comp...
Definition Component_inl.h:18
plComponentHandle GetHandle() const
Returns a handle to this component.
Definition Component_inl.h:53
bool IsActiveAndSimulating() const
Whether the component is currently active and simulation has been started as well.
Definition Component_inl.h:83
bool IsActive() const
Checks whether this component is in an active state.
Definition Component_inl.h:23
plComponent()
Keep the constructor private or protected in derived classes, so it cannot be called manually.
plComponentManagerBase * GetOwningManager()
Returns the corresponding manager for this component.
Definition Component_inl.h:33
bool IsDynamic() const
Returns whether this component is dynamic and thus can only be attached to dynamic game objects.
Definition Component_inl.h:13
plUInt32 GetUniqueID() const
Returns the unique id for this component.
Definition Component_inl.h:58
bool IsActiveAndInitialized() const
Returns whether this component is active and initialized.
Definition Component_inl.h:28
plGameObject * GetOwner()
Returns the owner game object if the component is attached to one or nullptr.
Definition Component_inl.h:43
void SetUniqueID(plUInt32 uiUniqueID)
Sets the unique id for this component.
Definition Component_inl.h:63
Base class for all component managers. Do not derive directly from this class, but derive from plComp...
Definition ComponentManager.h:21
This class represents an object inside the world.
Definition GameObject.h:32
PL_ALWAYS_INLINE bool AreAllSet(const plBitflags< T > &rhs) const
Returns whether all the given flags are set.
Definition Bitflags.h:133
PL_ALWAYS_INLINE bool IsAnySet(const plBitflags< T > &rhs) const
Returns whether any of the given flags is set.
Definition Bitflags.h:145
PL_ALWAYS_INLINE bool IsSet(Enum flag) const
Checks if certain flags are set within the bitfield.
Definition Bitflags.h:127
A handle to a component.
Definition Declarations.h:138
@ SimulationStarted
OnSimulationStarted() has been called on the component.
Definition Declarations.h:182
@ ActiveState
The object/component and all its parents have the active flag.
Definition Declarations.h:179
@ Dynamic
Usually detected automatically. A dynamic object will not cache render data across frames.
Definition Declarations.h:175
@ Initializing
The object/component is currently initializing. Used to prevent recursions during initialization.
Definition Declarations.h:181
@ ActiveFlag
The object/component has the 'active flag' set.
Definition Declarations.h:178
@ SimulationStarting
Used to prevent recursion during OnSimulationStarted()
Definition Declarations.h:183
@ Initialized
The object/component has been initialized.
Definition Declarations.h:180