diff --git a/flecs.h b/flecs.h index db0e36c19..6509eac5b 100644 --- a/flecs.h +++ b/flecs.h @@ -19022,27 +19022,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. */ @@ -20238,31 +20217,21 @@ void run_pipeline(const flecs::entity_t pip, ecs_ftime_t delta_time = 0.0) const template ::value > = 0> void run_pipeline(ecs_ftime_t delta_time = 0.0) const; +/** Get the world info. + * @see ecs_get_world_info + */ +const flecs::world_info_t* get_info() const; + /** Set timescale. * @see ecs_set_time_scale */ 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 */ @@ -28483,25 +28452,14 @@ inline void world::run_pipeline(ecs_ftime_t delta_time) const { return ecs_run_pipeline(m_world, _::cpp_type::id(m_world), delta_time); } -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; +const flecs::world_info_t* world::get_info() const { + return ecs_get_world_info(m_world); } -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 void world::set_time_scale(ecs_ftime_t mul) const { + ecs_set_time_scale(m_world, mul); } -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 1e40ea29b..25248488c 100644 --- a/include/flecs/addons/cpp/mixins/pipeline/impl.hpp +++ b/include/flecs/addons/cpp/mixins/pipeline/impl.hpp @@ -61,25 +61,14 @@ inline void world::run_pipeline(ecs_ftime_t delta_time) const { return ecs_run_pipeline(m_world, _::cpp_type::id(m_world), delta_time); } -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; +const flecs::world_info_t* world::get_info() const { + return ecs_get_world_info(m_world); } -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 void world::set_time_scale(ecs_ftime_t mul) const { + ecs_set_time_scale(m_world, mul); } -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 079f111d4..d3e7883e1 100644 --- a/include/flecs/addons/cpp/mixins/pipeline/mixin.inl +++ b/include/flecs/addons/cpp/mixins/pipeline/mixin.inl @@ -55,31 +55,21 @@ void run_pipeline(const flecs::entity_t pip, ecs_ftime_t delta_time = 0.0) const template ::value > = 0> void run_pipeline(ecs_ftime_t delta_time = 0.0) const; +/** Get the world info. + * @see ecs_get_world_info + */ +const flecs::world_info_t* get_info() const; + /** Set timescale. * @see ecs_set_time_scale */ 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 4e52fc44b..33af2862a 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. */ diff --git a/test/cpp_api/src/Misc.cpp b/test/cpp_api/src/Misc.cpp index 84080019b..cff4c3110 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 eb739dc7e..29bc7f670 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 { };