Skip to content

Commit 5cf4939

Browse files
authored
Update flecs.h
1 parent 7b30a1a commit 5cf4939

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

distr/flecs.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27859,9 +27859,11 @@ untyped_component& member(
2785927859
}
2786027860

2786127861
/** Add constant. */
27862+
template <typename T = int32_t>
2786227863
untyped_component& constant(
2786327864
const char *name,
27864-
int32_t value)
27865+
T value,
27866+
flecs::entity_t TId = flecs::I32)
2786527867
{
2786627868
ecs_add_id(world_, id_, _::type<flecs::Enum>::id(world_));
2786727869

@@ -27872,16 +27874,18 @@ untyped_component& constant(
2787227874
ecs_assert(eid != 0, ECS_INTERNAL_ERROR, NULL);
2787327875

2787427876
ecs_set_id(world_, eid,
27875-
ecs_pair(flecs::Constant, flecs::I32), sizeof(int32_t),
27877+
ecs_pair(flecs::Constant, TId), sizeof(T),
2787627878
&value);
2787727879

2787827880
return *this;
2787927881
}
2788027882

2788127883
/** Add bitmask constant. */
27884+
template <typename T = uint32_t>
2788227885
untyped_component& bit(
2788327886
const char *name,
27884-
uint32_t value)
27887+
uint32_t value
27888+
flecs::entity_t TId = flecs::U32)
2788527889
{
2788627890
ecs_add_id(world_, id_, _::type<flecs::Bitmask>::id(world_));
2788727891

@@ -27892,7 +27896,7 @@ untyped_component& bit(
2789227896
ecs_assert(eid != 0, ECS_INTERNAL_ERROR, NULL);
2789327897

2789427898
ecs_set_id(world_, eid,
27895-
ecs_pair(flecs::Constant, flecs::U32), sizeof(uint32_t),
27899+
ecs_pair(flecs::Constant, TId), sizeof(T),
2789627900
&value);
2789727901

2789827902
return *this;

0 commit comments

Comments
 (0)