Imgui: help making rainbow bar

Created on 12 Jan 2018  路  2Comments  路  Source: ocornut/imgui

        float rainbow;
        float speed = 3;
        rainbow += speed;
        if (rainbow > 1.f) rainbow = 0.f;
        for (int i = 0; i < 860; i++)
        {
            float hue = (1.f / (float)860) * i;
            hue -= rainbow;
            if (hue < 0.f) hue += 1.f;

            ImColor cRainbow = ImColor::HSV(hue, 1.f, 1.f);
            ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x, pos.y), ImVec2(pos.x + 860, pos.y + 5), cRainbow);
        }

drawing a static red line

Please look here for what im trying to get
https://i.gyazo.com/1d61987648b6fbb6ffce0b9e14fb65ed.png

Most helpful comment

I can鈥檛 help indeed, this is a general programming problem, the bug is under your nose and has nothing to do with imgui, it would be a good habit to learn to solve the problem yourself.

All 2 comments

Ocornut dont waste your time helping this paster

I can鈥檛 help indeed, this is a general programming problem, the bug is under your nose and has nothing to do with imgui, it would be a good habit to learn to solve the problem yourself.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SlNPacifist picture SlNPacifist  路  3Comments

mkanakis picture mkanakis  路  3Comments

ocornut picture ocornut  路  3Comments

NPatch picture NPatch  路  3Comments

dowit picture dowit  路  3Comments