From 6e8f3f0f8bb57c45a2d914b101d159206337b08e Mon Sep 17 00:00:00 2001 From: tobid7 Date: Mon, 26 Feb 2024 18:45:45 +0100 Subject: [PATCH] Fix ID System of UI7 --- source/UI7.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/source/UI7.cpp b/source/UI7.cpp index b05d753..136a9b1 100644 --- a/source/UI7.cpp +++ b/source/UI7.cpp @@ -184,10 +184,6 @@ UI7ID *UI7CtxNewID(const std::string &i) { void UI7CtxClearIDs() { for (auto it = ui7_ctx->ids.begin(); it != ui7_ctx->ids.end();) { - if (it->second == nullptr) { - ++it; - continue; - } if (time(0) - it->second->lt > 5) { delete it->second; it = ui7_ctx->ids.erase(it); @@ -223,9 +219,12 @@ void Init() { void Deinit() { // Dont deinit something not initialized // Please dont count how often init... was - // written wront by me :( + // written wrong by me :( if (!UI7CtxValidate()) return; ui7_ctx->is_activated = false; + for (auto &it : ui7_ctx->ids) { + delete it.second; + } delete ui7_ctx; } @@ -518,9 +517,14 @@ void Grid(const std::string &name, const R7Vec2 &size, const R7Vec2 &entry_size, UI7CtxCursorMove(size); } -bool BeginTree(const std::string &text) { return false; } +bool BeginTree(const std::string &text) { + // TODO + return false; +} -void EndTree() {} +void EndTree() { + // TODO +} R7Vec2 GetCursorPos() { if (!UI7CtxValidate()) return R7Vec2();