Skylicht Engine
Loading...
Searching...
No Matches
CEntityGroup.h
1/*
2!@
3MIT License
4
5Copyright (c) 2022 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the Rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include "CEntity.h"
28#include "CArrayUtils.h"
29
30namespace Skylicht
31{
32 class CEntityManager;
33
53 class SKYLICHT_API CEntityGroup
54 {
55 protected:
56 core::array<u32> m_dataTypes;
57
58 CEntityGroup* m_parentGroup;
59
60 // needQuery tell this group will query again at next frame
61 bool m_needQuery;
62
63 // needValidate tell children system update the query
64 bool m_needValidate;
65
66 CFastArray<CEntity*> m_entities;
67
68 public:
69 CEntityGroup(const u32* dataTypes, int count);
70
71 CEntityGroup(const u32* dataTypes, int count, CEntityGroup* parentGroup);
72
73 virtual ~CEntityGroup();
74
75 virtual void onQuery(CEntityManager* entityManager, CEntity** entities, int numEntity);
76
77 inline CEntity** getEntities()
78 {
79 return m_entities.pointer();
80 }
81
82 inline int getEntityCount()
83 {
84 return m_entities.count();
85 }
86
87 inline void notifyNeedQuery()
88 {
89 m_needQuery = true;
90 }
91
92 inline bool needQuery()
93 {
94 return m_needQuery;
95 }
96
97 inline bool needValidate()
98 {
99 return m_needValidate;
100 }
101
102 inline void finishValidate()
103 {
104 m_needValidate = false;
105 }
106
107 bool haveDataType(u32 type);
108
109 inline CEntityGroup* getParent()
110 {
111 return m_parentGroup;
112 }
113 };
114}
This is the object class that describes an entity.
Definition CEntity.h:58
This object class manages all entities within a scene.
Definition CEntityManager.h:89
Definition CArrayUtils.h:31
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29