GuiColorPickerHSV hue bar blinks while changing/dragging the color panel value
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Read the GuiColorPickerHSV implementation shown in the issue and check how GuiColorPanelHSV and GuiColorBarHue report changes and render. Make sure the hue bar is called every frame while preserving the changed result, then exercise the color picker by dragging over the panel and confirm the hue bar no longer blinks. The unused text parameter is a separate question raised in the issue.
Written by the indexing model from the issue text.
Description
int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv)
{
int result = RESULT_NONE;
Vector3 tempHsv = { 0 };
if (colorHsv == NULL)
{
const Vector3 tempColor = { 200.0f/255.0f, 0.0f, 0.0f };
tempHsv = ConvertRGBtoHSV(tempColor);
colorHsv = &tempHsv;
}
result = GuiColorPanelHSV(bounds, NULL, colorHsv);
Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height };
if (result == RESULT_NONE) result = GuiColorBarHue(boundsHue, NULL, &colorHsv->x);
return result;
}
When GuiColorPanelHSV returns RESULT_CHANGED the later call to GuiColorBarHue never happens, this causes the hue bar to not be rendered for that frame and thus causing blinking while dragging the mouse over the color panel.
In my zig code I ported the function and implemented this change:
const second_result = ray.GuiColorBarHue(bounds_hue, null, &color_hsv.x);
if (result == ray.RESULT_NONE) result = second_result;
Which would be equivalent to:
int secondResult = GuiColorBarHue(boundsHue, NULL, &colorHsv->x);
if (result == RESULT_NONE) result = secondResult;
I am not sure whether there is another better solution, but at least this allows both functions to return changed without a previous changed being overwritten with none and always call the GuiColorBarHue function to make sure it is rendered.
I also noticed the text parameter is unused, why is it there and should it be used?
- Dominant language
- C
- Stars
- 5.3k
- Forks
- 410
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raysan5/raygui
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Jstar269/nakagawa-recomp#3753 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Life-Framework/Life-Framework#7017 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
gjrtimmer/jetson-nvmpi#170 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
rofl0r/proxychains-ng#631 ·