We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hello, so i was making new checkboxes for my imgui menu, and for some reason now the text is going down
https://prnt.sc/iyz9ix
my code: https://hastebin.com/warororoze.php or 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 * 2, 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 / 4; const float pad = ImMax(0.0f, (float)(int)(check_sz / 8.f)); //off //window->DrawList->AddRectFilled(check_bb.Min+ImVec2(pad,pad), check_bb.Max-ImVec2(pad,pad), GetColorU32(ImGuiCol_CheckMark), style.FrameRounding); if (*v)//botão modificado { auto color_grey = ImGui::GetColorU32(ImVec4(0.2, 0.2, 0.2, 0.40)); auto color_black = ImGui::GetColorU32(ImVec4(0.0, 0.0, 0.0, 0.70)); // Render //window->DrawList->AddRectFilledMultiColor(bb.Min, bb.Max, color_grey, color_grey, color_black, color_black); // Main gradient.
//on window->DrawList->AddRectFilled(check_bb.Min + ImVec2(pad, pad), check_bb.Max - ImVec2(pad, pad), GetColorU32(ImVec4(0.0f, 1.0f, 0.0f, 1.0f)), style.FrameRounding); window->DrawList->AddRectFilledMultiColor(check_bb.Min + ImVec2(pad, pad), check_bb.Max - ImVec2(pad, pad), color_grey, color_grey, color_black, color_black); //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 { auto color_black_off = ImGui::GetColorU32(ImVec4(0.0, 0.0, 0.0, 0.80)); auto color_grey_off = ImGui::GetColorU32(ImVec4(0.2, 0.2, 0.2, 0.40)); //off window->DrawList->AddRectFilled(check_bb.Min + ImVec2(pad, pad), check_bb.Max - ImVec2(pad, pad), GetColorU32(ImGuiCol_CheckMark), style.FrameRounding); window->DrawList->AddRectFilledMultiColor(check_bb.Min + ImVec2(pad, pad), check_bb.Max - ImVec2(pad, pad), color_grey_off, color_grey_off, color_black_off, color_black_off); //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.Min, label); return pressed;
}
The text was updated successfully, but these errors were encountered:
Sorry but #1586
Sorry, something went wrong.
No branches or pull requests
hello, so i was making new checkboxes for my imgui menu, and for some reason now the text is going down
https://prnt.sc/iyz9ix
my code:
https://hastebin.com/warororoze.php
or
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 * 2, 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 / 4;
const float pad = ImMax(0.0f, (float)(int)(check_sz / 8.f));
//off
//window->DrawList->AddRectFilled(check_bb.Min+ImVec2(pad,pad), check_bb.Max-ImVec2(pad,pad), GetColorU32(ImGuiCol_CheckMark), style.FrameRounding);
if (*v)//botão modificado
{
auto color_grey = ImGui::GetColorU32(ImVec4(0.2, 0.2, 0.2, 0.40));
auto color_black = ImGui::GetColorU32(ImVec4(0.0, 0.0, 0.0, 0.70));
// Render
//window->DrawList->AddRectFilledMultiColor(bb.Min, bb.Max, color_grey, color_grey, color_black, color_black); // Main gradient.
}
The text was updated successfully, but these errors were encountered: