Minor - Améliore la gestion des entités ImGui - V14.8.0

Optimizes entity list updates in the ImGui interface by caching entity names and IDs.

This reduces unnecessary string operations during rendering and improves performance, especially when dealing with a large number of entities.

The initial ImGui window size has also been reduced for performance reasons.
This commit is contained in:
2025-10-24 12:00:26 +02:00
parent cb234f64f0
commit c67a805bd7
5 changed files with 41 additions and 22 deletions

View File

@@ -39,6 +39,12 @@ struct ComponentEntry {
std::function<void()> addFunc;
};
struct CachedEntity
{
std::string name;
ecs::EntityID id;
};
class imguiManager
{
public:
@@ -175,6 +181,10 @@ private:
// --------------------------------------------- //
// ----------------- Functions ----------------- //
// --------------------------------------------- //
/**
* Update the cached entity list if there is a new, delete or rename entity
*/
void UpdateCachedEntitiesIfNeeded();
// --------------------------------------------- //
// ----------------- Variables ----------------- //
@@ -232,6 +242,8 @@ private:
std::string version_driver_;
ecs::EntityID m_selected_entity_id = 0; // ID of the currently selected entity
std::vector<CachedEntity> cachedEntities_;
bool entityListDirty = true;
int BUILD_VERSION_VER = -1;
};