Jump to content

source help


xzasdSADDSADA
 Share

Recommended Posts

Im changing the color of imgui widgets and its making me go 30 fps mode in game

i changed these lines

    window->DrawList->AddRectFilled(check_bb.Min, check_bb.Max, GetColorU32(ImVec4(112 / 255.f, 0 / 255.f, 255 / 255.f, it_filled->second)), 2.f * c_menu::get().dpi_scale);

    const ImVec4 hover_dis = ImVec4(112 / 255.f, 0 / 255.f, 255 / 255.f, 1.f);

i dont see anything wrong, can someone help?

 

Link to comment
Share on other sites

Im trying to change all of the imgui widgets (tabs, sliders, checkboxes) colors, there red by default and I want to change them to purple.

I changed the color in this bit of code specifically (at the bottom).

it went from this

   const ImVec4 hover_dis = ImVec4(255 / 255.f, 0 / 255.f, 0 / 255.f, 1.f);

to this

    const ImVec4 hover_dis = ImVec4(173 / 255.f, 6 / 255.f, 196 / 255.f, 1.f);

the whole file without change is attached

thanks in advance

New Text Document.txt

Edited by xzasdSADDSADA
typo
Link to comment
Share on other sites

1 hour ago, xzasdSADDSADA said:

Im trying to change all of the imgui widgets (tabs, sliders, checkboxes) colors, there red by default and I want to change them to purple.

I changed the color in this bit of code specifically (at the bottom).

it went from this

   const ImVec4 hover_dis = ImVec4(255 / 255.f, 0 / 255.f, 0 / 255.f, 1.f);

to this

    const ImVec4 hover_dis = ImVec4(173 / 255.f, 6 / 255.f, 196 / 255.f, 1.f);

the whole file without change is attached

thanks in advance

New Text Document.txt 8.11 kB · 1 download

 
bool ImGui::Checkbox(const char* label, bool* v)
{
    ImGuiWindow* window = GetCurrentWindow();

    if (window->SkipItems)
        return false;

    ImGuiContext& g = *GImGui;

    const ImGuiStyle& style = g.Style;
    const ImGuiID id = window->GetID(label);
    const ImVec2 label_size = CalcTextSize(label, NULL, true);
    const ImRect check_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(label_size.y + style.FramePadding.y * 1.f, label_size.y + style.FramePadding.y * 1.f)); // We want a square shape to we use Y twice

    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);
        MarkItemEdited(id);
    }

    RenderNavHighlight(total_bb, id);

    // vittu väriä saatana 
    // Checkbox värit löytyy täältä! checkbox colors can be found down below
    auto borderColor = ImColor(255, 255, 255 , 70);
    auto topColor = ImColor(17, 17, 17);
    auto bottomColor = ImColor(17, 17, 17);
    auto topColorHovered = ImColor(17, 17, 17);
    auto bottomColorHovered = ImColor(17, 17, 17);
    auto checkedTopColor = GetColorU32(ImGuiCol_ButtonActive);
    auto checkedBottomColor = GetColorU32(ImGuiCol_ButtonActive) - ImColor(17, 17, 17);

    if (*v) {

        window->DrawList->AddRectFilledMultiColor(check_bb.Min + ImVec2(3, 3), check_bb.Max - ImVec2(3, 3), checkedTopColor, checkedTopColor, checkedBottomColor, checkedBottomColor);
        window->DrawList->AddRect(check_bb.Min + ImVec2(3, 3), check_bb.Max - ImVec2(3, 3), borderColor, 0, false, 1);
    }
    else {

        if (hovered) {

            window->DrawList->AddRectFilledMultiColor(check_bb.Min + ImVec2(3, 3), check_bb.Max - ImVec2(3, 3), topColorHovered, topColorHovered, bottomColorHovered, bottomColorHovered);
            window->DrawList->AddRect(check_bb.Min + ImVec2(3, 3), check_bb.Max - ImVec2(3, 3), borderColor, 0, false, 1);
        }
        else {

            window->DrawList->AddRectFilledMultiColor(check_bb.Min + ImVec2(3, 3), check_bb.Max - ImVec2(3, 3), topColor, topColor, bottomColor, bottomColor);
            window->DrawList->AddRect(check_bb.Min + ImVec2(3, 3), check_bb.Max - ImVec2(3, 3), borderColor, 0, false, 1);
        }
    }

    if (g.LogEnabled)
        LogRenderedText(&text_bb.Min, *v ? "[x]" : "[ ]");

    if (label_size.x > 0.0f) {

        //PushColor(ImGuiCol_Text, ImGuiCol_TextShadow, ImVec4(0.0f, 0.0f, 0.0f, 0.0f));
        //RenderText(text_bb.Min + ImVec2(6.f, -2.f), label);
        //PopStyleColor();
        RenderText(text_bb.Min + ImVec2(5.f, -3.f), label);
    }

    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));

    return pressed;
}

try this one

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...