Closed
Description
Some raygui
controls reque one value to be passed and returned after being updated, those function could be redesigned to just pass the variable by reference for internal modification. This will simplify the function and also adds room for a possible return state value, like result of operation or similar (to be analyzed).
Affected functions:
Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll)
int GuiToggleGroup(Rectangle bounds, const char *text, int active);
int GuiComboBox(Rectangle bounds, const char *text, int active);
bool GuiCheckBox(Rectangle bounds, const char *text, bool checked);
float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue);
float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue);
float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue);
int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active);
Color GuiColorPicker(Rectangle bounds, const char *text, Color color);
Vector2 GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs);
Possible review:
int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll, Rectangle *view);
int GuiToggleGroup(Rectangle bounds, const char *text, int *active); // Return result=1 if toggle happened
int GuiComboBox(Rectangle bounds, const char *text, int *active); // Return result=1 if toggle happened
int GuiCheckBox(Rectangle bounds, const char *text, bool *checked); // Return result=1 if change happened
int GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue);
int GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue);
int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Return result=1 if 0% reached or result=2 if 100% reached
int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int *active); // Return result=1 if change happened
int GuiColorPicker(Rectangle bounds, const char *text, Color *color); // Return result=1 if mouse pressed
int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell);
Return values are optional. Consistency with other functions should also be considered.
In any case, it is a breaking change, probably to be considered for a raygui 4.0
release.
Metadata
Metadata
Assignees
Labels
No labels