diff --git a/flecs.h b/flecs.h index 70c50eb603..32cb72ba24 100644 --- a/flecs.h +++ b/flecs.h @@ -19023,27 +19023,6 @@ struct world { return m_world; } - /** Get last delta_time. - */ - ecs_ftime_t delta_time() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->delta_time; - } - - /** Get current tick. - */ - int64_t tick() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->frame_count_total; - } - - /** Get current simulation time. - */ - ecs_ftime_t time() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->world_time_total; - } - /** Signal application should quit. * After calling this operation, the next call to progress() returns false. */ @@ -19849,6 +19828,13 @@ struct world { ecs_run_post_frame(m_world, action, ctx); } + /** Get the world info. + * @see ecs_get_world_info + */ + const flecs::world_info_t* get_info() const{ + return ecs_get_world_info(m_world); + } + /** * @file addons/cpp/mixins/id/mixin.inl * @brief Id world mixin. @@ -20244,26 +20230,11 @@ void run_pipeline(ecs_ftime_t delta_time = 0.0) const; */ void set_time_scale(ecs_ftime_t mul) const; -/** Get timescale. - * @see ecs_get_time_scale - */ -ecs_ftime_t get_time_scale() const; - -/** Get tick. - * @return Monotonically increasing frame count. - */ -int64_t get_tick() const; - /** Set target FPS. * @see ecs_set_target_fps */ void set_target_fps(ecs_ftime_t target_fps) const; -/** Get target FPS. - * @return Configured frames per second. - */ -ecs_ftime_t get_target_fps() const; - /** Reset simulation clock. * @see ecs_reset_clock */ @@ -28486,23 +28457,8 @@ inline void world::run_pipeline(ecs_ftime_t delta_time) const { inline void world::set_time_scale(ecs_ftime_t mul) const { ecs_set_time_scale(m_world, mul); -} - -inline ecs_ftime_t world::get_time_scale() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->time_scale; -} - -inline int64_t world::get_tick() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->frame_count_total; } -inline ecs_ftime_t world::get_target_fps() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->target_fps; -} - inline void world::set_target_fps(ecs_ftime_t target_fps) const { ecs_set_target_fps(m_world, target_fps); } diff --git a/include/flecs/addons/cpp/mixins/pipeline/impl.hpp b/include/flecs/addons/cpp/mixins/pipeline/impl.hpp index 1e40ea29b0..f9595d7b68 100644 --- a/include/flecs/addons/cpp/mixins/pipeline/impl.hpp +++ b/include/flecs/addons/cpp/mixins/pipeline/impl.hpp @@ -63,23 +63,8 @@ inline void world::run_pipeline(ecs_ftime_t delta_time) const { inline void world::set_time_scale(ecs_ftime_t mul) const { ecs_set_time_scale(m_world, mul); -} - -inline ecs_ftime_t world::get_time_scale() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->time_scale; -} - -inline int64_t world::get_tick() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->frame_count_total; } -inline ecs_ftime_t world::get_target_fps() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->target_fps; -} - inline void world::set_target_fps(ecs_ftime_t target_fps) const { ecs_set_target_fps(m_world, target_fps); } diff --git a/include/flecs/addons/cpp/mixins/pipeline/mixin.inl b/include/flecs/addons/cpp/mixins/pipeline/mixin.inl index 079f111d4e..d41945922d 100644 --- a/include/flecs/addons/cpp/mixins/pipeline/mixin.inl +++ b/include/flecs/addons/cpp/mixins/pipeline/mixin.inl @@ -60,26 +60,11 @@ void run_pipeline(ecs_ftime_t delta_time = 0.0) const; */ void set_time_scale(ecs_ftime_t mul) const; -/** Get timescale. - * @see ecs_get_time_scale - */ -ecs_ftime_t get_time_scale() const; - -/** Get tick. - * @return Monotonically increasing frame count. - */ -int64_t get_tick() const; - /** Set target FPS. * @see ecs_set_target_fps */ void set_target_fps(ecs_ftime_t target_fps) const; -/** Get target FPS. - * @return Configured frames per second. - */ -ecs_ftime_t get_target_fps() const; - /** Reset simulation clock. * @see ecs_reset_clock */ diff --git a/include/flecs/addons/cpp/world.hpp b/include/flecs/addons/cpp/world.hpp index 4e52fc44b7..4a277c3987 100644 --- a/include/flecs/addons/cpp/world.hpp +++ b/include/flecs/addons/cpp/world.hpp @@ -182,27 +182,6 @@ struct world { return m_world; } - /** Get last delta_time. - */ - ecs_ftime_t delta_time() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->delta_time; - } - - /** Get current tick. - */ - int64_t tick() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->frame_count_total; - } - - /** Get current simulation time. - */ - ecs_ftime_t time() const { - const ecs_world_info_t *stats = ecs_get_world_info(m_world); - return stats->world_time_total; - } - /** Signal application should quit. * After calling this operation, the next call to progress() returns false. */ @@ -1008,6 +987,13 @@ struct world { ecs_run_post_frame(m_world, action, ctx); } + /** Get the world info. + * @see ecs_get_world_info + */ + const flecs::world_info_t* get_info() const{ + return ecs_get_world_info(m_world); + } + # include "mixins/id/mixin.inl" # include "mixins/component/mixin.inl" # include "mixins/entity/mixin.inl" diff --git a/test/cpp_api/src/Misc.cpp b/test/cpp_api/src/Misc.cpp index 84080019bd..cff4c3110c 100644 --- a/test/cpp_api/src/Misc.cpp +++ b/test/cpp_api/src/Misc.cpp @@ -224,7 +224,7 @@ void Misc_app_run_target_fps() { int32_t count = 0; ecs.system().iter([&](flecs::iter& it) { count ++; - test_int(it.world().get_target_fps(), 10); + test_int(it.world().get_info()->target_fps, 10); it.world().quit(); }); diff --git a/test/cpp_api/src/World.cpp b/test/cpp_api/src/World.cpp index eb739dc7eb..29bc7f670e 100644 --- a/test/cpp_api/src/World.cpp +++ b/test/cpp_api/src/World.cpp @@ -1546,15 +1546,15 @@ void World_reset_all() { void World_get_tick() { flecs::world ecs; - test_int(ecs.tick(), 0); + test_int(ecs.get_info()->frame_count_total, 0); ecs.progress(); - test_int(ecs.tick(), 1); + test_int(ecs.get_info()->frame_count_total, 1); ecs.progress(); - test_int(ecs.tick(), 2); + test_int(ecs.get_info()->frame_count_total, 2); } struct Scope { };