bool ImGui::Checkbox(const char* label, bool* v)
{
ImVec2 p = ImGui::GetCursorScreenPos() + ImVec2(0, 0);
ImDrawList* draw_list = ImGui::GetWindowDrawList();
float height = ImGui::GetFrameHeight();
float width = height * 1.50f;
float radius = height * 0.50f;
ImGuiContext& g = *GImGui;
const ImGuiStyle& style = g.Style;
ImGuiWindow* window = ImGui::GetCurrentWindow();
const ImGuiID id = window->GetID(label);
const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
const float square_sz = GetFrameHeight();
const ImVec2 pos = window->DC.CursorPos;
const ImRect total_bb(pos, pos + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f));
if (!ItemAdd(total_bb, id))
return false;
ImGui::InvisibleButton(label, ImVec2(190 + width, height));
if (ImGui::IsItemClicked())
*v = !*v;
float t = *v ? 1.0f : 0.0f;
if (customize == true)
{
}
else
{
animspeed = 0.30f;
}
if (g.LastActiveId == g.CurrentWindow->GetID(label))
{
float t_anim = ImSaturate(g.LastActiveIdTimer / animspeed);
t = *v ? (t_anim) : (1.f - t_anim);
}
ImU32 col_bg;
ImU32 col_bg2;
if (ImGui::IsItemHovered())
{
col_bg = ImGui::GetColorU32(ImLerp(ImColor(0,0,0), ImVec4(0.01f, 0.09f, 0.17f, 1.f), t));
col_bg2 = ImGui::GetColorU32(ImLerp(ImColor(84, 83, 89, 255), ImVec4(0.3f, 0.6f, 1.f, 1.f), t));
}
else
{
col_bg = ImGui::GetColorU32(ImLerp(ImColor(0,0,0), ImVec4(0.01f, 0.09f, 0.17f, 1.f), t));
col_bg2 = ImGui::GetColorU32(ImLerp(ImColor(84, 83, 89, 255), ImVec4(0.3f, 0.6f, 1.f, 1.f), t));
}
draw_list->AddRectFilled(ImVec2(p.x + 203, p.y + 4), ImVec2(p.x + 227, p.y + 15), col_bg, height * 0.5f);
draw_list->AddCircleFilled(ImVec2(200 + p.x + radius + t * (width - radius * 2.0f), p.y + radius), radius - 2.5f, col_bg2);
if (label_size.x > 0.0f)
{
ImGui::PushFont(ne_takoi_tolstiy2);
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f));
RenderText(ImVec2((p.x + width) - 35, (p.y + height) - 16), label);
ImGui::PopStyleColor(1);
ImGui::PopFont();
ImGui::Spacing();
ImGui::Spacing();
ImGui::Spacing();
ImGui::Spacing();
}
}