LeviLamina
Loading...
Searching...
No Matches
EntityId.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5#include "mc/deps/ecs/EntityIdTraits.h"
6
7// entt v4 constrains `entt::entt_traits` with the `entity_like` concept, which is
8// only satisfied when `entt::internal::entt_traits` is defined for the type. It is
9// also the traits the generic `entt::entt_traits` is built from, so specializing it
10// makes `entt::entt_traits<EntityId>` resolve to `basic_entt_traits<EntityIdTraits>`.
11namespace entt::internal {
12template <>
13struct entt_traits<EntityId> : EntityIdTraits {};
14} // namespace entt::internal
15
16class EntityId : public entt::entt_traits<EntityId> {
17public:
18 entity_type mRawId{entt::null};
19
20 [[nodiscard]] constexpr EntityId() = default;
21
22 [[nodiscard]] constexpr EntityId(entity_type rawId) : mRawId(rawId) {}
23
24 [[nodiscard]] constexpr bool isNull() const { return *this == entt::null; }
25
26 [[nodiscard]] constexpr operator entity_type() const { return mRawId; }
27};
Definition EntityId.h:16
Definition EntityIdTraits.h:7