summaryrefslogtreecommitdiff
path: root/src/rgui.c
diff options
context:
space:
mode:
authorjussi2022-04-01 20:35:43 +0300
committerjussi2022-04-01 20:35:43 +0300
commit7665cf4bc16a423d4cd98174853dcc36de08787e (patch)
tree34320026165dab240e1678ae1905b10dee24710c /src/rgui.c
parent7928f9dbab6829f73c57e6dd4ede0da6cea023b0 (diff)
downloadreilua-enhanced-7665cf4bc16a423d4cd98174853dcc36de08787e.tar.gz
reilua-enhanced-7665cf4bc16a423d4cd98174853dcc36de08787e.tar.bz2
reilua-enhanced-7665cf4bc16a423d4cd98174853dcc36de08787e.zip
GuiIconText.
Diffstat (limited to 'src/rgui.c')
-rw-r--r--src/rgui.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/rgui.c b/src/rgui.c
index 894c470..9b8502d 100644
--- a/src/rgui.c
+++ b/src/rgui.c
@@ -1137,6 +1137,35 @@ int lguiGuiColorBarHue( lua_State *L ) {
*/
/*
+> text = RL_GuiIconText( int iconId, string text )
+
+Get text with icon id prepended ( if supported )
+
+- Failure return false
+- Success return string
+*/
+int lguiGuiIconText( lua_State *L ) {
+ if ( !lua_isnumber( L, -2 ) || !lua_isstring( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiIconText( int iconId, string text )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ char text[ STRING_LEN ] = { '\0' };
+ strcpy( text, lua_tostring( L, -1 ) );
+ lua_pop( L, 1 );
+ int iconId = lua_tointeger( L, -1 );
+
+ if ( TextIsEqual( text, "" ) ) {
+ lua_pushstring( L, GuiIconText( iconId, NULL ) );
+ }
+ else {
+ lua_pushstring( L, GuiIconText( iconId, text ) );
+ }
+
+ return 1;
+}
+
+/*
> success = RL_GuiDrawIcon( int iconId, Vector2 pos, int pixelSize, Color color )
Draw icon