summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md64
-rw-r--r--README.md3
-rw-r--r--devnotes2
-rw-r--r--examples/gui/main.lua2
-rw-r--r--include/rgui.h8
-rw-r--r--src/lua_core.c8
-rw-r--r--src/rgui.c162
7 files changed, 241 insertions, 8 deletions
diff --git a/API.md b/API.md
index 697d91a..82f5599 100644
--- a/API.md
+++ b/API.md
@@ -3381,6 +3381,21 @@ Get one style property
---
+> success = RL_GuiLoadStyle( int control, int property )
+
+Load style file over global style variable ( .rgs )
+
+- Failure return false
+- Success return true
+
+---
+
+> RL_GuiLoadStyleDefault()
+
+Load style default over global style
+
+---
+
## Gui - Container
---
@@ -3626,3 +3641,52 @@ Color Bar Hue control
- Success return float
---
+
+## Gui - Icons
+
+---
+
+> success = RL_GuiDrawIcon( int iconId, Vector2 pos, int pixelSize, Color color )
+
+Draw icon
+
+- Failure return false
+- Success return true
+
+---
+
+> success = RL_GuiSetIconScale( int scale )
+
+Set icon scale ( 1 by default )
+
+- Failure return false
+- Success return true
+
+---
+
+> success = RL_GuiSetIconPixel( int iconId, Vector2 pos )
+
+Set icon pixel value
+
+- Failure return false
+- Success return true
+
+---
+
+> success = RL_GuiClearIconPixel( int iconId, Vector2 pos )
+
+Clear icon pixel value
+
+- Failure return false
+- Success return true
+
+---
+
+> value = RL_GuiCheckIconPixel( int iconId, Vector2 pos )
+
+Check icon pixel value
+
+- Failure return nil
+- Success return bool
+
+---
diff --git a/README.md b/README.md
index c87a8b2..3086147 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,6 @@ List of some MISSING features that are planned to be included. For specific func
Submodules.
* Raygui
- * Icons
* Raymath
* Quaternions
* Physac
@@ -140,7 +139,7 @@ cmake -G "MinGW Makefiles" ..
# Cmake uses NMake Makefiles by default so we will set the Generator to MinGW with -G
-mingw32-make
+mingw32-make.exe
```
* You should now have "ReiLua.exe".
diff --git a/devnotes b/devnotes
index d5b7613..ba74197 100644
--- a/devnotes
+++ b/devnotes
@@ -1,6 +1,4 @@
Current {
- * Raygui
- * Advanced controls
}
Backlog {
diff --git a/examples/gui/main.lua b/examples/gui/main.lua
index 312dfb6..1e77fac 100644
--- a/examples/gui/main.lua
+++ b/examples/gui/main.lua
@@ -101,4 +101,6 @@ function draw()
colorPanel.color = RL_ColorFromHSV( colorPanel.hue, 1.0, 1.0 )
end
+
+ RL_GuiDrawIcon( 121, { 6, 20 }, 2, WHITE )
end
diff --git a/include/rgui.h b/include/rgui.h
index b98fdde..88b4691 100644
--- a/include/rgui.h
+++ b/include/rgui.h
@@ -10,6 +10,8 @@ int lguiGuiSetFont( lua_State *L );
/* Style */
int lguiGuiSetStyle( lua_State *L );
int lguiGuiGetStyle( lua_State *L );
+int lguiGuiLoadStyle( lua_State *L );
+int lguiGuiLoadStyleDefault( lua_State *L );
/* Container. */
int lguiGuiWindowBox( lua_State *L );
int lguiGuiGroupBox( lua_State *L );
@@ -39,3 +41,9 @@ int lguiGuiColorPicker( lua_State *L );
int lguiGuiColorPanel( lua_State *L );
int lguiGuiColorBarAlpha( lua_State *L );
int lguiGuiColorBarHue( lua_State *L );
+/* Icons. */
+int lguiGuiDrawIcon( lua_State *L );
+int lguiGuiSetIconScale( lua_State *L );
+int lguiGuiSetIconPixel( lua_State *L );
+int lguiGuiClearIconPixel( lua_State *L );
+int lguiGuiCheckIconPixel( lua_State *L );
diff --git a/src/lua_core.c b/src/lua_core.c
index d6ef706..aeeec9c 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -811,6 +811,8 @@ void luaRegister() {
/* Style. */
lua_register( L, "RL_GuiSetStyle", lguiGuiSetStyle );
lua_register( L, "RL_GuiGetStyle", lguiGuiGetStyle );
+ lua_register( L, "RL_GuiLoadStyle", lguiGuiLoadStyle );
+ lua_register( L, "RL_GuiLoadStyleDefault", lguiGuiLoadStyleDefault );
/* Container. */
lua_register( L, "RL_GuiWindowBox", lguiGuiWindowBox );
lua_register( L, "RL_GuiGroupBox", lguiGuiGroupBox );
@@ -840,6 +842,12 @@ void luaRegister() {
lua_register( L, "RL_GuiColorPanel", lguiGuiColorPanel );
lua_register( L, "RL_GuiColorBarAlpha", lguiGuiColorBarAlpha );
lua_register( L, "RL_GuiColorBarHue", lguiGuiColorBarHue );
+ /* Icons. */
+ lua_register( L, "RL_GuiDrawIcon", lguiGuiDrawIcon );
+ lua_register( L, "RL_GuiSetIconScale", lguiGuiSetIconScale );
+ lua_register( L, "RL_GuiSetIconPixel", lguiGuiSetIconPixel );
+ lua_register( L, "RL_GuiClearIconPixel", lguiGuiClearIconPixel );
+ lua_register( L, "RL_GuiCheckIconPixel", lguiGuiCheckIconPixel );
}
/* Lua util functions. */
diff --git a/src/rgui.c b/src/rgui.c
index dabf18f..8d2ea37 100644
--- a/src/rgui.c
+++ b/src/rgui.c
@@ -18,7 +18,7 @@ Enable gui controls ( Global state )
int lguiGuiEnable( lua_State *L ) {
GuiEnable();
- return 1;
+ return 0;
}
/*
@@ -29,7 +29,7 @@ Disable gui controls ( Global state )
int lguiGuiDisable( lua_State *L ) {
GuiDisable();
- return 1;
+ return 0;
}
/*
@@ -40,7 +40,7 @@ Lock gui controls ( Global state )
int lguiGuiLock( lua_State *L ) {
GuiLock();
- return 1;
+ return 0;
}
/*
@@ -51,7 +51,7 @@ Unlock gui controls ( Global state )
int lguiGuiUnlock( lua_State *L ) {
GuiUnlock();
- return 1;
+ return 0;
}
/*
@@ -122,6 +122,37 @@ int lguiGuiGetStyle( lua_State *L ) {
}
/*
+> success = RL_GuiLoadStyle( int control, int property )
+
+Load style file over global style variable ( .rgs )
+
+- Failure return false
+- Success return true
+*/
+int lguiGuiLoadStyle( lua_State *L ) {
+ if ( !lua_isstring( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiLoadStyle( string fileName )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ GuiLoadStyle( lua_tostring( L, -1 ) );
+ lua_pushboolean( L, true );
+
+ return 1;
+}
+
+/*
+> RL_GuiLoadStyleDefault()
+
+Load style default over global style
+*/
+int lguiGuiLoadStyleDefault( lua_State *L ) {
+ GuiLoadStyleDefault();
+
+ return 0;
+}
+
+/*
## Gui - Container
*/
@@ -873,3 +904,126 @@ int lguiGuiColorBarHue( lua_State *L ) {
return 1;
}
+
+/*
+## Gui - Icons
+*/
+
+/*
+> success = RL_GuiDrawIcon( int iconId, Vector2 pos, int pixelSize, Color color )
+
+Draw icon
+
+- Failure return false
+- Success return true
+*/
+int lguiGuiDrawIcon( lua_State *L ) {
+ if ( !lua_isnumber( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiDrawIcon( int iconId, Vector2 pos, int pixelSize, Color color )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ Color color = uluaGetColor( L );
+ lua_pop( L, 1 );
+ int pixelSize = lua_tointeger( L, -1 );
+ lua_pop( L, 1 );
+ Vector2 pos = uluaGetVector2( L );
+ lua_pop( L, 1 );
+ int iconId = lua_tointeger( L, -1 );
+
+ GuiDrawIcon( iconId, pos.x, pos.y, pixelSize, color );
+ lua_pushboolean( L, true );
+
+ return 1;
+}
+
+/*
+> success = RL_GuiSetIconScale( int scale )
+
+Set icon scale ( 1 by default )
+
+- Failure return false
+- Success return true
+*/
+int lguiGuiSetIconScale( lua_State *L ) {
+ if ( !lua_isnumber( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSetIconScale( int scale )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ GuiSetIconScale( (unsigned int)lua_tointeger( L, -1 ) );
+ lua_pushboolean( L, true );
+
+ return 1;
+}
+
+/*
+> success = RL_GuiSetIconPixel( int iconId, Vector2 pos )
+
+Set icon pixel value
+
+- Failure return false
+- Success return true
+*/
+int lguiGuiSetIconPixel( lua_State *L ) {
+ if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSetIconPixel( int iconId, Vector2 pos )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ Vector2 pos = uluaGetVector2( L );
+ lua_pop( L, 1 );
+ int iconId = lua_tointeger( L, -1 );
+
+ GuiSetIconPixel( iconId, pos.x, pos.y );
+ lua_pushboolean( L, true );
+
+ return 1;
+}
+
+/*
+> success = RL_GuiClearIconPixel( int iconId, Vector2 pos )
+
+Clear icon pixel value
+
+- Failure return false
+- Success return true
+*/
+int lguiGuiClearIconPixel( lua_State *L ) {
+ if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiClearIconPixel( int iconId, Vector2 pos )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ Vector2 pos = uluaGetVector2( L );
+ lua_pop( L, 1 );
+ int iconId = lua_tointeger( L, -1 );
+
+ GuiClearIconPixel( iconId, pos.x, pos.y );
+ lua_pushboolean( L, true );
+
+ return 1;
+}
+
+/*
+> value = RL_GuiCheckIconPixel( int iconId, Vector2 pos )
+
+Check icon pixel value
+
+- Failure return nil
+- Success return bool
+*/
+int lguiGuiCheckIconPixel( lua_State *L ) {
+ if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiCheckIconPixel( int iconId, Vector2 pos )" );
+ lua_pushnil( L );
+ return 1;
+ }
+ Vector2 pos = uluaGetVector2( L );
+ lua_pop( L, 1 );
+ int iconId = lua_tointeger( L, -1 );
+
+ lua_pushboolean( L, GuiCheckIconPixel( iconId, pos.x, pos.y ) );
+
+ return 1;
+}