Unravel Engine C++ Reference
Loading...
Searching...
No Matches
tag_component.cpp
Go to the documentation of this file.
1#include "tag_component.hpp"
5
6namespace unravel
7{
8
10{
11 entt::meta_factory<tag_component>{}
12 .type("tag_component"_hs)
14 entt::attribute{"name", "tag_component"},
15 entt::attribute{"category", "BASIC"},
16 entt::attribute{"pretty_name", "Tag"},
17 })
18 .func<&component_meta<tag_component>::exists>("component_exists"_hs)
19 .func<&component_meta<tag_component>::add>("component_add"_hs)
20 .func<&component_meta<tag_component>::remove>("component_remove"_hs)
21 .func<&component_meta<tag_component>::save>("component_save"_hs)
22 .func<&component_meta<tag_component>::load>("component_load"_hs)
23 .data<&tag_component::name>("name"_hs)
24 .custom<entt::attributes>(entt::attributes{
25 entt::attribute{"name", "name"},
26 entt::attribute{"pretty_name", "Name"},
27 entt::attribute{"tooltip", "This is the name of the entity."},
28 })
29 .data<&tag_component::tag>("tag"_hs)
31 entt::attribute{"name", "tag"},
32 entt::attribute{"pretty_name", "Tag"},
33 entt::attribute{"tooltip", "This is the tag(group) of the entity."},
34 });
35}
36
38{
39 try_save(ar, ser20::make_nvp("name", obj.name));
40 try_save(ar, ser20::make_nvp("tag", obj.tag));
41}
44
46{
47 try_load(ar, ser20::make_nvp("name", obj.name));
48 try_load(ar, ser20::make_nvp("tag", obj.tag));
49}
50
53} // namespace unravel
attributes::value_type attribute
Definition reflection.h:19
std::map< std::string, meta_any > attributes
Definition reflection.h:18
BinaryInputArchive iarchive_binary_t
simd::JSONOutputArchive oarchive_associative_t
BinaryOutputArchive oarchive_binary_t
simd::JSONInputArchive iarchive_associative_t
#define REFLECT(cls)
Definition reflection.h:133
#define SAVE_INSTANTIATE(cls, Archive)
#define LOAD(cls)
auto try_save(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
#define LOAD_INSTANTIATE(cls, Archive)
#define SAVE(cls)
auto try_load(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
Component that provides a tag (name or label) for an entity.
std::string name
The name of the entity.