ezEngine  Milestone 7
Component_inl.h
1 
2 EZ_FORCE_INLINE ezComponent::ezComponent() :
3  m_Flags(ezObjectFlags::Default),
4  m_pManager(nullptr),
5  m_pOwner(nullptr)
6 {
7  m_uiEditorPickingID = 0xFFFFFFFF;
8 }
9 
10 EZ_FORCE_INLINE ezComponent::~ezComponent()
11 {
12  m_pManager = nullptr;
13  m_pOwner = nullptr;
14  m_InternalId.Invalidate();
15 }
16 
17 EZ_FORCE_INLINE bool ezComponent::IsDynamic() const
18 {
19  return m_Flags.IsSet(ezObjectFlags::Dynamic);
20 }
21 
22 EZ_FORCE_INLINE bool ezComponent::IsActive() const
23 {
24  return m_Flags.IsSet(ezObjectFlags::Active);
25 }
26 
28 {
29  return m_pManager;
30 }
31 
33 {
34  return m_pOwner;
35 }
36 
37 EZ_FORCE_INLINE const ezGameObject* ezComponent::GetOwner() const
38 {
39  return m_pOwner;
40 }
41 
43 {
44  return ezComponentHandle(ezComponentId(m_InternalId, GetTypeId()));
45 }
46 
47 //static
48 EZ_FORCE_INLINE ezUInt16 ezComponent::GetNextTypeId()
49 {
50  return s_uiNextTypeId++;
51 }
52 
53 // static
54 EZ_FORCE_INLINE ezUInt16 ezComponent::TypeId()
55 {
56  return TYPE_ID;
57 }
58 
59 template <typename T>
60 EZ_FORCE_INLINE ezComponentHandle ezComponent::GetHandle() const
61 {
62  return ezComponentHandle(ezComponentId(m_InternalId, T::TypeId()));
63 }
64 
65 EZ_FORCE_INLINE bool ezComponent::IsInitialized() const
66 {
67  return m_Flags.IsSet(ezObjectFlags::Initialized);
68 }
69 
70 EZ_FORCE_INLINE void ezComponent::OnMessage(ezMessage& msg)
71 {
72  GetDynamicRTTI()->DispatchMessage(this, msg);
73 }
74 
75 EZ_FORCE_INLINE void ezComponent::OnMessage(ezMessage& msg) const
76 {
77  GetDynamicRTTI()->DispatchMessage(this, msg);
78 }
79