raygui
raygui copied to clipboard
Color selection bar won't move until the big color gradient has been clicked at least once
So, I have a variable called portalColor. I have a color selector that takes the portalColor as the argument, and the resulting color is assigned back to portalColor. When I start the program and immediately use the slider instead of the gradient, the slider won't move. You are required to touch the gradient first
@mandar1jn Sorry, I can't understand the issue. I just tested GuiColorPicker in controls_test_suite and it works as expected.
Please, could you provide a minimal code sample illustrating the issue?
#include <stdio.h>
#include <wchar.h>
#include "raylib.h"
#define RAYGUI_IMPLEMENTATION
#include "raygui.h"
Color portalColor = RAYWHITE;
void DrawPortalControls();
int main()
{
InitWindow(800, 600, "Skylanders Editor");
SetTargetFPS(120);
while (!WindowShouldClose())
{
BeginDrawing();
ClearBackground(RAYWHITE);
GuiDrawRectangle({ 0, 0, (float)GetScreenWidth(), 30 }, 1, BLACK, RAYWHITE);
DrawPortalControls();
EndDrawing();
}
CloseWindow();
}
void DrawPortalControls()
{
portalColor = GuiColorPicker({ (float)GetScreenWidth() - 130, 35, 100, 100}, "Select portal color", portalColor);
}
@mandar1jn Issue seems to be located in ConvertRGBtoHSV() specifically for RAYWHITE (or any other initial value with R=G=B). If you init portalColor = RED it works as expected.
It seems there R=G=B is a special case for ConvertRGBtoHSV(), I requires some review...