示例#1
0
TEST(EntityFilter, Initialization) {
    EntityManager entityManager;
    // Add component
    EntityId entityId = entityManager.generateNewId();
    entityManager.addComponent(
        entityId,
        make_unique<TestComponent<0>>()
    );
    EXPECT_TRUE(nullptr != entityManager.getComponent(entityId, TestComponent<0>::TYPE_ID));
    // Set up filter
    EntityFilter<TestComponent<0>> filter;
    filter.setEntityManager(&entityManager);
    // Check filter
    auto filteredEntities = filter.entities();
    EXPECT_EQ(1, filteredEntities.count(entityId));
    EXPECT_EQ(1, filteredEntities.size());
}
示例#2
0
			Component* getComponent()
			{
				return (c*)entityManager->getComponent(*this, ComponentTypeManager::getTypeFor<c>());
			}