From 6e68375eac156ade285cd3a9f347d134e8200797 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 15 Apr 2022 18:31:24 +0200 Subject: [PATCH] update to entt v3.10.0 --- README.md | 4 ++-- imgui_entt_entity_editor.hpp | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 23e4142..7c83f03 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,8 @@ editor.registerComponent("Velocity"); ``` # Dependencies -The editor uses EnTTv3.9.0 and ImGui. (tested with ImGui 1.68, 1.72b, 1.75, 1.78, 1.82, 1.85) +The editor uses EnTTv3.10.0 and ImGui. (tested with ImGui 1.68, 1.72b, 1.75, 1.78, 1.82, 1.85, 1.87) To use it with EnTTv3.0.0, use the dedicated branch. For specific EnTT version check the tags, if a new EnTT version does not require a update, I won't make a new Release. -Releases available for EnTT 3.1.0, 3.1.1, 3.2.0, 3.2.1, 3.2.2, 3.3.x, 3.4.0, 3.6.0-3.8.1, 3.9.0. +Releases available for EnTT 3.1.0, 3.1.1, 3.2.0, 3.2.1, 3.2.2, 3.3.x, 3.4.0, 3.6.0-3.8.1, 3.9.0, 3.10.0. diff --git a/imgui_entt_entity_editor.hpp b/imgui_entt_entity_editor.hpp index 7f66c12..f5e49bc 100644 --- a/imgui_entt_entity_editor.hpp +++ b/imgui_entt_entity_editor.hpp @@ -85,8 +85,8 @@ class EntityEditor { bool entityHasComponent(Registry& registry, EntityType& entity, ComponentTypeID type_id) { - ComponentTypeID type[] = { type_id }; - return registry.runtime_view(std::cbegin(type), std::cend(type)).contains(entity); + const auto storage_it = registry.storage(type_id); + return storage_it != registry.storage().end() && storage_it->second.contains(entity); } public: @@ -243,7 +243,16 @@ class EntityEditor { } }); } else { - auto view = registry.runtime_view(comp_list.begin(), comp_list.end()); + entt::basic_runtime_view> view{}; + for (const auto type : comp_list) { + auto storage_it = registry.storage(type); + if (storage_it != registry.storage().end()) { + view.iterate(registry.storage(type)->second); + } + } + + // TODO: add support for exclude + ImGui::Text("%lu Entities Matching:", view.size_hint()); if (ImGui::BeginChild("entity list")) { @@ -297,7 +306,7 @@ class EntityEditor { // MIT License -// Copyright (c) 2019-2021 Erik Scholz +// Copyright (c) 2019-2022 Erik Scholz // Copyright (c) 2020 Gnik Droy // Permission is hereby granted, free of charge, to any person obtaining a copy