add stable name to comps

This commit is contained in:
Green Sky 2024-02-10 12:22:42 +01:00
parent 9ca6adee4f
commit 6f3f9ef191
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 compiler stable ids // cross compiler stable ids