summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog1
-rw-r--r--devnotes1
-rw-r--r--examples/gui/main.lua2
-rw-r--r--examples/raygui_lib/main.lua3
-rw-r--r--examples/resources/lib/raygui.lua277
-rw-r--r--include/raygui.h45
6 files changed, 154 insertions, 175 deletions
diff --git a/changelog b/changelog
index a9744d2..228bd0e 100644
--- a/changelog
+++ b/changelog
@@ -64,6 +64,7 @@ DETAILED CHANGES:
- CHANGE: Raymath *Equals functions return bool instead of int.
- FIXED: ColorToInt cast to unsigned int.
- ADDED: Many Gui controls accept now nil for text.
+ - ADDED: Some raygui controls return 1 instead of 0 when pressed or scrolled.
------------------------------------------------------------------------
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0
diff --git a/devnotes b/devnotes
index c77ec8f..5fb5536 100644
--- a/devnotes
+++ b/devnotes
@@ -3,7 +3,6 @@ Current {
Backlog {
* Raygui
- * GuiToggleSlider.
* ICON_ defines.
* Raygui lib
* Check if could remove flickering from changing draw order by making queue for order
diff --git a/examples/gui/main.lua b/examples/gui/main.lua
index 06c98bc..1ace3b3 100644
--- a/examples/gui/main.lua
+++ b/examples/gui/main.lua
@@ -107,7 +107,7 @@ function RL.draw()
_, comboBoxActive = RL.GuiComboBox( { 5, 150, 80, 20 }, "One;Two;Three", comboBoxActive )
- result, scrollPanel.scroll, scrollPanel.view = RL.GuiScrollPanel(
+ _, scrollPanel.scroll, scrollPanel.view = RL.GuiScrollPanel(
{ 64, 640, 320, 200 },
"Scroll panel",
{ 0, 0, 640, 400 },
diff --git a/examples/raygui_lib/main.lua b/examples/raygui_lib/main.lua
index c787d2e..95f6a6c 100644
--- a/examples/raygui_lib/main.lua
+++ b/examples/raygui_lib/main.lua
@@ -245,7 +245,8 @@ function RL.init()
"Cat;Dog;Horse;Cow;Dog;Horse;Cow",
0,
{ -- Callbacks.
- close = closeTab
+ close = closeTab,
+ select = function( self ) print( self:getItem( self.active ) ) end
}
)
local scrollpanel = Gui:ScrollPanel(
diff --git a/examples/resources/lib/raygui.lua b/examples/resources/lib/raygui.lua
index 0cff366..e0b3d91 100644
--- a/examples/resources/lib/raygui.lua
+++ b/examples/resources/lib/raygui.lua
@@ -219,22 +219,23 @@ function GuiTabBar:update()
return RL.CheckCollisionPointRec( RL.GetMousePosition(), self.bounds )
end
-function GuiTabBar:draw()
- local oldActive = self.active
- local result = -1
+function GuiTabBar:getItem( id )
+ return getItems( self.text )[ id + 1 ]
+end
- result, self.active = RL.GuiTabBar( self.bounds, self.text, self.active )
+function GuiTabBar:draw()
+ local result, active = RL.GuiTabBar( self.bounds, self.text, self.active )
- if self.active ~= oldActive then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.active = oldActive
- return
- end
+ if self.active ~= active then
+ if self._gui:clickedInBounds( self.bounds ) then
+ self.active = active
- if self.callbacks.select ~= nil then
- self.callbacks.select( self )
+ if self.callbacks.select ~= nil then
+ self.callbacks.select( self )
+ end
end
end
+
if 0 <= result and self.callbacks.close ~= nil and self._gui:clickedInBounds( self.bounds ) then
self.callbacks.close( self, result )
end
@@ -276,12 +277,11 @@ function ScrollPanel:update()
end
function ScrollPanel:draw()
- local oldScroll = self.scroll:clone()
- local _, scroll, view = RL.GuiScrollPanel( self.bounds, self.text, self.content, self.scroll, self.view )
+ local result, scroll, view = RL.GuiScrollPanel( self.bounds, self.text, self.content, self.scroll, self.view )
self.view:setT( view )
self.scroll:setT( scroll )
- if self.scroll ~= oldScroll then
+ if 0 < result then
self._gui:checkScrolling()
if self.callbacks.scroll ~= nil then
@@ -438,15 +438,10 @@ function Toggle:update()
end
function Toggle:draw()
- local oldActive = self.active
+ local result, active = RL.GuiToggle( self.bounds, self.text, self.active )
- _, self.active = RL.GuiToggle( self.bounds, self.text, self.active )
-
- if self.active ~= oldActive then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.active = oldActive
- return
- end
+ if 0 < result and self._gui:clickedInBounds( self.bounds ) then
+ self.active = active
if self.callbacks.pressed ~= nil then
self.callbacks.pressed( self )
@@ -532,11 +527,9 @@ function ToggleGroup:update()
end
function ToggleGroup:draw()
- local oldActive = self.active
+ local result, active = RL.GuiToggleGroup( self.bounds, self.text, self.active )
- _, self.active = RL.GuiToggleGroup( self.bounds, self.text, self.active )
-
- if self.active ~= oldActive then
+ if 0 < result then
local inBounds = false
for _, bounds in ipairs( self.focusBounds ) do
@@ -545,14 +538,12 @@ function ToggleGroup:draw()
break
end
end
+ if inBounds then
+ self.active = active
- if not inBounds then
- self.active = oldActive
- return
- end
-
- if self.callbacks.select ~= nil then
- self.callbacks.select( self )
+ if self.callbacks.select ~= nil then
+ self.callbacks.select( self )
+ end
end
end
end
@@ -596,21 +587,18 @@ function CheckBox:update()
end
function CheckBox:draw()
- local oldChecked = self.checked
- local textBounds = nil
-
- _, self.checked, textBounds = RL.GuiCheckBox( self.bounds, self.text, self.checked )
+ local result, checked, textBounds = RL.GuiCheckBox( self.bounds, self.text, self.checked )
self.textBounds:setT( textBounds )
self.focusBounds = self.bounds:fit( self.textBounds )
self._focusBoundsOffset:set( self.focusBounds.x - self.bounds.x, self.focusBounds.y - self.bounds.y )
- if self.checked ~= oldChecked then
- if not self._gui:clickedInBounds( self.focusBounds ) then
- self.checked = oldChecked
- end
+ if 0 < result then
+ if self._gui:clickedInBounds( self.focusBounds ) then
+ self.checked = checked
- if self.callbacks.pressed ~= nil then
- self.callbacks.pressed( self )
+ if self.callbacks.pressed ~= nil then
+ self.callbacks.pressed( self )
+ end
end
end
end
@@ -650,18 +638,15 @@ function ComboBox:update()
end
function ComboBox:draw()
- local oldActive = self.active
+ local result, active = RL.GuiComboBox( self.bounds, self.text, self.active )
- _, self.active = RL.GuiComboBox( self.bounds, self.text, self.active )
+ if 0 < result then
+ if self._gui:clickedInBounds( self.bounds ) then
+ self.active = active
- if self.active ~= oldActive then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.active = oldActive
- return
- end
-
- if self.callbacks.select ~= nil then
- self.callbacks.select( self )
+ if self.callbacks.select ~= nil then
+ self.callbacks.select( self )
+ end
end
end
end
@@ -777,11 +762,7 @@ function Spinner:update()
end
function Spinner:draw()
- local result = 0
- local oldValue = self.value
- local textBounds
-
- result, self.value, textBounds = RL.GuiSpinner( self.bounds, self.text, self.value, self.minValue, self.maxValue, self.editMode )
+ local result, value, textBounds = RL.GuiSpinner( self.bounds, self.text, self.value, self.minValue, self.maxValue, self.editMode )
self.textBounds:setT( textBounds )
self.viewBounds = self.bounds:fit( self.textBounds )
self._viewBoundsOffset:set( self.viewBounds.x - self.bounds.x, self.viewBounds.y - self.bounds.y )
@@ -790,15 +771,15 @@ function Spinner:draw()
self._gui:editMode( self )
self.editMode = not self.editMode
end
- if self.value ~= oldValue then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.value = oldValue
- return
- end
+ if self.value ~= value then
+ if self._gui:clickedInBounds( self.bounds ) then
+ self.value = value
- if self.callbacks.edit ~= nil then
- self.callbacks.edit( self )
+ if self.callbacks.edit ~= nil then
+ self.callbacks.edit( self )
+ end
end
+
end
end
@@ -965,23 +946,20 @@ function Slider:update()
end
function Slider:draw()
- local oldValue, textLeftBounds, textRightBounds = self.value, nil, nil
-
- _, self.value, textLeftBounds, textRightBounds = RL.GuiSlider( self.bounds, self.textLeft, self.textRight, self.value, self.minValue, self.maxValue )
+ local result, value, textLeftBounds, textRightBounds = RL.GuiSlider( self.bounds, self.textLeft, self.textRight, self.value, self.minValue, self.maxValue )
self.textLeftBounds:setT( textLeftBounds )
self.textRightBounds:setT( textRightBounds )
self.viewBounds = self.bounds:fit( self.textLeftBounds ):fit( self.textRightBounds )
self._viewBoundsOffset:set( self.viewBounds.x - self.bounds.x, self.viewBounds.y - self.bounds.y )
- if self.value ~= oldValue then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.value = oldValue
- return
- end
- self._gui:checkScrolling()
+ if 0 < result then
+ if self._gui:clickedInBounds( self.bounds ) then
+ self._gui:checkScrolling()
+ self.value = value
- if self.callbacks.edit ~= nil then
- self.callbacks.edit( self )
+ if self.callbacks.edit ~= nil then
+ self.callbacks.edit( self )
+ end
end
end
end
@@ -1029,23 +1007,20 @@ function SliderBar:update()
end
function SliderBar:draw()
- local oldValue, textLeftBounds, textRightBounds = self.value, nil, nil
-
- _, self.value, textLeftBounds, textRightBounds = RL.GuiSliderBar( self.bounds, self.textLeft, self.textRight, self.value, self.minValue, self.maxValue )
+ local result, value, textLeftBounds, textRightBounds = RL.GuiSliderBar( self.bounds, self.textLeft, self.textRight, self.value, self.minValue, self.maxValue )
self.textLeftBounds:setT( textLeftBounds )
self.textRightBounds:setT( textRightBounds )
self.viewBounds = self.bounds:fit( self.textLeftBounds ):fit( self.textRightBounds )
self._viewBoundsOffset:set( self.viewBounds.x - self.bounds.x, self.viewBounds.y - self.bounds.y )
- if self.value ~= oldValue then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.value = oldValue
- return
- end
- self._gui:checkScrolling()
+ if 0 < result then
+ if self._gui:clickedInBounds( self.bounds ) then
+ self._gui:checkScrolling()
+ self.value = value
- if self.callbacks.edit ~= nil then
- self.callbacks.edit( self )
+ if self.callbacks.edit ~= nil then
+ self.callbacks.edit( self )
+ end
end
end
end
@@ -1093,22 +1068,19 @@ function ProgressBar:update()
end
function ProgressBar:draw()
- local oldValue, textLeftBounds, textRightBounds = self.value, nil, nil
-
- _, self.value, textLeftBounds, textRightBounds = RL.GuiProgressBar( self.bounds, self.textLeft, self.textRight, self.value, self.minValue, self.maxValue )
+ local result, value, textLeftBounds, textRightBounds = RL.GuiProgressBar( self.bounds, self.textLeft, self.textRight, self.value, self.minValue, self.maxValue )
self.textLeftBounds:setT( textLeftBounds )
self.textRightBounds:setT( textRightBounds )
self.viewBounds = self.bounds:fit( self.textLeftBounds ):fit( self.textRightBounds )
self._viewBoundsOffset:set( self.viewBounds.x - self.bounds.x, self.viewBounds.y - self.bounds.y )
- if self.value ~= oldValue then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.value = oldValue
- return
- end
+ if 0 < result then
+ if self._gui:clickedInBounds( self.bounds ) then
+ self.value = value
- if self.callbacks.edit ~= nil then
- self.callbacks.edit( self )
+ if self.callbacks.edit ~= nil then
+ self.callbacks.edit( self )
+ end
end
end
end
@@ -1218,13 +1190,10 @@ function Grid:update()
end
function Grid:draw()
- local oldCell = self.mouseCell:clone()
- local mouseCell = {}
-
- _, mouseCell = RL.GuiGrid( self.bounds, self.text, self.spacing, self.subdivs, self.mouseCell )
+ local result, mouseCell = RL.GuiGrid( self.bounds, self.text, self.spacing, self.subdivs, self.mouseCell )
self.mouseCell:setT( mouseCell )
- if oldCell ~= self.mouseCell and self.callbacks.cellChange ~= nil then
+ if 0 < result and self.callbacks.cellChange ~= nil then
self.callbacks.cellChange( self )
end
end
@@ -1271,15 +1240,14 @@ function ListView:update()
end
function ListView:draw()
- local oldActive = self.active
- local oldScrollIndex = self.scrollIndex
+ local result, oldScrollIndex = 0, self.scrollIndex
- _, self.scrollIndex, self.active = RL.GuiListView( self.bounds, self.text, self.scrollIndex, self.active )
+ result, self.scrollIndex, self.active = RL.GuiListView( self.bounds, self.text, self.scrollIndex, self.active )
if self.scrollIndex ~= oldScrollIndex then
self._gui:checkScrolling()
end
- if oldActive ~= self.active and self.callbacks.select ~= nil then
+ if 0 < result and self.callbacks.select ~= nil then
self.callbacks.select( self )
end
end
@@ -1323,15 +1291,14 @@ function ListViewEx:update()
end
function ListViewEx:draw()
- local oldActive = self.active
- local oldScrollIndex = self.scrollIndex
+ local result, oldScrollIndex = 0, self.scrollIndex
- _, self.scrollIndex, self.active, self.focus = RL.GuiListViewEx( self.bounds, self.text, self.scrollIndex, self.active, self.focus )
+ result, self.scrollIndex, self.active, self.focus = RL.GuiListViewEx( self.bounds, self.text, self.scrollIndex, self.active, self.focus )
if self.scrollIndex ~= oldScrollIndex then
self._gui:checkScrolling()
end
- if oldActive ~= self.active and self.callbacks.select ~= nil then
+ if 0 < result and self.callbacks.select ~= nil then
self.callbacks.select( self )
end
end
@@ -1480,15 +1447,11 @@ function ColorPicker:updateFocusBounds()
end
function ColorPicker:draw()
- local oldColor = self.color:clone()
- local _, color = RL.GuiColorPicker( self.bounds, self.text, self.color )
-
- self.color = Color:newT( color )
+ local result, color = RL.GuiColorPicker( self.bounds, self.text, self.color )
- if self.color ~= oldColor then
- if not self._gui:clickedInBounds( self.focusBounds ) then
- self.color = oldColor
- return
+ if 0 < result then
+ if self._gui:clickedInBounds( self.focusBounds ) then
+ self.color = Color:newT( color )
end
self._gui:checkScrolling()
@@ -1532,19 +1495,15 @@ function ColorPanel:update()
end
function ColorPanel:draw()
- local oldColor = self.color:clone()
- local _, color = RL.GuiColorPanel( self.bounds, self.text, self.color )
-
- self.color = Color:newT( color )
-
- if oldColor ~= self.color then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.color = oldColor
- return
- end
-
- if self.callbacks.edit ~= nil then
- self.callbacks.edit( self )
+ local result, color = RL.GuiColorPanel( self.bounds, self.text, self.color )
+
+ if 0 < result then
+ if self._gui:clickedInBounds( self.bounds ) then
+ self.color:setT( color )
+
+ if self.callbacks.edit ~= nil then
+ self.callbacks.edit( self )
+ end
end
end
end
@@ -1582,18 +1541,16 @@ function ColorBarAlpha:update()
end
function ColorBarAlpha:draw()
- local oldAlpha = self.alpha
- _, self.alpha = RL.GuiColorBarAlpha( self.bounds, self.text, self.alpha )
+ local result, alpha = RL.GuiColorBarAlpha( self.bounds, self.text, self.alpha )
- if self.alpha ~= oldAlpha then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.alpha = oldAlpha
- return
- end
- self._gui:checkScrolling()
+ if 0 < result then
+ if self._gui:clickedInBounds( self.bounds ) then
+ self._gui:checkScrolling()
+ self.alpha = alpha
- if self.callbacks.edit ~= nil then
- self.callbacks.edit( self )
+ if self.callbacks.edit ~= nil then
+ self.callbacks.edit( self )
+ end
end
end
end
@@ -1631,18 +1588,16 @@ function ColorBarHue:update()
end
function ColorBarHue:draw()
- local oldValue = self.value
- _, self.value = RL.GuiColorBarHue( self.bounds, self.text, self.value )
+ local result, value = RL.GuiColorBarHue( self.bounds, self.text, self.value )
- if self.value ~= oldValue then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.value = oldValue
- return
- end
- self._gui:checkScrolling()
+ if 0 < result then
+ if self._gui:clickedInBounds( self.bounds ) then
+ self._gui:checkScrolling()
+ self.value = value
- if self.callbacks.edit ~= nil then
- self.callbacks.edit( self )
+ if self.callbacks.edit ~= nil then
+ self.callbacks.edit( self )
+ end
end
end
end
@@ -1666,7 +1621,7 @@ function GuiScrollBar:new( bounds, value, minValue, maxValue, callbacks, styles,
object.value = value
object.minValue = minValue
object.maxValue = maxValue
- object.callbacks = callbacks -- edit.
+ object.callbacks = callbacks -- scroll.
object.visible = true
object.disabled = false
@@ -1681,19 +1636,17 @@ function GuiScrollBar:update()
end
function GuiScrollBar:draw()
- local oldValue = self.value
-- Note. Scrollbar style should be determined by the control that uses it.
- self.value = RL.GuiScrollBar( self.bounds, self.value, self.minValue, self.maxValue )
+ local value = RL.GuiScrollBar( self.bounds, self.value, self.minValue, self.maxValue )
- if self.value ~= oldValue then
- if not self._gui:clickedInBounds( self.bounds ) then
- self.value = oldValue
- return
- end
- self._gui:checkScrolling()
+ if self.value ~= value then
+ if self._gui:clickedInBounds( self.bounds ) then
+ self._gui:checkScrolling()
+ self.value = value
- if self.callbacks.edit ~= nil then
- self.callbacks.edit( self )
+ if self.callbacks.scroll ~= nil then
+ self.callbacks.scroll( self )
+ end
end
end
end
diff --git a/include/raygui.h b/include/raygui.h
index 8486dc2..2d3a4ce 100644
--- a/include/raygui.h
+++ b/include/raygui.h
@@ -1775,6 +1775,7 @@ int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector
Rectangle temp = { 0 };
if (view == NULL) view = &temp;
+ Vector2 oldScroll = *scroll;
Vector2 scrollPos = { 0.0f, 0.0f };
if (scroll != NULL) scrollPos = *scroll;
@@ -1921,7 +1922,7 @@ int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector
if (scroll != NULL) *scroll = scrollPos;
- return result;
+ return !Vector2Equals( oldScroll, scrollPos );
}
// Label control
@@ -2035,6 +2036,7 @@ int GuiToggle(Rectangle bounds, const char *text, bool *active)
{
state = STATE_NORMAL;
*active = !(*active);
+ result = 1;
}
else state = STATE_FOCUSED;
}
@@ -2094,13 +2096,18 @@ int GuiToggleGroup(Rectangle bounds, const char *text, int *active)
if (i == (*active))
{
toggle = true;
- GuiToggle(bounds, items[i], &toggle);
+ if ( GuiToggle( bounds, items[i], &toggle ) ) {
+ result = 1;
+ }
}
else
{
toggle = false;
- GuiToggle(bounds, items[i], &toggle);
- if (toggle) *active = i;
+ GuiToggle( bounds, items[i], &toggle );
+ if (toggle) {
+ *active = i;
+ result = 1;
+ }
}
bounds.x += (bounds.width + GuiGetStyle(TOGGLE, GROUP_PADDING));
@@ -2221,7 +2228,10 @@ int GuiCheckBox(Rectangle bounds, const char *text, bool *checked, Rectangle *te
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED;
else state = STATE_FOCUSED;
- if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) *checked = !(*checked);
+ if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) {
+ *checked = !(*checked);
+ result = 1;
+ }
}
}
//--------------------------------------------------------------------
@@ -2280,6 +2290,7 @@ int GuiComboBox(Rectangle bounds, const char *text, int *active)
{
*active += 1;
if (*active >= itemCount) *active = 0; // Cyclic combobox
+ result = 1;
}
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED;
@@ -2969,6 +2980,7 @@ int GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight,
// Get equivalent value and slider position from mousePosition.x
*value = ((maxValue - minValue)*(mousePoint.x - (float)(bounds.x + sliderWidth/2)))/(float)(bounds.width - sliderWidth) + minValue;
+ result = 1;
}
}
else
@@ -3253,6 +3265,7 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollInd
{
if (itemSelected == (startIndex + i)) itemSelected = -1;
else itemSelected = startIndex + i;
+ result = 1;
}
break;
}
@@ -3401,7 +3414,7 @@ int GuiColorPanel(Rectangle bounds, const char *text, Color *color)
(unsigned char)(255.0f*rgb.y),
(unsigned char)(255.0f*rgb.z),
(unsigned char)(255.0f*(float)color->a/255.0f) };
-
+ result = 1;
}
else state = STATE_FOCUSED;
}
@@ -3459,6 +3472,7 @@ int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha)
*alpha = (mousePoint.x - bounds.x)/bounds.width;
if (*alpha <= 0.0f) *alpha = 0.0f;
if (*alpha >= 1.0f) *alpha = 1.0f;
+ result = 1;
}
}
else
@@ -3545,6 +3559,7 @@ int GuiColorBarHue(Rectangle bounds, const char *text, float *hue)
*hue = (mousePoint.y - bounds.y)*360/bounds.height;
if (*hue <= 0.0f) *hue = 0.0f;
if (*hue >= 359.0f) *hue = 359.0f;
+ result = 1;
}
}
else
@@ -3619,14 +3634,18 @@ int GuiColorPicker(Rectangle bounds, const char *text, Color *color)
Color temp = { 200, 0, 0, 255 };
if (color == NULL) color = &temp;
- GuiColorPanel(bounds, NULL, color);
+ if ( GuiColorPanel(bounds, NULL, color) ) {
+ result = 1;
+ }
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) };
Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ (*color).r/255.0f, (*color).g/255.0f, (*color).b/255.0f });
- GuiColorBarHue(boundsHue, NULL, &hsv.x);
+ if ( GuiColorBarHue(boundsHue, NULL, &hsv.x) ) {
+ result = 1;
+ }
//color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f);
Vector3 rgb = ConvertHSVtoRGB(hsv);
@@ -3656,11 +3675,15 @@ int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv)
colorHsv = &tempHsv;
}
- GuiColorPanelHSV(bounds, NULL, colorHsv);
+ if ( GuiColorPanelHSV(bounds, NULL, colorHsv) ) {
+ result = 1;
+ }
const Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height };
- GuiColorBarHue(boundsHue, NULL, &colorHsv->x);
+ if ( GuiColorBarHue(boundsHue, NULL, &colorHsv->x) ) {
+ result = 1;
+ }
return result;
}
@@ -3707,6 +3730,7 @@ int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv)
colorHsv->y = colorPick.x;
colorHsv->z = 1.0f - colorPick.y;
+ result = 1;
}
else state = STATE_FOCUSED;
}
@@ -3908,6 +3932,7 @@ int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vect
// NOTE: Cell values must be the upper left of the cell the mouse is in
currentMouseCell.x = floorf((mousePoint.x - bounds.x)/spacing);
currentMouseCell.y = floorf((mousePoint.y - bounds.y)/spacing);
+ result = 1;
}
}
//--------------------------------------------------------------------