From 3232e7bb0300cd79457ead3c99826006e568d14b Mon Sep 17 00:00:00 2001 From: Jake Coxon Date: Tue, 21 Jul 2020 15:35:31 +0100 Subject: [PATCH] Fix compiling on C++98 --- imgui_draw.cpp | 5 +++-- imgui_widgets.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 1f1afa12b..dba3cf908 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -454,11 +454,12 @@ void ImGui::StyleWin98(ImGuiStyle* dst) // In retrorespect I should have used an icon map like FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS unsigned char minimize[] = {86,6,6,6,0}; unsigned char close[] = {14,2,4,2,5,2,2,2,7,4,9,2,9,4,7,2,2,2,5,2,4,2,0}; - unsigned char *run_length[] = {minimize, close}; + unsigned char *run_length[] = {close, minimize}; int rect_ids[IM_ARRAYSIZE(run_length)]; for (int i = 0; i < IM_ARRAYSIZE(run_length); i++) { - rect_ids[i] = io.Fonts->AddCustomRectFontGlyph(font, (ImWchar)(214 + i), 12, 9, 13+1); + // Starts with unicode multiplication sign and extends + rect_ids[i] = io.Fonts->AddCustomRectFontGlyph(font, (ImWchar)(215 + i), 12, 9, 13+1); } io.Fonts->Build(); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 10224e666..a8e479d11 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -868,7 +868,7 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos) #ifdef WIN98 // close button icon IM_UNUSED(cross_col); IM_UNUSED(cross_extent); - RenderText(bb.Min + ImVec2(2.0f, 2.0f), "\u00D7"); + RenderText(bb.Min + ImVec2(2.0f, 2.0f), "\xC3\x97"); #else window->DrawList->AddLine(center + ImVec2(+cross_extent, +cross_extent), center + ImVec2(-cross_extent, -cross_extent), cross_col, 1.0f); window->DrawList->AddLine(center + ImVec2(+cross_extent, -cross_extent), center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f); @@ -904,7 +904,7 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos) WinAddRect(bb.Min, bb.Max, hovered && held); // collapse icon - RenderText(bb.Min + ImVec2(2.0f, 2.0f), "\u00D6"); + RenderText(bb.Min + ImVec2(2.0f, 2.0f), "\xC3\x98"); #else if (hovered || held) window->DrawList->AddCircleFilled(bb.GetCenter() + ImVec2(0.0f, -0.5f), g.FontSize * 0.5f + 1.0f, bg_col);