SpiecsEngine
 
Loading...
Searching...
No Matches

◆ ViewComponent() [3/3]

template<typename T , typename F >
void Spices::World::ViewComponent ( F && fn)

View all component in this world.

Template Parameters
TComponent.
Parameters
fnView function.

Definition at line 276 of file World.h.

277 {
279
280 std::shared_lock<std::shared_mutex> lock(m_Mutex);
281
282 auto view = m_Registry.view<T>();
283
284 for(auto e : view)
285 {
286 auto& comp = m_Registry.get<T>(e);
287
288 if(fn(e, comp)) break;
289 }
290 }
#define SPICES_PROFILE_ZONE
entt::registry m_Registry
This variable handles all entity.
Definition World.h:250
std::shared_mutex m_Mutex
Mutex for world.
Definition World.h:245