As mentioned in chat, there might be an opportunity for the API to save a few characters from being typed, by introducing a any to the registry.
Before
if (_registry.has<Selected>(entity) ||
_registry.has<SelectedByParent>(entity) ||
_registry.has<SelectedByChild>(entity))
{
flags |= ImGuiTreeNodeFlags_Selected;
}
After
if (_registry.any<Selected, SelectedByParent, SelectedByChild>(entity) {
flags |= ImGuiTreeNodeFlags_Selected;
}
What about the following instead?
registry.has<A, B>(entity, entt::any<C, D>);
That is: entity has both A and B and any of C and D.
This could make possible more complex queries like the one above.
Your case becomes:
registry.has<>(entity, entt::any<Selected, SelectedByParent, SelectedByChild>);
That could work, but I'm not a fan of how it reads.
<these>Now .has<> is noise, and the other entt:: is more noise. You would have to have read it a few times to understand its meaning. As opposed to..
Which isn't as clear as registry.has<> which is almost English, but closer. My picks would be, in this order:
registry.any<A, B>(entity)registry.has<A, B>(entity, entt::any)Just to be sure, are you suggesting to implement both of them or just the first one from your list?
That's up to you, I meant either one or the other, with more preference to the first.
I added registry::any, it was actually easier to read and to work with.
I'll push it upstream soon, most likely tomorrow since I'm out of home today. :+1:
Most helpful comment
What about the following instead?
That is:
entityhas bothAandBand any ofCandD.This could make possible more complex queries like the one above.
Your case becomes: