summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjussi2022-03-29 18:50:00 +0300
committerjussi2022-03-29 18:50:00 +0300
commit9997e40530d0af01a2fa930d45c55b419cae996f (patch)
tree1920054001faee9945254f364f146135d8f713e8
parent6d1c14e09cb7c7a5657374e8d102fd5bb48d0b73 (diff)
downloadreilua-enhanced-9997e40530d0af01a2fa930d45c55b419cae996f.tar.gz
reilua-enhanced-9997e40530d0af01a2fa930d45c55b419cae996f.tar.bz2
reilua-enhanced-9997e40530d0af01a2fa930d45c55b419cae996f.zip
Advanced gui controls.
-rw-r--r--API.md67
-rw-r--r--README.md3
-rw-r--r--devnotes5
-rw-r--r--examples/gui/main.lua31
-rw-r--r--include/rgui.h8
-rw-r--r--src/lua_core.c8
-rw-r--r--src/rgui.c278
7 files changed, 360 insertions, 40 deletions
diff --git a/API.md b/API.md
index e083a7c..697d91a 100644
--- a/API.md
+++ b/API.md
@@ -3559,3 +3559,70 @@ Dropdown Box control, returns selected item
- Success return bool, int
---
+
+## Gui - Advanced
+
+---
+
+> itemIndex, scrollIndex = RL_GuiListView( Rectangle bounds, string text, int scrollIndex, int active )
+
+List View control, returns selected list item index and scroll index
+
+- Failure return nil
+- Success return int, int
+
+---
+
+> buttonIndex = RL_GuiMessageBox( Rectangle bounds, string title, string message, string buttons )
+
+Message Box control, displays a message, returns button index ( 0 is x button )
+
+- Failure return false
+- Success return int
+
+---
+
+> buttonIndex, text, secretViewActive = RL_GuiTextInputBox( Rectangle bounds, string title, string message, string buttons, string text, int textMaxSize, int secretViewActive )
+
+Text Input Box control, ask for text, supports secret
+
+- Failure return false
+- Success return int, string, int
+
+---
+
+> color = RL_GuiColorPicker( Rectangle bounds, string text, Color color )
+
+Color Picker control ( multiple color controls )
+
+- Failure return false
+- Success return Color
+
+---
+
+> color = RL_GuiColorPanel( Rectangle bounds, string text, Color color )
+
+Color Panel control
+
+- Failure return false
+- Success return Color
+
+---
+
+> alpha = RL_GuiColorBarAlpha( Rectangle bounds, string text, float alpha )
+
+Color Bar Alpha control
+
+- Failure return false
+- Success return float
+
+---
+
+> hue = RL_GuiColorBarHue( Rectangle bounds, string text, float value )
+
+Color Bar Hue control
+
+- Failure return false
+- Success return float
+
+---
diff --git a/README.md b/README.md
index 8da40ee..c87a8b2 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,6 @@ List of some MISSING features that are planned to be included. For specific func
* camera2d and it's functions
* VR stereo config functions for VR simulator
* Textures
- * Most image loading functions
* Image manipulation functions
* Texture update functions
* Text
@@ -34,7 +33,7 @@ List of some MISSING features that are planned to be included. For specific func
Submodules.
* Raygui
- * Advanced controls
+ * Icons
* Raymath
* Quaternions
* Physac
diff --git a/devnotes b/devnotes
index 7b74f66..d5b7613 100644
--- a/devnotes
+++ b/devnotes
@@ -1,12 +1,13 @@
Current {
+ * Raygui
+ * Advanced controls
}
Backlog {
* More and better examples
- * Raygui
- * Advanced controls
* Core
+ * Clipboard
* Screen-space-related
* Files drop
* Text
diff --git a/examples/gui/main.lua b/examples/gui/main.lua
index aa7123f..312dfb6 100644
--- a/examples/gui/main.lua
+++ b/examples/gui/main.lua
@@ -12,6 +12,11 @@ local scrollbarValue = 0.0
local dropdownValue = 0
local dropdownActive = false
local index = 0
+local listView = { item = 0, scroll = 0 }
+local messageBox = { buttonIndex = -1 }
+local textInputBox = { buttonIndex = 0, text = "", secretViewActive = 1 }
+local colorPicker = { color = { 255, 255, 255 } }
+local colorPanel = { color = { 255, 255, 255 }, alpha = 1.0, hue = 1.0, oldHue = 1.0 }
function init()
local monitor = 0
@@ -70,4 +75,30 @@ function draw()
if dropdownToggle then
dropdownActive = not dropdownActive
end
+
+ listView.item, listView.scroll = RL_GuiListView( { 200, 400, 200, 200 }, "Cat\nElefant\nSquirrel", listView.scroll, listView.item )
+ messageBox.buttonIndex = RL_GuiMessageBox( { 420, 400, 200, 100 }, "Message", "Are you sure about this?", "Yes\nNo" )
+
+ if 0 <= messageBox.buttonIndex then
+ print( "messageBox.buttonIndex", messageBox.buttonIndex )
+ end
+
+ textInputBox.buttonIndex, textInputBox.text, textInputBox.secretViewActive
+ = RL_GuiTextInputBox( { 420, 510, 300, 150 }, "Input Box", "Put text here", "Button",textInputBox.text, 200, textInputBox.secretViewActive )
+
+ if 0 <= textInputBox.buttonIndex then
+ print( "textInputBox.buttonIndex", textInputBox.buttonIndex )
+ end
+
+ colorPicker.color = RL_GuiColorPicker( { 620, 20, 150, 150 }, "Color Picker", colorPicker.color )
+
+ colorPanel.color = RL_GuiColorPanel( { 820, 20, 150, 150 }, "Color Panel", colorPanel.color )
+ colorPanel.alpha = RL_GuiColorBarAlpha( { 820, 180, 150, 20 }, "Color alpha", colorPanel.alpha )
+ colorPanel.hue = RL_GuiColorBarHue( { 980, 20, 20, 150 }, "Color hue", colorPanel.hue )
+
+ if colorPanel.hue ~= colorPanel.oldHue then
+ colorPanel.oldHue = colorPanel.hue
+
+ colorPanel.color = RL_ColorFromHSV( colorPanel.hue, 1.0, 1.0 )
+ end
end
diff --git a/include/rgui.h b/include/rgui.h
index 9a40611..b98fdde 100644
--- a/include/rgui.h
+++ b/include/rgui.h
@@ -31,3 +31,11 @@ int lguiGuiSliderBar( lua_State *L );
int lguiGuiProgressBar( lua_State *L );
int lguiGuiScrollBar( lua_State *L );
int lguiGuiDropdownBox( lua_State *L );
+/* Advanced. */
+int lguiGuiListView( lua_State *L );
+int lguiGuiMessageBox( lua_State *L );
+int lguiGuiTextInputBox( lua_State *L );
+int lguiGuiColorPicker( lua_State *L );
+int lguiGuiColorPanel( lua_State *L );
+int lguiGuiColorBarAlpha( lua_State *L );
+int lguiGuiColorBarHue( lua_State *L );
diff --git a/src/lua_core.c b/src/lua_core.c
index 7783778..d6ef706 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -832,6 +832,14 @@ void luaRegister() {
lua_register( L, "RL_GuiProgressBar", lguiGuiProgressBar );
lua_register( L, "RL_GuiScrollBar", lguiGuiScrollBar );
lua_register( L, "RL_GuiDropdownBox", lguiGuiDropdownBox );
+ /* Advanced. */
+ lua_register( L, "RL_GuiListView", lguiGuiListView );
+ lua_register( L, "RL_GuiMessageBox", lguiGuiMessageBox );
+ lua_register( L, "RL_GuiTextInputBox", lguiGuiTextInputBox );
+ lua_register( L, "RL_GuiColorPicker", lguiGuiColorPicker );
+ lua_register( L, "RL_GuiColorPanel", lguiGuiColorPanel );
+ lua_register( L, "RL_GuiColorBarAlpha", lguiGuiColorBarAlpha );
+ lua_register( L, "RL_GuiColorBarHue", lguiGuiColorBarHue );
}
/* Lua util functions. */
diff --git a/src/rgui.c b/src/rgui.c
index 89a245a..dabf18f 100644
--- a/src/rgui.c
+++ b/src/rgui.c
@@ -142,9 +142,9 @@ int lguiGuiWindowBox( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushboolean( L, GuiWindowBox( rect, text ) );
+ lua_pushboolean( L, GuiWindowBox( bounds, text ) );
return 1;
}
@@ -166,9 +166,9 @@ int lguiGuiGroupBox( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- GuiGroupBox( rect, text );
+ GuiGroupBox( bounds, text );
lua_pushboolean( L, true );
return 1;
@@ -191,9 +191,9 @@ int lguiGuiLine( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- GuiLine( rect, text );
+ GuiLine( bounds, text );
lua_pushboolean( L, true );
return 1;
@@ -216,9 +216,9 @@ int lguiGuiPanel( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- GuiPanel( rect, text );
+ GuiPanel( bounds, text );
lua_pushboolean( L, true );
return 1;
@@ -274,9 +274,9 @@ int lguiGuiLabel( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- GuiLabel( rect, text );
+ GuiLabel( bounds, text );
lua_pushboolean( L, true );
return 1;
@@ -299,9 +299,9 @@ int lguiGuiButton( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushboolean( L, GuiButton( rect, text ) );
+ lua_pushboolean( L, GuiButton( bounds, text ) );
return 1;
}
@@ -325,9 +325,9 @@ int lguiGuiToggle( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushboolean( L, GuiToggle( rect, text, checked ) );
+ lua_pushboolean( L, GuiToggle( bounds, text, checked ) );
return 1;
}
@@ -351,9 +351,9 @@ int lguiGuiToggleGroup( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushinteger( L, GuiToggleGroup( rect, text, active ) );
+ lua_pushinteger( L, GuiToggleGroup( bounds, text, active ) );
return 1;
}
@@ -377,9 +377,9 @@ int lguiGuiCheckBox( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushboolean( L, GuiCheckBox( rect, text, checked ) );
+ lua_pushboolean( L, GuiCheckBox( bounds, text, checked ) );
return 1;
}
@@ -405,9 +405,9 @@ int lguiGuiTextBox( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushboolean( L, GuiTextBox( rect, text, textSize, editMode ) );
+ lua_pushboolean( L, GuiTextBox( bounds, text, textSize, editMode ) );
lua_pushstring( L, text );
return 2;
@@ -434,9 +434,9 @@ int lguiGuiTextBoxMulti( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushboolean( L, GuiTextBoxMulti( rect, text, textSize, editMode ) );
+ lua_pushboolean( L, GuiTextBoxMulti( bounds, text, textSize, editMode ) );
lua_pushstring( L, text );
return 2;
@@ -468,9 +468,9 @@ int lguiGuiSpinner( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushboolean( L, GuiSpinner( rect, text, &value, minValue, maxValue, editMode ) );
+ lua_pushboolean( L, GuiSpinner( bounds, text, &value, minValue, maxValue, editMode ) );
lua_pushinteger( L, value );
return 2;
@@ -502,9 +502,9 @@ int lguiGuiValueBox( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushboolean( L, GuiValueBox( rect, text, &value, minValue, maxValue, editMode ) );
+ lua_pushboolean( L, GuiValueBox( bounds, text, &value, minValue, maxValue, editMode ) );
lua_pushinteger( L, value );
return 2;
@@ -537,9 +537,9 @@ int lguiGuiSlider( lua_State *L ) {
char textLeft[ STRING_LEN ] = { '\0' };
strcpy( textLeft, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushnumber( L, GuiSlider( rect, textLeft, textRight, value, minValue, maxValue ) );
+ lua_pushnumber( L, GuiSlider( bounds, textLeft, textRight, value, minValue, maxValue ) );
return 1;
}
@@ -571,9 +571,9 @@ int lguiGuiSliderBar( lua_State *L ) {
char textLeft[ STRING_LEN ] = { '\0' };
strcpy( textLeft, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushnumber( L, GuiSliderBar( rect, textLeft, textRight, value, minValue, maxValue ) );
+ lua_pushnumber( L, GuiSliderBar( bounds, textLeft, textRight, value, minValue, maxValue ) );
return 1;
}
@@ -605,9 +605,9 @@ int lguiGuiProgressBar( lua_State *L ) {
char textLeft[ STRING_LEN ] = { '\0' };
strcpy( textLeft, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushnumber( L, GuiProgressBar( rect, textLeft, textRight, value, minValue, maxValue ) );
+ lua_pushnumber( L, GuiProgressBar( bounds, textLeft, textRight, value, minValue, maxValue ) );
return 1;
}
@@ -632,9 +632,9 @@ int lguiGuiScrollBar( lua_State *L ) {
lua_pop( L, 1 );
int value = lua_tointeger( L, -1 );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushinteger( L, GuiScrollBar( rect, value, minValue, maxValue ) );
+ lua_pushinteger( L, GuiScrollBar( bounds, value, minValue, maxValue ) );
return 1;
}
@@ -660,10 +660,216 @@ int lguiGuiDropdownBox( lua_State *L ) {
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
- Rectangle rect = uluaGetRectangle( L );
+ Rectangle bounds = uluaGetRectangle( L );
- lua_pushboolean( L, GuiDropdownBox( rect, text, &active, editMode ) );
+ lua_pushboolean( L, GuiDropdownBox( bounds, text, &active, editMode ) );
lua_pushinteger( L, active );
return 2;
}
+
+/*
+## Gui - Advanced
+*/
+
+/*
+> itemIndex, scrollIndex = RL_GuiListView( Rectangle bounds, string text, int scrollIndex, int active )
+
+List View control, returns selected list item index and scroll index
+
+- Failure return nil
+- Success return int, int
+*/
+int lguiGuiListView( lua_State *L ) {
+ if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiListView( Rectangle bounds, string text, int scrollIndex, int active )" );
+ lua_pushnil( L );
+ return 1;
+ }
+ int active = lua_tointeger( L, -1 );
+ lua_pop( L, 1 );
+ int scrollIndex = lua_tointeger( L, -1 );
+ lua_pop( L, 1 );
+ char text[ STRING_LEN ] = { '\0' };
+ strcpy( text, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ Rectangle bounds = uluaGetRectangle( L );
+
+ lua_pushinteger( L, GuiListView( bounds, text, &scrollIndex, active ) );
+ lua_pushinteger( L, scrollIndex );
+
+ return 2;
+}
+
+/*
+> buttonIndex = RL_GuiMessageBox( Rectangle bounds, string title, string message, string buttons )
+
+Message Box control, displays a message, returns button index ( 0 is x button )
+
+- Failure return false
+- Success return int
+*/
+int lguiGuiMessageBox( lua_State *L ) {
+ if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isstring( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiMessageBox( Rectangle bounds, string title, string message, string buttons )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ char buttons[ STRING_LEN ] = { '\0' };
+ strcpy( buttons, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ char message[ STRING_LEN ] = { '\0' };
+ strcpy( message, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ char title[ STRING_LEN ] = { '\0' };
+ strcpy( title, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ Rectangle bounds = uluaGetRectangle( L );
+
+ lua_pushinteger( L, GuiMessageBox( bounds, title, message, buttons ) );
+
+ return 1;
+}
+
+/*
+> buttonIndex, text, secretViewActive = RL_GuiTextInputBox( Rectangle bounds, string title, string message, string buttons, string text, int textMaxSize, int secretViewActive )
+
+Text Input Box control, ask for text, supports secret
+
+- Failure return false
+- Success return int, string, int
+*/
+int lguiGuiTextInputBox( lua_State *L ) {
+ if ( !lua_istable( L, -7 ) || !lua_isstring( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isstring( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiTextInputBox( Rectangle bounds, string title, string message, string buttons, string text, int textMaxSize, int secretViewActive )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ int secretViewActive = lua_tointeger( L, -1 );
+ lua_pop( L, 1 );
+ int textMaxSize = lua_tointeger( L, -1 );
+ lua_pop( L, 1 );
+ char text[ STRING_LEN ] = { '\0' };
+ strcpy( text, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ char buttons[ STRING_LEN ] = { '\0' };
+ strcpy( buttons, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ char message[ STRING_LEN ] = { '\0' };
+ strcpy( message, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ char title[ STRING_LEN ] = { '\0' };
+ strcpy( title, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ Rectangle bounds = uluaGetRectangle( L );
+
+ lua_pushinteger( L, GuiTextInputBox( bounds, title, message, buttons, text, textMaxSize, &secretViewActive ) );
+ lua_pushstring( L, text );
+ lua_pushinteger( L, secretViewActive );
+
+ return 3;
+}
+
+/*
+> color = RL_GuiColorPicker( Rectangle bounds, string text, Color color )
+
+Color Picker control ( multiple color controls )
+
+- Failure return false
+- Success return Color
+*/
+int lguiGuiColorPicker( lua_State *L ) {
+ if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_istable( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiColorPicker( Rectangle bounds, string text, Color color )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ Color color = uluaGetColor( L );
+ lua_pop( L, 1 );
+ char text[ STRING_LEN ] = { '\0' };
+ strcpy( text, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ Rectangle bounds = uluaGetRectangle( L );
+
+ uluaPushColor( L, GuiColorPicker( bounds, text, color ) );
+
+ return 1;
+}
+
+/*
+> color = RL_GuiColorPanel( Rectangle bounds, string text, Color color )
+
+Color Panel control
+
+- Failure return false
+- Success return Color
+*/
+int lguiGuiColorPanel( lua_State *L ) {
+ if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_istable( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiColorPanel( Rectangle bounds, string text, Color color )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ Color color = uluaGetColor( L );
+ lua_pop( L, 1 );
+ char text[ STRING_LEN ] = { '\0' };
+ strcpy( text, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ Rectangle bounds = uluaGetRectangle( L );
+
+ uluaPushColor( L, GuiColorPanel( bounds, text, color ) );
+
+ return 1;
+}
+
+/*
+> alpha = RL_GuiColorBarAlpha( Rectangle bounds, string text, float alpha )
+
+Color Bar Alpha control
+
+- Failure return false
+- Success return float
+*/
+int lguiGuiColorBarAlpha( lua_State *L ) {
+ if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiColorBarAlpha( Rectangle bounds, string text, float alpha )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ float alpha = lua_tonumber( L, -1 );
+ lua_pop( L, 1 );
+ char text[ STRING_LEN ] = { '\0' };
+ strcpy( text, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ Rectangle bounds = uluaGetRectangle( L );
+
+ lua_pushnumber( L, GuiColorBarAlpha( bounds, text, alpha ) );
+
+ return 1;
+}
+
+/*
+> hue = RL_GuiColorBarHue( Rectangle bounds, string text, float value )
+
+Color Bar Hue control
+
+- Failure return false
+- Success return float
+*/
+int lguiGuiColorBarHue( lua_State *L ) {
+ if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiColorBarHue( Rectangle bounds, string text, float value )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ float value = lua_tonumber( L, -1 );
+ lua_pop( L, 1 );
+ char text[ STRING_LEN ] = { '\0' };
+ strcpy( text, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ Rectangle bounds = uluaGetRectangle( L );
+
+ lua_pushnumber( L, GuiColorBarHue( bounds, text, value ) );
+
+ return 1;
+}