imgui 怎么卸载己加载的ImFontConfig
您可以通过以下步骤卸载已加载的ImFontConfig:
- 获取ImFontAtlas对象:
ImGuiIO& io = ImGui::GetIO();
ImFontAtlas* atlas = io.Fonts;
- 获取已加载的ImFontConfig对象:
ImFontConfig* config = atlas->Fonts[0]->ConfigData;
注意:此处假定您只加载了一个ImFontConfig。
- 从ImFontAtlas对象中删除该ImFontConfig对象:
atlas->ClearTexData();
atlas->Fonts.erase(atlas->Fonts.begin());
atlas->TexID = nullptr;
ImGui_ImplOpenGL3_DestroyFontsTexture();
- 删除ImFontConfig对象:
delete config;
注意:如果您在加载ImFontConfig对象时使用了new运算符,则需要在卸载时使用delete运算符。
完成了以上步骤后,已加载的ImFontConfig对象将被完全卸载
原文地址: https://www.cveoy.top/t/topic/cxVK 著作权归作者所有。请勿转载和采集!