mirror of
https://github.com/raysan5/raygui.git
synced 2025-12-25 10:22:33 -05:00
Formatting tweaks
This commit is contained in:
20
src/raygui.h
20
src/raygui.h
@ -3709,22 +3709,22 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollInd
|
||||
return result;
|
||||
}
|
||||
|
||||
// Color Panel control - Color (RGBA) variant.
|
||||
// Color Panel control - Color (RGBA) variant
|
||||
int GuiColorPanel(Rectangle bounds, const char *text, Color *color)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
Vector3 vcolor = { (float)color->r/255.0f, (float)color->g/255.0f, (float)color->b/255.0f };
|
||||
Vector3 hsv = ConvertRGBtoHSV(vcolor);
|
||||
Vector3 prevHsv = hsv; // workaround to see if GuiColorPanelHSV modifies the hsv.
|
||||
Vector3 prevHsv = hsv; // workaround to see if GuiColorPanelHSV modifies the hsv
|
||||
|
||||
GuiColorPanelHSV(bounds, text, &hsv);
|
||||
|
||||
// Check if the hsv was changed, only then change the color.
|
||||
// This is required, because the Color->HSV->Color conversion has precision errors.
|
||||
// Thus the assignment from HSV to Color should only be made, if the HSV has a new user-entered value.
|
||||
// Otherwise GuiColorPanel would often modify it's color without user input.
|
||||
// TODO: GuiColorPanelHSV could return 1 if the slider was dragged, to simplify this check.
|
||||
// Check if the hsv was changed, only then change the color
|
||||
// This is required, because the Color->HSV->Color conversion has precision errors
|
||||
// Thus the assignment from HSV to Color should only be made, if the HSV has a new user-entered value
|
||||
// Otherwise GuiColorPanel would often modify it's color without user input
|
||||
// TODO: GuiColorPanelHSV could return 1 if the slider was dragged, to simplify this check
|
||||
if (hsv.x != prevHsv.x || hsv.y != prevHsv.y || hsv.z != prevHsv.z)
|
||||
{
|
||||
Vector3 rgb = ConvertHSVtoRGB(hsv);
|
||||
@ -3935,7 +3935,7 @@ int GuiColorPicker(Rectangle bounds, const char *text, Color *color)
|
||||
Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height };
|
||||
//Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, BARS_PADDING), bounds.width, GuiGetStyle(COLORPICKER, BARS_THICK) };
|
||||
|
||||
// NOTE: this conversion can cause low hue-resolution, if the r, g and b value are very similar, which causes the hue bar to shift around when only the GuiColorPanel is used.
|
||||
// NOTE: this conversion can cause low hue-resolution, if the r, g and b value are very similar, which causes the hue bar to shift around when only the GuiColorPanel is used
|
||||
Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ (*color).r/255.0f, (*color).g/255.0f, (*color).b/255.0f });
|
||||
|
||||
GuiColorBarHue(boundsHue, NULL, &hsv.x);
|
||||
@ -3948,8 +3948,8 @@ int GuiColorPicker(Rectangle bounds, const char *text, Color *color)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Color Picker control that avoids conversion to RGB and back to HSV on each call, thus avoiding jittering.
|
||||
// The user can call ConvertHSVtoRGB() to convert *colorHsv value to RGB.
|
||||
// Color Picker control that avoids conversion to RGB and back to HSV on each call, thus avoiding jittering
|
||||
// The user can call ConvertHSVtoRGB() to convert *colorHsv value to RGB
|
||||
// NOTE: It's divided in multiple controls:
|
||||
// int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv)
|
||||
// int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha)
|
||||
|
||||
Reference in New Issue
Block a user