Potato Engine
Hobby Game Engine Project
Public Types | Public Member Functions | List of all members
up::Query< Components > Class Template Reference

A Query is used to select a list of Archetypes that provide a particular set of Components, used to efficiency enumerate all matching Entities. More...

#include <query.h>

Public Types

using Function = void(size_t, EntityId const *, Components *...)
 
using Delegate = delegate_ref< Function >
 

Public Member Functions

 Query () noexcept
 Constructs a new Query object. More...
 
view< ComponentId > components () const noexcept
 Fetches the sorted list of ComponentIds required by this Query.
 
void select (World &world, Delegate callback) const
 Given a World and a callback, finds all matching Archetypes, and invokes the callback once for each Chunk belonging to the Archetypes, with appropriate pointers. More...
 

Detailed Description

template<typename... Components>
class up::Query< Components >

A Query is used to select a list of Archetypes that provide a particular set of Components, used to efficiency enumerate all matching Entities.

Constructor & Destructor Documentation

◆ Query()

template<typename... Components>
up::Query< Components >::Query ( )
noexcept

Constructs a new Query object.

This is a non-trivial operation and Query objects should be cached and reused.

Member Function Documentation

◆ select()

template<typename... Components>
void up::Query< Components >::select ( World world,
Delegate  callback 
) const

Given a World and a callback, finds all matching Archetypes, and invokes the callback once for each Chunk belonging to the Archetypes, with appropriate pointers.

This is the primary mechanism for finding or mutating Entities.


The documentation for this class was generated from the following file: