diff --git a/Example/Source/Tools.inl b/Example/Source/Tools.inl index 97eda4f..5f1e985 100644 --- a/Example/Source/Tools.inl +++ b/Example/Source/Tools.inl @@ -166,8 +166,10 @@ protected: InputPosition2D _input { 0, 0 }; }; + +// TODO: Recording is called at different times for the same tool +// and need to pass the event amongst themselves. This is ugly. static entt::entity ACTIVE_EVENT { entt::null }; -static entt::entity ACTIVE_TRACK { entt::null }; void record_tool(const ToolContext& tool, int time) { diff --git a/Example/Source/main.cpp b/Example/Source/main.cpp index 53bb7ee..5d35e95 100644 --- a/Example/Source/main.cpp +++ b/Example/Source/main.cpp @@ -585,19 +585,18 @@ void Application::drawScene() { } }); - // Registry.view().each([&](const auto& position, - // const auto& track, - // const auto& color) { - // Sequentity::Intersect(track, sqty.current_time, [&](auto& event) { - // if (event.type == TranslateEvent) { - // auto data = static_cast(event.data); - // auto input = data->input[data->start]; - // Position pos = position + (input.absolute - data->origin); - // auto impos = ImVec2(Vector2(Vector2i(pos.x, pos.y))); - // Widgets::Cursor(impos, color); - // } - // }); - // }); + Sequentity::Intersect(Events, sqty.current_time, [&](entt::entity subject, entt::entity event_entity) { + auto& event = Events.get(event_entity); + auto& position = Registry.get(subject); + + if (event.type == TranslateEvent) { + auto data = static_cast(event.data); + auto input = data->input[data->start]; + Position pos = position + (input.absolute - data->origin); + auto impos = ImVec2(Vector2(Vector2i(pos.x, pos.y))); + Widgets::Cursor(impos, ImColor{1.0f, 1.0f, 1.0f}); + } + }); } ImGui::End();