summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md64
-rw-r--r--ReiLua_API.lua70
-rw-r--r--changelog1
-rw-r--r--devnotes4
-rw-r--r--examples/resources/lib/raygui.lua50
-rw-r--r--src/rgui.c177
-rw-r--r--src/rmath.c6
7 files changed, 209 insertions, 163 deletions
diff --git a/API.md b/API.md
index dd8306f..daf5d74 100644
--- a/API.md
+++ b/API.md
@@ -8339,7 +8339,7 @@ Get current music time played (in seconds)
Round float value
-- Success return float
+- Success return int
---
@@ -9222,7 +9222,7 @@ Get a quaternion for a given rotation matrix
> result = RL.QuaternionToMatrix( Quaternion q )
-Get a quaternion for a given rotation matrix
+Get a matrix for a given quaternion
- Success return Matrix
@@ -9416,7 +9416,7 @@ Set tooltip string
---
-> text = RL.GuiIconText( int iconId, string text )
+> text = RL.GuiIconText( int iconId, string|nil text )
Get text with icon id prepended (if supported)
@@ -9466,7 +9466,7 @@ Draw icon
---
-> result = RL.GuiWindowBox( Rectangle bounds, string title )
+> result = RL.GuiWindowBox( Rectangle bounds, string|nil title )
Window Box control, shows a window that can be closed
@@ -9474,7 +9474,7 @@ Window Box control, shows a window that can be closed
---
-> result = RL.GuiGroupBox( Rectangle bounds, string text )
+> result = RL.GuiGroupBox( Rectangle bounds, string|nil text )
Group Box control with text name
@@ -9482,7 +9482,7 @@ Group Box control with text name
---
-> result = RL.GuiLine( Rectangle bounds, string text )
+> result = RL.GuiLine( Rectangle bounds, string|nil text )
Line separator control, could contain text
@@ -9490,7 +9490,7 @@ Line separator control, could contain text
---
-> result = RL.GuiPanel( Rectangle bounds, string text )
+> result = RL.GuiPanel( Rectangle bounds, string|nil text )
Panel control, useful to group controls
@@ -9506,7 +9506,7 @@ Tab Bar control, returns TAB to be closed or -1
---
-> result, scroll, view = RL.GuiScrollPanel( Rectangle bounds, string text, Rectangle content, Vector2 scroll, Rectangle view )
+> result, scroll, view = RL.GuiScrollPanel( Rectangle bounds, string|nil text, Rectangle content, Vector2 scroll, Rectangle view )
Scroll Panel control
@@ -9518,7 +9518,7 @@ Scroll Panel control
---
-> result = RL.GuiLabel( Rectangle bounds, string text )
+> result = RL.GuiLabel( Rectangle bounds, string|nil text )
Label control, shows text
@@ -9526,7 +9526,7 @@ Label control, shows text
---
-> result = RL.GuiButton( Rectangle bounds, string text )
+> result = RL.GuiButton( Rectangle bounds, string|nil text )
Button control, returns true when clicked
@@ -9534,7 +9534,7 @@ Button control, returns true when clicked
---
-> result = RL.GuiLabelButton( Rectangle bounds, string text )
+> result = RL.GuiLabelButton( Rectangle bounds, string|nil text )
Label button control, show true when clicked
@@ -9542,7 +9542,7 @@ Label button control, show true when clicked
---
-> result, active = RL.GuiToggle( Rectangle bounds, string text, bool active )
+> result, active = RL.GuiToggle( Rectangle bounds, string|nil text, bool active )
Toggle Button control, returns true when active
@@ -9550,7 +9550,7 @@ Toggle Button control, returns true when active
---
-> result, active = RL.GuiToggleGroup( Rectangle bounds, string text, int active )
+> result, active = RL.GuiToggleGroup( Rectangle bounds, string|nil text, int active )
Toggle Group control, returns active toggle index
@@ -9558,7 +9558,7 @@ Toggle Group control, returns active toggle index
---
-> result, active = RL.GuiToggleSlider( Rectangle bounds, string text, int active )
+> result, active = RL.GuiToggleSlider( Rectangle bounds, string|nil text, int active )
Toggle Slider control, returns true when clicked
@@ -9566,7 +9566,7 @@ Toggle Slider control, returns true when clicked
---
-> result, checked, textBounds = RL.GuiCheckBox( Rectangle bounds, string text, bool checked )
+> result, checked, textBounds = RL.GuiCheckBox( Rectangle bounds, string|nil text, bool checked )
Check Box control, returns true when active
@@ -9574,7 +9574,7 @@ Check Box control, returns true when active
---
-> result, active = RL.GuiComboBox( Rectangle bounds, string text, int active )
+> result, active = RL.GuiComboBox( Rectangle bounds, string|nil text, int active )
Combo Box control, returns selected item index
@@ -9590,7 +9590,7 @@ Dropdown Box control, returns selected item
---
-> result, value, textBounds = RL.GuiSpinner( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode )
+> result, value, textBounds = RL.GuiSpinner( Rectangle bounds, string|nil text, int value, int minValue, int maxValue, bool editMode )
Spinner control, returns selected value
@@ -9598,7 +9598,7 @@ Spinner control, returns selected value
---
-> result, value, textBounds = RL.GuiValueBox( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode )
+> result, value, textBounds = RL.GuiValueBox( Rectangle bounds, string|nil text, int value, int minValue, int maxValue, bool editMode )
Value Box control, updates input text with numbers
@@ -9614,7 +9614,7 @@ Text Box control, updates input text
---
-> result, value, textLeftBounds, textRightBounds = RL.GuiSlider( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )
+> result, value, textLeftBounds, textRightBounds = RL.GuiSlider( Rectangle bounds, string|nil textLeft, string|nil textRight, float value, float minValue, float maxValue )
Slider control, returns selected value
@@ -9622,7 +9622,7 @@ Slider control, returns selected value
---
-> result, value, textLeftBounds, textRightBounds = RL.GuiSliderBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )
+> result, value, textLeftBounds, textRightBounds = RL.GuiSliderBar( Rectangle bounds, string|nil textLeft, string|nil textRight, float value, float minValue, float maxValue )
Slider Bar control, returns selected value
@@ -9630,7 +9630,7 @@ Slider Bar control, returns selected value
---
-> result, value, textLeftBounds, textRightBounds = RL.GuiProgressBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )
+> result, value, textLeftBounds, textRightBounds = RL.GuiProgressBar( Rectangle bounds, string|nil textLeft, string|nil textRight, float value, float minValue, float maxValue )
Progress Bar control, shows current progress value
@@ -9638,7 +9638,7 @@ Progress Bar control, shows current progress value
---
-> result = RL.GuiStatusBar( Rectangle bounds, string text )
+> result = RL.GuiStatusBar( Rectangle bounds, string|nil text )
Status Bar control, shows info text
@@ -9646,7 +9646,7 @@ Status Bar control, shows info text
---
-> result = RL.GuiDummyRec( Rectangle bounds, string text )
+> result = RL.GuiDummyRec( Rectangle bounds, string|nil text )
Dummy control for placeholders
@@ -9654,7 +9654,7 @@ Dummy control for placeholders
---
-> result, mouseCell = RL.GuiGrid( Rectangle bounds, string text, float spacing, int subdivs, Vector2 mouseCell )
+> result, mouseCell = RL.GuiGrid( Rectangle bounds, string|nil text, float spacing, int subdivs, Vector2 mouseCell )
Grid control, returns mouse cell position
@@ -9674,7 +9674,7 @@ Scroll bar control
---
-> result, scrollIndex, active = RL.GuiListView( Rectangle bounds, string text, int scrollIndex, int active )
+> result, scrollIndex, active = RL.GuiListView( Rectangle bounds, string|nil text, int scrollIndex, int active )
List View control, returns selected list item index
@@ -9690,7 +9690,7 @@ List View with extended parameters
---
-> result = RL.GuiMessageBox( Rectangle bounds, string title, string message, string buttons )
+> result = RL.GuiMessageBox( Rectangle bounds, string|nil title, string message, string buttons )
Message Box control, displays a message
@@ -9706,7 +9706,7 @@ Text Input Box control, ask for text, supports secret
---
-> result, color = RL.GuiColorPicker( Rectangle bounds, string text, Color color )
+> result, color = RL.GuiColorPicker( Rectangle bounds, string|nil text, Color color )
Color Picker control (multiple color controls)
@@ -9714,7 +9714,7 @@ Color Picker control (multiple color controls)
---
-> result, color = RL.GuiColorPanel( Rectangle bounds, string text, Color color )
+> result, color = RL.GuiColorPanel( Rectangle bounds, string|nil text, Color color )
Color Panel control
@@ -9722,7 +9722,7 @@ Color Panel control
---
-> result, alpha = RL.GuiColorBarAlpha( Rectangle bounds, string text, float alpha )
+> result, alpha = RL.GuiColorBarAlpha( Rectangle bounds, string|nil text, float alpha )
Color Bar Alpha control
@@ -9730,7 +9730,7 @@ Color Bar Alpha control
---
-> result, value = RL.GuiColorBarHue( Rectangle bounds, string text, float value )
+> result, value = RL.GuiColorBarHue( Rectangle bounds, string|nil text, float value )
Color Bar Hue control
@@ -9738,7 +9738,7 @@ Color Bar Hue control
---
-> result, colorHsv = RL.GuiColorPickerHSV( Rectangle bounds, string text, Vector3 colorHsv )
+> result, colorHsv = RL.GuiColorPickerHSV( Rectangle bounds, string|nil text, Vector3 colorHsv )
Color Picker control that avoids conversion to RGB on each call (multiple color controls)
@@ -9746,7 +9746,7 @@ Color Picker control that avoids conversion to RGB on each call (multiple color
---
-> result, colorHsv = RL.GuiColorPanelHSV( Rectangle bounds, string text, Vector3 colorHsv )
+> result, colorHsv = RL.GuiColorPanelHSV( Rectangle bounds, string|nil text, Vector3 colorHsv )
Color Panel control that returns HSV color value, used by GuiColorPickerHSV()
diff --git a/ReiLua_API.lua b/ReiLua_API.lua
index 135176e..ee18b2d 100644
--- a/ReiLua_API.lua
+++ b/ReiLua_API.lua
@@ -5416,7 +5416,7 @@ function RL.GetMusicTimePlayed( music ) end
-- Math - Utils
---Round float value
----- Success return float
+---- Success return int
---@param value number
---@return any result
function RL.Round( value ) end
@@ -6179,7 +6179,7 @@ function RL.QuaternionFromVector3ToVector3( from, to ) end
---@return any result
function RL.QuaternionFromMatrix( mat ) end
----Get a quaternion for a given rotation matrix
+---Get a matrix for a given quaternion
---- Success return Matrix
---@param q table
---@return any result
@@ -6329,7 +6329,7 @@ function RL.GuiSetTooltip( tooltip ) end
---Get text with icon id prepended (if supported)
---- Success return string
---@param iconId integer
----@param text string
+---@param text string|nil
---@return any text
function RL.GuiIconText( iconId, text ) end
@@ -6371,28 +6371,28 @@ function RL.GuiDrawIcon( iconId, pos, pixelSize, color ) end
---Window Box control, shows a window that can be closed
---- Success return int
---@param bounds table
----@param title string
+---@param title string|nil
---@return any result
function RL.GuiWindowBox( bounds, title ) end
---Group Box control with text name
---- Success return int
---@param bounds table
----@param text string
+---@param text string|nil
---@return any result
function RL.GuiGroupBox( bounds, text ) end
---Line separator control, could contain text
---- Success return int
---@param bounds table
----@param text string
+---@param text string|nil
---@return any result
function RL.GuiLine( bounds, text ) end
---Panel control, useful to group controls
---- Success return int
---@param bounds table
----@param text string
+---@param text string|nil
---@return any result
function RL.GuiPanel( bounds, text ) end
@@ -6408,7 +6408,7 @@ function RL.GuiTabBar( bounds, text, active ) end
---Scroll Panel control
---- Success return int, Vector2, Rectangle
---@param bounds table
----@param text string
+---@param text string|nil
---@param content table
---@param scroll table
---@param view table
@@ -6422,28 +6422,28 @@ function RL.GuiScrollPanel( bounds, text, content, scroll, view ) end
---Label control, shows text
---- Success return int
---@param bounds table
----@param text string
+---@param text string|nil
---@return any result
function RL.GuiLabel( bounds, text ) end
---Button control, returns true when clicked
---- Success return int
---@param bounds table
----@param text string
+---@param text string|nil
---@return any result
function RL.GuiButton( bounds, text ) end
---Label button control, show true when clicked
---- Success return int
---@param bounds table
----@param text string
+---@param text string|nil
---@return any result
function RL.GuiLabelButton( bounds, text ) end
---Toggle Button control, returns true when active
---- Success return int, bool
---@param bounds table
----@param text string
+---@param text string|nil
---@param active boolean
---@return any result
---@return any active
@@ -6452,7 +6452,7 @@ function RL.GuiToggle( bounds, text, active ) end
---Toggle Group control, returns active toggle index
---- Success return int, int
---@param bounds table
----@param text string
+---@param text string|nil
---@param active integer
---@return any result
---@return any active
@@ -6461,7 +6461,7 @@ function RL.GuiToggleGroup( bounds, text, active ) end
---Toggle Slider control, returns true when clicked
---- Success return int, int
---@param bounds table
----@param text string
+---@param text string|nil
---@param active integer
---@return any result
---@return any active
@@ -6470,7 +6470,7 @@ function RL.GuiToggleSlider( bounds, text, active ) end
---Check Box control, returns true when active
---- Success return bool, Rectangle
---@param bounds table
----@param text string
+---@param text string|nil
---@param checked boolean
---@return any result
---@return any checked
@@ -6480,7 +6480,7 @@ function RL.GuiCheckBox( bounds, text, checked ) end
---Combo Box control, returns selected item index
---- Success return int, int
---@param bounds table
----@param text string
+---@param text string|nil
---@param active integer
---@return any result
---@return any active
@@ -6499,7 +6499,7 @@ function RL.GuiDropdownBox( bounds, text, active, editMode ) end
---Spinner control, returns selected value
---- Success return int, int, Rectangle
---@param bounds table
----@param text string
+---@param text string|nil
---@param value integer
---@param minValue integer
---@param maxValue integer
@@ -6512,7 +6512,7 @@ function RL.GuiSpinner( bounds, text, value, minValue, maxValue, editMode ) end
---Value Box control, updates input text with numbers
---- Success return int, int, Rectangle
---@param bounds table
----@param text string
+---@param text string|nil
---@param value integer
---@param minValue integer
---@param maxValue integer
@@ -6535,8 +6535,8 @@ function RL.GuiTextBox( bounds, text, textSize, editMode ) end
---Slider control, returns selected value
---- Success return int, float, Rectangle, Rectangle
---@param bounds table
----@param textLeft string
----@param textRight string
+---@param textLeft string|nil
+---@param textRight string|nil
---@param value number
---@param minValue number
---@param maxValue number
@@ -6549,8 +6549,8 @@ function RL.GuiSlider( bounds, textLeft, textRight, value, minValue, maxValue )
---Slider Bar control, returns selected value
---- Success return int, float, Rectangle, Rectangle
---@param bounds table
----@param textLeft string
----@param textRight string
+---@param textLeft string|nil
+---@param textRight string|nil
---@param value number
---@param minValue number
---@param maxValue number
@@ -6563,8 +6563,8 @@ function RL.GuiSliderBar( bounds, textLeft, textRight, value, minValue, maxValue
---Progress Bar control, shows current progress value
---- Success return int, float, Rectangle, Rectangle
---@param bounds table
----@param textLeft string
----@param textRight string
+---@param textLeft string|nil
+---@param textRight string|nil
---@param value number
---@param minValue number
---@param maxValue number
@@ -6577,21 +6577,21 @@ function RL.GuiProgressBar( bounds, textLeft, textRight, value, minValue, maxVal
---Status Bar control, shows info text
---- Success return int
---@param bounds table
----@param text string
+---@param text string|nil
---@return any result
function RL.GuiStatusBar( bounds, text ) end
---Dummy control for placeholders
---- Success return int
---@param bounds table
----@param text string
+---@param text string|nil
---@return any result
function RL.GuiDummyRec( bounds, text ) end
---Grid control, returns mouse cell position
---- Success return int, Vector2
---@param bounds table
----@param text string
+---@param text string|nil
---@param spacing number
---@param subdivs integer
---@param mouseCell table
@@ -6613,7 +6613,7 @@ function RL.GuiScrollBar( bounds, value, minValue, maxValue ) end
---List View control, returns selected list item index
---- Success return int, int, int
---@param bounds table
----@param text string
+---@param text string|nil
---@param scrollIndex integer
---@param active integer
---@return any result
@@ -6637,7 +6637,7 @@ function RL.GuiListViewEx( bounds, text, scrollIndex, active, focus ) end
---Message Box control, displays a message
---- Success return int
---@param bounds table
----@param title string
+---@param title string|nil
---@param message string
---@param buttons string
---@return any result
@@ -6660,7 +6660,7 @@ function RL.GuiTextInputBox( bounds, title, message, buttons, text, textMaxSize,
---Color Picker control (multiple color controls)
---- Success return int, Color
---@param bounds table
----@param text string
+---@param text string|nil
---@param color table
---@return any result
---@return any color
@@ -6669,7 +6669,7 @@ function RL.GuiColorPicker( bounds, text, color ) end
---Color Panel control
---- Success return int, Color
---@param bounds table
----@param text string
+---@param text string|nil
---@param color table
---@return any result
---@return any color
@@ -6678,7 +6678,7 @@ function RL.GuiColorPanel( bounds, text, color ) end
---Color Bar Alpha control
---- Success return int, float
---@param bounds table
----@param text string
+---@param text string|nil
---@param alpha number
---@return any result
---@return any alpha
@@ -6687,7 +6687,7 @@ function RL.GuiColorBarAlpha( bounds, text, alpha ) end
---Color Bar Hue control
---- Success return int, float
---@param bounds table
----@param text string
+---@param text string|nil
---@param value number
---@return any result
---@return any value
@@ -6696,7 +6696,7 @@ function RL.GuiColorBarHue( bounds, text, value ) end
---Color Picker control that avoids conversion to RGB on each call (multiple color controls)
---- Success return int, Vector3
---@param bounds table
----@param text string
+---@param text string|nil
---@param colorHsv table
---@return any result
---@return any colorHsv
@@ -6705,7 +6705,7 @@ function RL.GuiColorPickerHSV( bounds, text, colorHsv ) end
---Color Panel control that returns HSV color value, used by GuiColorPickerHSV()
---- Success return int, Vector3
---@param bounds table
----@param text string
+---@param text string|nil
---@param colorHsv table
---@return any result
---@return any colorHsv
diff --git a/changelog b/changelog
index 0c324d1..a9744d2 100644
--- a/changelog
+++ b/changelog
@@ -63,6 +63,7 @@ DETAILED CHANGES:
- ADDED: GetMouseOffset and GetMouseScale.
- CHANGE: Raymath *Equals functions return bool instead of int.
- FIXED: ColorToInt cast to unsigned int.
+ - ADDED: Many Gui controls accept now nil for text.
------------------------------------------------------------------------
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0
diff --git a/devnotes b/devnotes
index fc82bbc..c77ec8f 100644
--- a/devnotes
+++ b/devnotes
@@ -3,6 +3,7 @@ Current {
Backlog {
* Raygui
+ * GuiToggleSlider.
* ICON_ defines.
* Raygui lib
* Check if could remove flickering from changing draw order by making queue for order
@@ -19,6 +20,9 @@ Backlog {
* Improve Dungeon crawler example by generating custom mesh instead of drawing 3D quads.
* Platformer example physics update for true framerate independence.
* Android support
+
+ * For raylib 5.5
+ * DrawBillboardPro BREAKING CHANGE.
}
Bugs {
diff --git a/examples/resources/lib/raygui.lua b/examples/resources/lib/raygui.lua
index 825bb26..0cff366 100644
--- a/examples/resources/lib/raygui.lua
+++ b/examples/resources/lib/raygui.lua
@@ -2035,17 +2035,17 @@ end
---@alias Color table
---@param bounds Rectangle
----@param text string
+---@param title string|nil
---@param callbacks table close, grab, drag.
---@param styles table|nil
---@param tooltip string|nil
---@return table WindowBox
-function Raygui:WindowBox( bounds, text, callbacks, styles, tooltip )
- return self:addControl( WindowBox:new( bounds, text, callbacks, styles, tooltip ) )
+function Raygui:WindowBox( bounds, title, callbacks, styles, tooltip )
+ return self:addControl( WindowBox:new( bounds, title, callbacks, styles, tooltip ) )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param styles table|nil
---@param tooltip string|nil
---@return table GroupBox
@@ -2054,7 +2054,7 @@ function Raygui:GroupBox( bounds, text, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param styles table|nil
---@param tooltip string|nil
---@return table Line
@@ -2063,7 +2063,7 @@ function Raygui:Line( bounds, text, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param callbacks table grab, drag.
---@param styles table|nil
---@param tooltip string|nil
@@ -2073,7 +2073,7 @@ function Raygui:Panel( bounds, text, callbacks, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param active integer
---@param callbacks table select, close, grab, drag.
---@param styles table|nil
@@ -2084,7 +2084,7 @@ function Raygui:GuiTabBar( bounds, text, active, callbacks, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param content Rectangle
---@param scroll Vector2
---@param callbacks table scroll, grab, drag.
@@ -2096,7 +2096,7 @@ function Raygui:ScrollPanel( bounds, text, content, scroll, callbacks, styles, t
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param styles table|nil
---@param tooltip string|nil
---@return table Label
@@ -2105,7 +2105,7 @@ function Raygui:Label( bounds, text, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param callbacks table pressed.
---@param styles table|nil
---@param tooltip string|nil
@@ -2115,7 +2115,7 @@ function Raygui:Button( bounds, text, callbacks, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param callbacks table pressed.
---@param styles table|nil
---@param tooltip string|nil
@@ -2125,7 +2125,7 @@ function Raygui:LabelButton( bounds, text, callbacks, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param active boolean
---@param callbacks table pressed.
---@param styles table|nil
@@ -2136,7 +2136,7 @@ function Raygui:Toggle( bounds, text, active, callbacks, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param active integer
---@param callbacks table select.
---@param styles table|nil
@@ -2147,7 +2147,7 @@ function Raygui:ToggleGroup( bounds, text, active, callbacks, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param checked boolean
---@param callbacks table pressed.
---@param styles table|nil
@@ -2158,7 +2158,7 @@ function Raygui:CheckBox( bounds, text, checked, callbacks, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param active integer
---@param callbacks table select.
---@param styles table|nil
@@ -2181,7 +2181,7 @@ function Raygui:DropdownBox( bounds, text, active, editMode, callbacks, styles,
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param value integer
---@param minValue integer
---@param maxValue integer
@@ -2195,7 +2195,7 @@ function Raygui:Spinner( bounds, text, value, minValue, maxValue, editMode, call
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param value integer
---@param minValue integer
---@param maxValue integer
@@ -2263,7 +2263,7 @@ function Raygui:ProgressBar( bounds, textLeft, textRight, value, minValue, maxVa
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param styles table|nil
---@param tooltip string|nil
---@return table StatusBar
@@ -2272,7 +2272,7 @@ function Raygui:StatusBar( bounds, text, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param styles table|nil
---@param tooltip string|nil
---@return table DummyRec
@@ -2281,7 +2281,7 @@ function Raygui:DummyRec( bounds, text, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param spacing number
---@param subdivs integer
---@param callbacks table cellChange.
@@ -2293,7 +2293,7 @@ function Raygui:Grid( bounds, text, spacing, subdivs, callbacks, styles, tooltip
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param scrollIndex integer
---@param active integer
---@param callbacks table select.
@@ -2345,7 +2345,7 @@ function Raygui:TextInputBox( bounds, title, message, buttons, text, textMaxSize
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param color Color
---@param callbacks table edit.
---@param styles table|nil
@@ -2356,7 +2356,7 @@ function Raygui:ColorPicker( bounds, text, color, callbacks, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param color Color
---@param callbacks table edit.
---@param styles table|nil
@@ -2367,7 +2367,7 @@ function Raygui:ColorPanel( bounds, text, color, callbacks, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param alpha number
---@param callbacks table edit.
---@param styles table|nil
@@ -2378,7 +2378,7 @@ function Raygui:ColorBarAlpha( bounds, text, alpha, callbacks, styles, tooltip )
end
---@param bounds Rectangle
----@param text string
+---@param text string|nil
---@param value number
---@param callbacks table edit.
---@param styles table|nil
diff --git a/src/rgui.c b/src/rgui.c
index 4adb222..fb749f2 100644
--- a/src/rgui.c
+++ b/src/rgui.c
@@ -7,6 +7,15 @@
#define RAYGUI_IMPLEMENTATION
#include "raygui.h"
+inline char* getTextOrNil( lua_State* L, int index ) {
+ char* text = NULL;
+
+ if ( lua_isstring( L, index ) ) {
+ text = (char*)lua_tostring( L, index );
+ }
+ return text;
+}
+
/*
## Gui - Global gui state control functions
*/
@@ -254,7 +263,7 @@ int lguiGuiSetTooltip( lua_State* L ) {
*/
/*
-> text = RL.GuiIconText( int iconId, string text )
+> text = RL.GuiIconText( int iconId, string|nil text )
Get text with icon id prepended (if supported)
@@ -262,13 +271,9 @@ Get text with icon id prepended (if supported)
*/
int lguiGuiIconText( lua_State* L ) {
int iconId = luaL_checkinteger( L, 1 );
+ char* text = getTextOrNil( L, 2 );
- if ( TextIsEqual( luaL_checkstring( L, 2 ), "" ) ) {
- lua_pushstring( L, GuiIconText( iconId, NULL ) );
- }
- else {
- lua_pushstring( L, GuiIconText( iconId, luaL_checkstring( L, 2 ) ) );
- }
+ lua_pushstring( L, GuiIconText( iconId, text ) );
return 1;
}
@@ -386,7 +391,7 @@ int lguiGuiDrawIcon( lua_State* L ) {
*/
/*
-> result = RL.GuiWindowBox( Rectangle bounds, string title )
+> result = RL.GuiWindowBox( Rectangle bounds, string|nil title )
Window Box control, shows a window that can be closed
@@ -394,14 +399,15 @@ Window Box control, shows a window that can be closed
*/
int lguiGuiWindowBox( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* title = getTextOrNil( L, 2 );
- lua_pushinteger( L, GuiWindowBox( bounds, luaL_checkstring( L, 2 ) ) );
+ lua_pushinteger( L, GuiWindowBox( bounds, title ) );
return 1;
}
/*
-> result = RL.GuiGroupBox( Rectangle bounds, string text )
+> result = RL.GuiGroupBox( Rectangle bounds, string|nil text )
Group Box control with text name
@@ -409,14 +415,15 @@ Group Box control with text name
*/
int lguiGuiGroupBox( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
- lua_pushinteger( L, GuiGroupBox( bounds, luaL_checkstring( L, 2 ) ) );
+ lua_pushinteger( L, GuiGroupBox( bounds, text ) );
return 1;
}
/*
-> result = RL.GuiLine( Rectangle bounds, string text )
+> result = RL.GuiLine( Rectangle bounds, string|nil text )
Line separator control, could contain text
@@ -424,14 +431,15 @@ Line separator control, could contain text
*/
int lguiGuiLine( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
- lua_pushinteger( L, GuiLine( bounds, luaL_checkstring( L, 2 ) ) );
+ lua_pushinteger( L, GuiLine( bounds, text ) );
return 1;
}
/*
-> result = RL.GuiPanel( Rectangle bounds, string text )
+> result = RL.GuiPanel( Rectangle bounds, string|nil text )
Panel control, useful to group controls
@@ -439,8 +447,9 @@ Panel control, useful to group controls
*/
int lguiGuiPanel( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
- lua_pushinteger( L, GuiPanel( bounds, luaL_checkstring( L, 2 ) ) );
+ lua_pushinteger( L, GuiPanel( bounds, text ) );
return 1;
}
@@ -466,7 +475,7 @@ int lguiGuiTabBar( lua_State* L ) {
}
/*
-> result, scroll, view = RL.GuiScrollPanel( Rectangle bounds, string text, Rectangle content, Vector2 scroll, Rectangle view )
+> result, scroll, view = RL.GuiScrollPanel( Rectangle bounds, string|nil text, Rectangle content, Vector2 scroll, Rectangle view )
Scroll Panel control
@@ -474,11 +483,12 @@ Scroll Panel control
*/
int lguiGuiScrollPanel( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
Rectangle content = uluaGetRectangle( L, 3 );
Vector2 scroll = uluaGetVector2( L, 4 );
Rectangle view = uluaGetRectangle( L, 5 );
- lua_pushinteger( L, GuiScrollPanel( bounds, luaL_checkstring( L, 2 ), content, &scroll, &view ) );
+ lua_pushinteger( L, GuiScrollPanel( bounds, text, content, &scroll, &view ) );
uluaPushVector2( L, scroll );
uluaPushRectangle( L, view );
@@ -490,7 +500,7 @@ int lguiGuiScrollPanel( lua_State* L ) {
*/
/*
-> result = RL.GuiLabel( Rectangle bounds, string text )
+> result = RL.GuiLabel( Rectangle bounds, string|nil text )
Label control, shows text
@@ -498,14 +508,15 @@ Label control, shows text
*/
int lguiGuiLabel( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
- lua_pushinteger( L, GuiLabel( bounds, luaL_checkstring( L, 2 ) ) );
+ lua_pushinteger( L, GuiLabel( bounds, text ) );
return 1;
}
/*
-> result = RL.GuiButton( Rectangle bounds, string text )
+> result = RL.GuiButton( Rectangle bounds, string|nil text )
Button control, returns true when clicked
@@ -513,14 +524,15 @@ Button control, returns true when clicked
*/
int lguiGuiButton( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
- lua_pushinteger( L, GuiButton( bounds, luaL_checkstring( L, 2 ) ) );
+ lua_pushinteger( L, GuiButton( bounds, text ) );
return 1;
}
/*
-> result = RL.GuiLabelButton( Rectangle bounds, string text )
+> result = RL.GuiLabelButton( Rectangle bounds, string|nil text )
Label button control, show true when clicked
@@ -528,14 +540,15 @@ Label button control, show true when clicked
*/
int lguiGuiLabelButton( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
- lua_pushinteger( L, GuiLabelButton( bounds, luaL_checkstring( L, 2 ) ) );
+ lua_pushinteger( L, GuiLabelButton( bounds, text ) );
return 1;
}
/*
-> result, active = RL.GuiToggle( Rectangle bounds, string text, bool active )
+> result, active = RL.GuiToggle( Rectangle bounds, string|nil text, bool active )
Toggle Button control, returns true when active
@@ -543,16 +556,17 @@ Toggle Button control, returns true when active
*/
int lguiGuiToggle( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
bool active = uluaGetBoolean( L, 3 );
- lua_pushinteger( L, GuiToggle( bounds, luaL_checkstring( L, 2 ), &active ) );
+ lua_pushinteger( L, GuiToggle( bounds, text, &active ) );
lua_pushboolean( L, active );
return 2;
}
/*
-> result, active = RL.GuiToggleGroup( Rectangle bounds, string text, int active )
+> result, active = RL.GuiToggleGroup( Rectangle bounds, string|nil text, int active )
Toggle Group control, returns active toggle index
@@ -560,16 +574,17 @@ Toggle Group control, returns active toggle index
*/
int lguiGuiToggleGroup( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
int active = luaL_checkinteger( L, 3 );
- lua_pushinteger( L, GuiToggleGroup( bounds, luaL_checkstring( L, 2 ), &active ) );
+ lua_pushinteger( L, GuiToggleGroup( bounds, text, &active ) );
lua_pushinteger( L, active );
return 2;
}
/*
-> result, active = RL.GuiToggleSlider( Rectangle bounds, string text, int active )
+> result, active = RL.GuiToggleSlider( Rectangle bounds, string|nil text, int active )
Toggle Slider control, returns true when clicked
@@ -577,16 +592,17 @@ Toggle Slider control, returns true when clicked
*/
int lguiGuiToggleSlider( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
int active = luaL_checkinteger( L, 3 );
- lua_pushinteger( L, GuiToggleSlider( bounds, luaL_checkstring( L, 2 ), &active ) );
+ lua_pushinteger( L, GuiToggleSlider( bounds, text, &active ) );
lua_pushinteger( L, active );
return 2;
}
/*
-> result, checked, textBounds = RL.GuiCheckBox( Rectangle bounds, string text, bool checked )
+> result, checked, textBounds = RL.GuiCheckBox( Rectangle bounds, string|nil text, bool checked )
Check Box control, returns true when active
@@ -594,10 +610,11 @@ Check Box control, returns true when active
*/
int lguiGuiCheckBox( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
bool checked = uluaGetBoolean( L, 3 );
Rectangle textBounds = {};
- lua_pushinteger( L, GuiCheckBox( bounds, luaL_checkstring( L, 2 ), &checked, &textBounds ) );
+ lua_pushinteger( L, GuiCheckBox( bounds, text, &checked, &textBounds ) );
lua_pushboolean( L, checked );
uluaPushRectangle( L, textBounds );
@@ -605,7 +622,7 @@ int lguiGuiCheckBox( lua_State* L ) {
}
/*
-> result, active = RL.GuiComboBox( Rectangle bounds, string text, int active )
+> result, active = RL.GuiComboBox( Rectangle bounds, string|nil text, int active )
Combo Box control, returns selected item index
@@ -613,9 +630,10 @@ Combo Box control, returns selected item index
*/
int lguiGuiComboBox( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
int active = luaL_checkinteger( L, 3 );
- lua_pushinteger( L, GuiComboBox( bounds, luaL_checkstring( L, 2 ), &active ) );
+ lua_pushinteger( L, GuiComboBox( bounds, text, &active ) );
lua_pushinteger( L, active );
return 2;
@@ -630,17 +648,18 @@ Dropdown Box control, returns selected item
*/
int lguiGuiDropdownBox( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ const char* text = luaL_checkstring( L, 2 );
int active = luaL_checkinteger( L, 3 );
bool editMode = uluaGetBoolean( L, 4 );
- lua_pushinteger( L, GuiDropdownBox( bounds, luaL_checkstring( L, 2 ), &active, editMode ) );
+ lua_pushinteger( L, GuiDropdownBox( bounds, text, &active, editMode ) );
lua_pushinteger( L, active );
return 2;
}
/*
-> result, value, textBounds = RL.GuiSpinner( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode )
+> result, value, textBounds = RL.GuiSpinner( Rectangle bounds, string|nil text, int value, int minValue, int maxValue, bool editMode )
Spinner control, returns selected value
@@ -648,13 +667,14 @@ Spinner control, returns selected value
*/
int lguiGuiSpinner( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
int value = luaL_checkinteger( L, 3 );
int minValue = luaL_checkinteger( L, 4 );
int maxValue = luaL_checkinteger( L, 5 );
bool editMode = uluaGetBoolean( L, 6 );
Rectangle textBounds = { 0 };
- lua_pushinteger( L, GuiSpinner( bounds, luaL_checkstring( L, 2 ), &value, minValue, maxValue, editMode, &textBounds ) );
+ lua_pushinteger( L, GuiSpinner( bounds, text, &value, minValue, maxValue, editMode, &textBounds ) );
lua_pushinteger( L, value );
uluaPushRectangle( L, textBounds );
@@ -662,7 +682,7 @@ int lguiGuiSpinner( lua_State* L ) {
}
/*
-> result, value, textBounds = RL.GuiValueBox( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode )
+> result, value, textBounds = RL.GuiValueBox( Rectangle bounds, string|nil text, int value, int minValue, int maxValue, bool editMode )
Value Box control, updates input text with numbers
@@ -670,13 +690,14 @@ Value Box control, updates input text with numbers
*/
int lguiGuiValueBox( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
int value = luaL_checkinteger( L, 3 );
int minValue = luaL_checkinteger( L, 4 );
int maxValue = luaL_checkinteger( L, 5 );
bool editMode = uluaGetBoolean( L, 6 );
Rectangle textBounds = { 0 };
- lua_pushinteger( L, GuiValueBox( bounds, luaL_checkstring( L, 2 ), &value, minValue, maxValue, editMode, &textBounds ) );
+ lua_pushinteger( L, GuiValueBox( bounds, text, &value, minValue, maxValue, editMode, &textBounds ) );
lua_pushinteger( L, value );
uluaPushRectangle( L, textBounds );
@@ -704,7 +725,7 @@ int lguiGuiTextBox( lua_State* L ) {
}
/*
-> result, value, textLeftBounds, textRightBounds = RL.GuiSlider( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )
+> result, value, textLeftBounds, textRightBounds = RL.GuiSlider( Rectangle bounds, string|nil textLeft, string|nil textRight, float value, float minValue, float maxValue )
Slider control, returns selected value
@@ -712,13 +733,15 @@ Slider control, returns selected value
*/
int lguiGuiSlider( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* textLeft = getTextOrNil( L, 2 );
+ char* textRight = getTextOrNil( L, 3 );
float value = luaL_checknumber( L, 4 );
float minValue = luaL_checknumber( L, 5 );
float maxValue = luaL_checknumber( L, 6 );
Rectangle textLeftBounds = { 0 };
Rectangle textRightBounds = { 0 };
- lua_pushinteger( L, GuiSlider( bounds, luaL_checkstring( L, 2 ), luaL_checkstring( L, 3 ), &value, minValue, maxValue, &textLeftBounds, &textRightBounds ) );
+ lua_pushinteger( L, GuiSlider( bounds, textLeft, textRight, &value, minValue, maxValue, &textLeftBounds, &textRightBounds ) );
lua_pushnumber( L, value );
uluaPushRectangle( L, textLeftBounds );
uluaPushRectangle( L, textRightBounds );
@@ -727,7 +750,7 @@ int lguiGuiSlider( lua_State* L ) {
}
/*
-> result, value, textLeftBounds, textRightBounds = RL.GuiSliderBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )
+> result, value, textLeftBounds, textRightBounds = RL.GuiSliderBar( Rectangle bounds, string|nil textLeft, string|nil textRight, float value, float minValue, float maxValue )
Slider Bar control, returns selected value
@@ -735,13 +758,15 @@ Slider Bar control, returns selected value
*/
int lguiGuiSliderBar( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* textLeft = getTextOrNil( L, 2 );
+ char* textRight = getTextOrNil( L, 3 );
float value = luaL_checknumber( L, 4 );
float minValue = luaL_checknumber( L, 5 );
float maxValue = luaL_checknumber( L, 6 );
Rectangle textLeftBounds = { 0 };
Rectangle textRightBounds = { 0 };
- lua_pushinteger( L, GuiSliderBar( bounds, luaL_checkstring( L, 2 ), luaL_checkstring( L, 3 ), &value, minValue, maxValue, &textLeftBounds, &textRightBounds ) );
+ lua_pushinteger( L, GuiSliderBar( bounds, textLeft, textRight, &value, minValue, maxValue, &textLeftBounds, &textRightBounds ) );
lua_pushnumber( L, value );
uluaPushRectangle( L, textLeftBounds );
uluaPushRectangle( L, textRightBounds );
@@ -750,7 +775,7 @@ int lguiGuiSliderBar( lua_State* L ) {
}
/*
-> result, value, textLeftBounds, textRightBounds = RL.GuiProgressBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )
+> result, value, textLeftBounds, textRightBounds = RL.GuiProgressBar( Rectangle bounds, string|nil textLeft, string|nil textRight, float value, float minValue, float maxValue )
Progress Bar control, shows current progress value
@@ -758,13 +783,15 @@ Progress Bar control, shows current progress value
*/
int lguiGuiProgressBar( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* textLeft = getTextOrNil( L, 2 );
+ char* textRight = getTextOrNil( L, 3 );
float value = luaL_checknumber( L, 4 );
float minValue = luaL_checknumber( L, 5 );
float maxValue = luaL_checknumber( L, 6 );
Rectangle textLeftBounds = { 0 };
Rectangle textRightBounds = { 0 };
- lua_pushinteger( L, GuiProgressBar( bounds, luaL_checkstring( L, 2 ), luaL_checkstring( L, 3 ), &value, minValue, maxValue, &textLeftBounds, &textRightBounds ) );
+ lua_pushinteger( L, GuiProgressBar( bounds, textLeft, textRight, &value, minValue, maxValue, &textLeftBounds, &textRightBounds ) );
lua_pushnumber( L, value );
uluaPushRectangle( L, textLeftBounds );
uluaPushRectangle( L, textRightBounds );
@@ -773,7 +800,7 @@ int lguiGuiProgressBar( lua_State* L ) {
}
/*
-> result = RL.GuiStatusBar( Rectangle bounds, string text )
+> result = RL.GuiStatusBar( Rectangle bounds, string|nil text )
Status Bar control, shows info text
@@ -781,14 +808,15 @@ Status Bar control, shows info text
*/
int lguiGuiStatusBar( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
- lua_pushinteger( L, GuiStatusBar( bounds, luaL_checkstring( L, 2 ) ) );
+ lua_pushinteger( L, GuiStatusBar( bounds, text ) );
return 1;
}
/*
-> result = RL.GuiDummyRec( Rectangle bounds, string text )
+> result = RL.GuiDummyRec( Rectangle bounds, string|nil text )
Dummy control for placeholders
@@ -796,14 +824,15 @@ Dummy control for placeholders
*/
int lguiGuiDummyRec( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
- lua_pushinteger( L, GuiDummyRec( bounds, luaL_checkstring( L, 2 ) ) );
+ lua_pushinteger( L, GuiDummyRec( bounds, text ) );
return 1;
}
/*
-> result, mouseCell = RL.GuiGrid( Rectangle bounds, string text, float spacing, int subdivs, Vector2 mouseCell )
+> result, mouseCell = RL.GuiGrid( Rectangle bounds, string|nil text, float spacing, int subdivs, Vector2 mouseCell )
Grid control, returns mouse cell position
@@ -811,11 +840,12 @@ Grid control, returns mouse cell position
*/
int lguiGuiGrid( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
float spacing = luaL_checknumber( L, 3 );
int subdivs = luaL_checkinteger( L, 4 );
Vector2 mouseCell = uluaGetVector2( L, 5 );
- lua_pushinteger( L, GuiGrid( bounds, luaL_checkstring( L, 2 ), spacing, subdivs, &mouseCell ) );
+ lua_pushinteger( L, GuiGrid( bounds, text, spacing, subdivs, &mouseCell ) );
uluaPushVector2( L, mouseCell );
return 2;
@@ -844,7 +874,7 @@ int lguiGuiScrollBar( lua_State* L ) {
*/
/*
-> result, scrollIndex, active = RL.GuiListView( Rectangle bounds, string text, int scrollIndex, int active )
+> result, scrollIndex, active = RL.GuiListView( Rectangle bounds, string|nil text, int scrollIndex, int active )
List View control, returns selected list item index
@@ -852,10 +882,11 @@ List View control, returns selected list item index
*/
int lguiGuiListView( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
int scrollIndex = luaL_checkinteger( L, 3 );
int active = luaL_checkinteger( L, 4 );
- lua_pushinteger( L, GuiListView( bounds, luaL_checkstring( L, 2 ), &scrollIndex, &active ) );
+ lua_pushinteger( L, GuiListView( bounds, text, &scrollIndex, &active ) );
lua_pushinteger( L, scrollIndex );
lua_pushinteger( L, active );
@@ -871,14 +902,15 @@ List View with extended parameters
*/
int lguiGuiListViewEx( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ const char* text = luaL_checkstring( L, 2 );
int scrollIndex = luaL_checkinteger( L, 3 );
int active = luaL_checkinteger( L, 4 );
int focus = luaL_checkinteger( L, 5 );
int count = 0;
- const char** text = TextSplit( luaL_checkstring( L, 2 ), ';', &count );
+ const char** textSplits = TextSplit( text, ';', &count );
- lua_pushinteger( L, GuiListViewEx( bounds, text, count, &scrollIndex, &active, &focus ) );
+ lua_pushinteger( L, GuiListViewEx( bounds, textSplits, count, &scrollIndex, &active, &focus ) );
lua_pushinteger( L, scrollIndex );
lua_pushinteger( L, active );
lua_pushinteger( L, focus );
@@ -887,7 +919,7 @@ int lguiGuiListViewEx( lua_State* L ) {
}
/*
-> result = RL.GuiMessageBox( Rectangle bounds, string title, string message, string buttons )
+> result = RL.GuiMessageBox( Rectangle bounds, string|nil title, string message, string buttons )
Message Box control, displays a message
@@ -895,8 +927,11 @@ Message Box control, displays a message
*/
int lguiGuiMessageBox( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* title = getTextOrNil( L, 2 );
+ const char* message = luaL_checkstring( L, 3 );
+ const char* buttons = luaL_checkstring( L, 4 );
- lua_pushinteger( L, GuiMessageBox( bounds, luaL_checkstring( L, 2 ), luaL_checkstring( L, 3 ), luaL_checkstring( L, 4 ) ) );
+ lua_pushinteger( L, GuiMessageBox( bounds, title, message, buttons ) );
return 1;
}
@@ -926,7 +961,7 @@ int lguiGuiTextInputBox( lua_State* L ) {
}
/*
-> result, color = RL.GuiColorPicker( Rectangle bounds, string text, Color color )
+> result, color = RL.GuiColorPicker( Rectangle bounds, string|nil text, Color color )
Color Picker control (multiple color controls)
@@ -934,16 +969,17 @@ Color Picker control (multiple color controls)
*/
int lguiGuiColorPicker( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
Color color = uluaGetColor( L, 3 );
- lua_pushinteger( L, GuiColorPicker( bounds, luaL_checkstring( L, 2 ), &color ) );
+ lua_pushinteger( L, GuiColorPicker( bounds, text, &color ) );
uluaPushColor( L, color );
return 2;
}
/*
-> result, color = RL.GuiColorPanel( Rectangle bounds, string text, Color color )
+> result, color = RL.GuiColorPanel( Rectangle bounds, string|nil text, Color color )
Color Panel control
@@ -951,16 +987,17 @@ Color Panel control
*/
int lguiGuiColorPanel( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
Color color = uluaGetColor( L, 3 );
- lua_pushinteger( L, GuiColorPanel( bounds, luaL_checkstring( L, 2 ), &color ) );
+ lua_pushinteger( L, GuiColorPanel( bounds, text, &color ) );
uluaPushColor( L, color );
return 2;
}
/*
-> result, alpha = RL.GuiColorBarAlpha( Rectangle bounds, string text, float alpha )
+> result, alpha = RL.GuiColorBarAlpha( Rectangle bounds, string|nil text, float alpha )
Color Bar Alpha control
@@ -968,16 +1005,17 @@ Color Bar Alpha control
*/
int lguiGuiColorBarAlpha( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
float alpha = luaL_checknumber( L, 3 );
- lua_pushinteger( L, GuiColorBarAlpha( bounds, luaL_checkstring( L, 2 ), &alpha ) );
+ lua_pushinteger( L, GuiColorBarAlpha( bounds, text, &alpha ) );
lua_pushnumber( L, alpha );
return 2;
}
/*
-> result, value = RL.GuiColorBarHue( Rectangle bounds, string text, float value )
+> result, value = RL.GuiColorBarHue( Rectangle bounds, string|nil text, float value )
Color Bar Hue control
@@ -985,16 +1023,17 @@ Color Bar Hue control
*/
int lguiGuiColorBarHue( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
float value = luaL_checknumber( L, 3 );
- lua_pushinteger( L, GuiColorBarHue( bounds, luaL_checkstring( L, 2 ), &value ) );
+ lua_pushinteger( L, GuiColorBarHue( bounds, text, &value ) );
lua_pushnumber( L, value );
return 2;
}
/*
-> result, colorHsv = RL.GuiColorPickerHSV( Rectangle bounds, string text, Vector3 colorHsv )
+> result, colorHsv = RL.GuiColorPickerHSV( Rectangle bounds, string|nil text, Vector3 colorHsv )
Color Picker control that avoids conversion to RGB on each call (multiple color controls)
@@ -1002,16 +1041,17 @@ Color Picker control that avoids conversion to RGB on each call (multiple color
*/
int lguiGuiColorPickerHSV( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
Vector3 colorHsv = uluaGetVector3( L, 3 );
- lua_pushinteger( L, GuiColorPickerHSV( bounds, luaL_checkstring( L, 2 ), &colorHsv ) );
+ lua_pushinteger( L, GuiColorPickerHSV( bounds, text, &colorHsv ) );
uluaPushVector3( L, colorHsv );
return 2;
}
/*
-> result, colorHsv = RL.GuiColorPanelHSV( Rectangle bounds, string text, Vector3 colorHsv )
+> result, colorHsv = RL.GuiColorPanelHSV( Rectangle bounds, string|nil text, Vector3 colorHsv )
Color Panel control that returns HSV color value, used by GuiColorPickerHSV()
@@ -1019,9 +1059,10 @@ Color Panel control that returns HSV color value, used by GuiColorPickerHSV()
*/
int lguiGuiColorPanelHSV( lua_State* L ) {
Rectangle bounds = uluaGetRectangle( L, 1 );
+ char* text = getTextOrNil( L, 2 );
Vector3 colorHsv = uluaGetVector3( L, 3 );
- lua_pushinteger( L, GuiColorPanelHSV( bounds, luaL_checkstring( L, 2 ), &colorHsv ) );
+ lua_pushinteger( L, GuiColorPanelHSV( bounds, text, &colorHsv ) );
uluaPushVector3( L, colorHsv );
return 2;
diff --git a/src/rmath.c b/src/rmath.c
index aae76f8..15d5323 100644
--- a/src/rmath.c
+++ b/src/rmath.c
@@ -20,12 +20,12 @@ int imax( int a, int b ) {
Round float value
-- Success return float
+- Success return int
*/
int lmathRound( lua_State* L ) {
float value = luaL_checknumber( L, 1 );
- lua_pushnumber( L, round( value ) );
+ lua_pushinteger( L, round( value ) );
return 1;
}
@@ -1749,7 +1749,7 @@ int lmathQuaternionFromMatrix( lua_State* L ) {
/*
> result = RL.QuaternionToMatrix( Quaternion q )
-Get a quaternion for a given rotation matrix
+Get a matrix for a given quaternion
- Success return Matrix
*/