@@ -188,9 +188,11 @@ untyped_component& member(
188188}
189189
190190/* * Add constant. */
191+ template <typename T = int32_t >
191192untyped_component& constant (
192193 const char *name,
193- int32_t value)
194+ T value,
195+ flecs::entity_t TId = flecs::I32)
194196{
195197 ecs_add_id (world_, id_, _::type<flecs::Enum>::id (world_));
196198
@@ -201,16 +203,18 @@ untyped_component& constant(
201203 ecs_assert (eid != 0 , ECS_INTERNAL_ERROR, NULL );
202204
203205 ecs_set_id (world_, eid,
204- ecs_pair (flecs::Constant, flecs::I32 ), sizeof (int32_t ),
206+ ecs_pair (flecs::Constant, TId ), sizeof (T ),
205207 &value);
206208
207209 return *this ;
208210}
209211
210212/* * Add bitmask constant. */
213+ template <typename T = uint32_t >
211214untyped_component& bit (
212215 const char *name,
213- uint32_t value)
216+ uint32_t value
217+ flecs::entity_t TId = flecs::U32)
214218{
215219 ecs_add_id (world_, id_, _::type<flecs::Bitmask>::id (world_));
216220
@@ -221,12 +225,11 @@ untyped_component& bit(
221225 ecs_assert (eid != 0 , ECS_INTERNAL_ERROR, NULL );
222226
223227 ecs_set_id (world_, eid,
224- ecs_pair (flecs::Constant, flecs::U32 ), sizeof (uint32_t ),
228+ ecs_pair (flecs::Constant, TId ), sizeof (T ),
225229 &value);
226230
227231 return *this ;
228232}
229-
230233/* * Register array metadata for component */
231234template <typename Elem>
232235untyped_component& array (
0 commit comments