Internal: Refactor: Moved RenderArrow, RenderBullet, RenderCheckMark to imgui_draw.cpp, changed RenderCheckMark to avoid using ImGui context

This commit is contained in:
omar
2020-03-18 22:36:51 +01:00
parent 2fd411a83e
commit 0bbbbe0f68
4 changed files with 66 additions and 63 deletions

View File

@ -1044,7 +1044,7 @@ bool ImGui::Checkbox(const char* label, bool* v)
else if (*v)
{
const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f));
RenderCheckMark(check_bb.Min + ImVec2(pad, pad), check_col, square_sz - pad*2.0f);
RenderCheckMark(window->DrawList, check_bb.Min + ImVec2(pad, pad), check_col, square_sz - pad*2.0f);
}
if (g.LogEnabled)
@ -6433,7 +6433,7 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, boo
PopStyleColor();
}
if (selected)
RenderCheckMark(pos + ImVec2(window->DC.MenuColumns.Pos[2] + extra_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled), g.FontSize * 0.866f);
RenderCheckMark(window->DrawList, pos + ImVec2(window->DC.MenuColumns.Pos[2] + extra_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled), g.FontSize * 0.866f);
}
IMGUI_TEST_ENGINE_ITEM_INFO(window->DC.LastItemId, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Checkable | (selected ? ImGuiItemStatusFlags_Checked : 0));