add stable id to comps

This commit is contained in:
Green Sky 2024-02-10 12:23:20 +01:00
parent a1f5add8d3
commit 486306d854
No known key found for this signature in database

View File

@ -1,3 +1,5 @@
#pragma once
#include "./components.hpp" #include "./components.hpp"
#include <entt/core/type_info.hpp> #include <entt/core/type_info.hpp>
@ -6,8 +8,12 @@
#define DEFINE_COMP_ID(x) \ #define DEFINE_COMP_ID(x) \
template<> \ template<> \
constexpr entt::id_type entt::type_hash<x>::value() noexcept { \ constexpr entt::id_type entt::type_hash<x>::value() noexcept { \
using namespace entt::literals; \ using namespace entt::literals; \
return #x##_hs; \ return #x##_hs; \
} \
template<> \
constexpr std::string_view entt::type_name<x>::value() noexcept { \
return #x; \
} }
// cross compile(r) stable ids // cross compile(r) stable ids