diff --git a/flecs.c b/flecs.c index 371244f8d..2e22b9f77 100644 --- a/flecs.c +++ b/flecs.c @@ -29485,8 +29485,8 @@ ecs_float_t flecs_counter_record( if (gauge_value < 0) { gauge_value = 0; /* Counters are monotonically increasing */ } - flecs_gauge_record(m, t, value - prev); - return value - prev; + flecs_gauge_record(m, t, gauge_value); + return gauge_value; } static diff --git a/flecs.h b/flecs.h index eed155d09..515875693 100644 --- a/flecs.h +++ b/flecs.h @@ -16289,7 +16289,7 @@ struct world { /** Get current tick. */ - int32_t tick() const { + int64_t tick() const { const ecs_world_info_t *stats = ecs_get_world_info(m_world); return stats->frame_count_total; } @@ -17205,7 +17205,7 @@ ecs_ftime_t get_time_scale() const; /** Get tick * @return Monotonically increasing frame count. */ -int32_t get_tick() const; +int64_t get_tick() const; /** Set target FPS * @see ecs_set_target_fps @@ -20941,7 +20941,6 @@ struct cpp_type_impl { ecs_assert(world != nullptr, ECS_COMPONENT_NOT_REGISTERED, name); } else { ecs_assert(!id || s_id == id, ECS_INCONSISTENT_COMPONENT_ID, NULL); - ecs_assert(s_allow_tag == allow_tag, ECS_INVALID_PARAMETER, NULL); } // If no id has been registered yet for the component (indicating the @@ -24069,7 +24068,7 @@ inline ecs_ftime_t world::get_time_scale() const { return stats->time_scale; } -inline int32_t world::get_tick() const { +inline int64_t world::get_tick() const { const ecs_world_info_t *stats = ecs_get_world_info(m_world); return stats->frame_count_total; } diff --git a/include/flecs/addons/cpp/component.hpp b/include/flecs/addons/cpp/component.hpp index 744196cd5..a29c16c9a 100644 --- a/include/flecs/addons/cpp/component.hpp +++ b/include/flecs/addons/cpp/component.hpp @@ -157,7 +157,6 @@ struct cpp_type_impl { ecs_assert(world != nullptr, ECS_COMPONENT_NOT_REGISTERED, name); } else { ecs_assert(!id || s_id == id, ECS_INCONSISTENT_COMPONENT_ID, NULL); - ecs_assert(s_allow_tag == allow_tag, ECS_INVALID_PARAMETER, NULL); } // If no id has been registered yet for the component (indicating the diff --git a/include/flecs/addons/cpp/mixins/pipeline/impl.hpp b/include/flecs/addons/cpp/mixins/pipeline/impl.hpp index f09724a83..0c3bbecc8 100644 --- a/include/flecs/addons/cpp/mixins/pipeline/impl.hpp +++ b/include/flecs/addons/cpp/mixins/pipeline/impl.hpp @@ -60,7 +60,7 @@ inline ecs_ftime_t world::get_time_scale() const { return stats->time_scale; } -inline int32_t world::get_tick() const { +inline int64_t world::get_tick() const { const ecs_world_info_t *stats = ecs_get_world_info(m_world); return stats->frame_count_total; } diff --git a/include/flecs/addons/cpp/mixins/pipeline/mixin.inl b/include/flecs/addons/cpp/mixins/pipeline/mixin.inl index 22d30b7c9..e013210ba 100644 --- a/include/flecs/addons/cpp/mixins/pipeline/mixin.inl +++ b/include/flecs/addons/cpp/mixins/pipeline/mixin.inl @@ -52,7 +52,7 @@ ecs_ftime_t get_time_scale() const; /** Get tick * @return Monotonically increasing frame count. */ -int32_t get_tick() const; +int64_t get_tick() const; /** Set target FPS * @see ecs_set_target_fps diff --git a/include/flecs/addons/cpp/world.hpp b/include/flecs/addons/cpp/world.hpp index 8caf74d61..74d4d8377 100644 --- a/include/flecs/addons/cpp/world.hpp +++ b/include/flecs/addons/cpp/world.hpp @@ -162,7 +162,7 @@ struct world { /** Get current tick. */ - int32_t tick() const { + int64_t tick() const { const ecs_world_info_t *stats = ecs_get_world_info(m_world); return stats->frame_count_total; } diff --git a/src/addons/stats.c b/src/addons/stats.c index 2a38decf9..cf0645b2a 100644 --- a/src/addons/stats.c +++ b/src/addons/stats.c @@ -61,8 +61,8 @@ ecs_float_t flecs_counter_record( if (gauge_value < 0) { gauge_value = 0; /* Counters are monotonically increasing */ } - flecs_gauge_record(m, t, value - prev); - return value - prev; + flecs_gauge_record(m, t, gauge_value); + return gauge_value; } static diff --git a/test/cpp_api/project.json b/test/cpp_api/project.json index be3f642c7..7ed9d01f6 100644 --- a/test/cpp_api/project.json +++ b/test/cpp_api/project.json @@ -876,7 +876,9 @@ "module_tag_on_namespace", "dtor_on_fini", "implicit_module", - "module_in_namespace_w_root_name" + "module_in_namespace_w_root_name", + "module_as_entity", + "module_as_component" ] }, { "id": "ImplicitComponents", diff --git a/test/cpp_api/src/Module.cpp b/test/cpp_api/src/Module.cpp index 4ce38384b..fc79df3f3 100644 --- a/test/cpp_api/src/Module.cpp +++ b/test/cpp_api/src/Module.cpp @@ -236,3 +236,23 @@ void Module_module_in_namespace_w_root_name() { test_assert(p != 0); test_assert(p == p_lookup); } + +void Module_module_as_entity() { + flecs::world world; + + auto m = world.import(); + test_assert(m != 0); + + auto e = world.entity(); + test_assert(m == e); +} + +void Module_module_as_component() { + flecs::world world; + + auto m = world.import(); + test_assert(m != 0); + + auto e = world.component(); + test_assert(m == e); +} diff --git a/test/cpp_api/src/main.cpp b/test/cpp_api/src/main.cpp index 3da6e3b7a..17a440100 100644 --- a/test/cpp_api/src/main.cpp +++ b/test/cpp_api/src/main.cpp @@ -837,6 +837,8 @@ void Module_module_tag_on_namespace(void); void Module_dtor_on_fini(void); void Module_implicit_module(void); void Module_module_in_namespace_w_root_name(void); +void Module_module_as_entity(void); +void Module_module_as_component(void); // Testsuite 'ImplicitComponents' void ImplicitComponents_add(void); @@ -4265,6 +4267,14 @@ bake_test_case Module_testcases[] = { { "module_in_namespace_w_root_name", Module_module_in_namespace_w_root_name + }, + { + "module_as_entity", + Module_module_as_entity + }, + { + "module_as_component", + Module_module_as_component } }; @@ -5143,7 +5153,7 @@ static bake_test_suite suites[] = { "Module", NULL, NULL, - 9, + 11, Module_testcases }, {