From e77a42cf7f87fceab804f478abaa41c63af59aa5 Mon Sep 17 00:00:00 2001 From: light7734 Date: Mon, 22 Sep 2025 18:52:04 +0330 Subject: [PATCH] refactor(mirror): adjusted to new changes --- modules/mirror/private/entrypoint/mirror.cpp | 22 ++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/mirror/private/entrypoint/mirror.cpp b/modules/mirror/private/entrypoint/mirror.cpp index d85a472..852bcab 100644 --- a/modules/mirror/private/entrypoint/mirror.cpp +++ b/modules/mirror/private/entrypoint/mirror.cpp @@ -33,13 +33,11 @@ public: } } - auto tick() -> bool override + void tick(app::TickInfo tick) override { using Surface = lt::surface::SurfaceComponent; using Input = lt::input::InputComponent; - static lt::Timer timer; - std::this_thread::sleep_for(std::chrono::milliseconds { 10 }); auto should_quit = false; for (auto &[entity, surface, input] : m_registry->view()) @@ -78,8 +76,12 @@ public: } } - timer.reset(); - return should_quit; + const auto now = std::chrono::steady_clock::now(); + m_last_tick_result = app::TickResult { + .info = tick, + .duration = now - tick.start_time, + .end_time = now, + }; } void on_register() override @@ -90,11 +92,19 @@ public: { } + [[nodiscard]] auto get_last_tick_result() const -> const app::TickResult & override + { + return m_last_tick_result; + } + private: Ref m_registry; lt::input::InputAction::Key m_quit_action_key; + std::array m_debug_action_keys {}; + + app::TickResult m_last_tick_result {}; }; class Mirror: public app::Application @@ -201,7 +211,7 @@ private: Ref m_mirror_system; - lt::ecs::Entity m_window = lt::ecs::null_entity; + lt::ecs::EntityId m_window = lt::ecs::null_entity; }; auto app::create_application() -> Scope