void ImDrawRectRainbow(int x, int y, int width, int height, float& flRainbow) {
ImDrawList* pDrawList;
const auto& WindowDrawList = ImGui::GetWindowDrawList();
ImColor colColor(0, 0, 0);
float Speed;
flRainbow += Speed = 0.003f;
if (flRainbow > 1.f) flRainbow = 0.f;
for (int i = 0; i < width; i++) {
float hue = (1.f / (float)width) * i;
hue -= flRainbow;
if (hue < 0.f) hue += 1.f;
ImColor colRainbow = colColor.HSV(hue, 1.f, 1.f);
pDrawList = WindowDrawList;
WindowDrawList->AddRectFilled(ImVec2(x + i, y), ImVec2(width, height), colRainbow.operator ImU32());
}
}
call (В бегине):
if (1) {
ImGui::SetNextWindowSize(ImVec2(155.000f, 77.000f), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(10, 25));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
static float Rainbow;
const auto& CursorPos = ImGui::GetWindowPos();
ImDrawRectRainbow(CursorPos.x + 0, CursorPos.y + 0, ImGui::GetWindowSize().x + 240.000f, CursorPos.y + 2, Rainbow);
ImDrawRectRainbow(CursorPos.x + 0, CursorPos.y + 240, ImGui::GetWindowSize().x + 240.000f, CursorPos.y + 2, Rainbow);
ImGui::PopStyleVar();
}