Skip to content

Commit

Permalink
feat(ecs): Add Name component
Browse files Browse the repository at this point in the history
  • Loading branch information
diogomsmiranda committed Feb 3, 2024
1 parent 3051b8d commit 76cbed2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ set(CUBOS_CORE_SOURCE

"src/cubos/core/ecs/reflection.cpp"
"src/cubos/core/ecs/blueprint.cpp"
"src/cubos/core/ecs/name.cpp"
"src/cubos/core/ecs/world.cpp"
"src/cubos/core/ecs/command_buffer.cpp"
"src/cubos/core/ecs/types.cpp"
Expand Down
22 changes: 22 additions & 0 deletions core/include/cubos/core/ecs/name.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// @file
/// @brief Class @ref cubos::core::ecs::Name.
/// @ingroup core-ecs

#pragma once

#include <string>

#include <cubos/core/reflection/reflect.hpp>

namespace cubos::core::ecs
{
///@brief Component which stores the name of an entity.

struct Name
{
CUBOS_REFLECT;

/// @brief Name of the entity.
std::string value;
};
} // namespace cubos::core::ecs
11 changes: 11 additions & 0 deletions core/src/cubos/core/ecs/name.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <cubos/core/ecs/name.hpp>

#include <cubos/core/ecs/reflection.hpp>
#include <cubos/core/reflection/external/string.hpp>

CUBOS_REFLECT_IMPL(cubos::core::ecs::Name)
{
return core::ecs::TypeBuilder<Name>("cubos::core::ecs::Name")
.withField("name", &Name::value)
.build();
}

0 comments on commit 76cbed2

Please sign in to comment.