I use http://www.leadwerks...tyinaabbdo-r164
If doing this from C++ I pass in a pointer to the class that calls this function to the extra parameter. Then inside the C function, that you have to specify as the callback, I cast back the extra pointer to the class and expose a public method that adds an entity to a list inside that class. Then after this function is finished being called my list is populated and I can use it.
Something like below. It's from memory so I might have screwed something up but you get the idea.
void _stdcall myfunc( TEntity entity, byte* extra)
{
MyClass* cls = (MyClass*)extra;
cls->AddEntity(entity);
}
class MyClass
{
private:
list<TEntity> _entities;
public:
void AddEntity(TEntity e) { _entities.push_back(e); }
void Update()
{
_entities.clear();
ForEachEntityInAABBDo(aabb, myfunc, this, ENTITY_ALL)
// now my _entities list is populated
}
};