correct message order

This commit is contained in:
Green Sky 2024-01-09 22:38:13 +01:00
parent 3d2f5b644b
commit f6cda522ca
No known key found for this signature in database
2 changed files with 20 additions and 6 deletions

@ -1 +1 @@
Subproject commit 1a036c2321e06d4c36f3e2148e67dfe6aa379296 Subproject commit d0a53a6366e3f52e8c84d9fd63dd925ef93e10ce

View File

@ -266,10 +266,24 @@ void ChatGui4::render(float time_delta) {
msg_reg.remove<Components::UnreadFade>(to_remove.cbegin(), to_remove.cend()); msg_reg.remove<Components::UnreadFade>(to_remove.cbegin(), to_remove.cend());
} }
auto tmp_view = msg_reg.view<Message::Components::ContactFrom, Message::Components::ContactTo, Message::Components::Timestamp>(); //auto tmp_view = msg_reg.view<Message::Components::ContactFrom, Message::Components::ContactTo, Message::Components::Timestamp>();
tmp_view.use<Message::Components::Timestamp>(); //tmp_view.use<Message::Components::Timestamp>();
tmp_view.each([&](const Message3 e, Message::Components::ContactFrom& c_from, Message::Components::ContactTo& c_to, Message::Components::Timestamp ts //tmp_view.each([&](const Message3 e, Message::Components::ContactFrom& c_from, Message::Components::ContactTo& c_to, Message::Components::Timestamp ts
) { //) {
auto tmp_view = msg_reg.view<Message::Components::Timestamp>();
for (auto view_it = tmp_view.rbegin(), view_last = tmp_view.rend(); view_it != view_last; view_it++) {
const Message3 e = *view_it;
// manually filter ("reverse" iteration <.<)
if (!msg_reg.all_of<Message::Components::ContactFrom, Message::Components::ContactTo>(e)) {
continue;
}
Message::Components::ContactFrom& c_from = msg_reg.get<Message::Components::ContactFrom>(e);
Message::Components::ContactTo& c_to = msg_reg.get<Message::Components::ContactTo>(e);
Message::Components::Timestamp ts = tmp_view.get<Message::Components::Timestamp>(e);
// TODO: why? // TODO: why?
ImGui::TableNextRow(0, TEXT_BASE_HEIGHT); ImGui::TableNextRow(0, TEXT_BASE_HEIGHT);
@ -356,7 +370,7 @@ void ChatGui4::render(float time_delta) {
} }
ImGui::PopID(); // ent ImGui::PopID(); // ent
}); }
// fake empty placeholders // fake empty placeholders
//ImGui::TableNextRow(0, TEXT_BASE_HEIGHT); //ImGui::TableNextRow(0, TEXT_BASE_HEIGHT);