xzasdSADDSADA Posted April 28, 2021 Share Posted April 28, 2021 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? Quote Link to comment Share on other sites More sharing options...
spellsGames Posted April 28, 2021 Share Posted April 28, 2021 help with what? Quote Link to comment Share on other sites More sharing options...
btc Posted April 28, 2021 Share Posted April 28, 2021 you we're trying to change sliderscalar color? can you give us more information. Quote Link to comment Share on other sites More sharing options...
xzasdSADDSADA Posted April 28, 2021 Author Share Posted April 28, 2021 (edited) 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 April 28, 2021 by xzasdSADDSADA typo Quote Link to comment Share on other sites More sharing options...
btc Posted April 28, 2021 Share Posted April 28, 2021 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.