Checking condition for dirty ImGui device objects [skip appveyor][skip travis]

This commit is contained in:
halx99 2020-09-08 14:21:26 +08:00
parent 7a15d5b74f
commit a824eb4050
1 changed files with 4 additions and 3 deletions

View File

@ -234,9 +234,8 @@ void ImGuiEXT::addFont(const std::string& fontFile, float fontSize, CHS_GLYPH_RA
{
if (FileUtils::getInstance()->isFileExistInternal(fontFile)) {
_fontsInfoMap.emplace(fontFile, FontInfo{ fontSize, glyphRange });
ImGui_ImplCocos2dx_SetDeviceObjectsDirty();
}
ImGui_ImplCocos2dx_SetDeviceObjectsDirty();
}
void ImGuiEXT::removeFont(const std::string& fontFile)
@ -249,8 +248,10 @@ void ImGuiEXT::removeFont(const std::string& fontFile)
void ImGuiEXT::clearFonts()
{
bool haveCustomFonts = !_fontsInfoMap.empty();
_fontsInfoMap.clear();
ImGui_ImplCocos2dx_SetDeviceObjectsDirty();
if(haveCustomFonts)
ImGui_ImplCocos2dx_SetDeviceObjectsDirty();
// auto drawData = ImGui::GetDrawData();
// if(drawData) drawData->Clear();