INNER CODE UNIT · C++
DemoSystem
JuDelCo/Entitas-Cpp · main.cpp:20
class DemoSystem : public IInitializeSystem, public IExecuteSystem, public ISetPoolSystem {
public:
void SetPool(Pool* pool) {
mPool = pool;
}
void Initialize() {
mPool->CreateEntity()->Add<DemoComponent>("foo", "bar");
std::cout << "DemoSystem initialized" << std::endl;
}
void Execute() {
mPool->CreateEntity()->Add<DemoComponent>("foo", "bar");
auto entitiesCount = mPool->GetGroup(Matcher_AllOf(DemoComponent))->Count();
std::cout << "There are " << entitiesCount << " entities with the component 'DemoComponent'" << std::endl;
std::cout << "DemoSystem executed" << std::endl;
}