Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- заходим в imgui.cpp, идем на 7285 строку, заменяем
- https://i.imgur.com/AoRFRTt.png
- на
- bool ImGui::Checkbox(const char* label, bool* v)
- {
- ImGuiWindow* window = GetCurrentWindow();
- if (window->SkipItems)
- return false;
- ImGuiContext& g = *GImGui;
- const ImGuiStyle& style = ImGuiStyle::ImGuiStyle();
- const ImGuiID id = window->GetID(label);
- const ImVec2 label_size = CalcTextSize(label, NULL, true);
- const ImVec2 pading = ImVec2(2, 2);
- const ImRect check_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(label_size.y + style.FramePadding.x*6, label_size.y + style.FramePadding.y / 2));
- ItemSize(check_bb, style.FramePadding.y);
- ImRect total_bb = check_bb;
- if (label_size.x > 0)
- SameLine(0, style.ItemInnerSpacing.x);
- const ImRect text_bb(window->DC.CursorPos + ImVec2(0,style.FramePadding.y), window->DC.CursorPos + ImVec2(0,style.FramePadding.y) + label_size);
- if (label_size.x > 0)
- {
- ItemSize(ImVec2(text_bb.GetWidth(), check_bb.GetHeight()), style.FramePadding.y);
- total_bb = ImRect(ImMin(check_bb.Min, text_bb.Min), ImMax(check_bb.Max, text_bb.Max));
- }
- if (!ItemAdd(total_bb, &id))
- return false;
- bool hovered, held;
- bool pressed = ButtonBehavior(total_bb, id, &hovered, &held);
- if (pressed)
- *v = !(*v);
- const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());
- const float check_sz2 = check_sz / 2;
- const float pad = ImMax(1.0f, (float)(int)(check_sz / 4.f));
- RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
- //window->DrawList->AddRectFilled(check_bb.Min+ImVec2(pad,pad), check_bb.Max-ImVec2(pad,pad), GetColorU32(ImGuiCol_CheckMark), style.FrameRounding);
- if (*v)//отрисовка галочки
- {
- window->DrawList->AddRectFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2, check_bb.Min.y), check_bb.Max, GetColorU32(ImGuiCol_CheckMark), 0);
- window->DrawList->AddRect(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2, check_bb.Min.y), check_bb.Max, GetColorU32(ImGuiCol_Border), 0, -1, 2);
- }
- else
- {
- //window->DrawList->AddRectFilled(ImVec2(check_bb.Min.x, check_bb.Min.y), ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2, check_bb.Max.y), GetColorU32(ImGuiCol_FrameBgHovered), 0);
- window->DrawList->AddRect(ImVec2(check_bb.Min.x, check_bb.Min.y), ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2, check_bb.Max.y), GetColorU32(ImGuiCol_Border), 0);
- }
- if (label_size.x > 0.0f)
- RenderText(text_bb.GetTL(), label);
- return pressed;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement