Gui Icons.
This commit is contained in:
64
API.md
64
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
|
## Gui - Container
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -3626,3 +3641,52 @@ Color Bar Hue control
|
|||||||
- Success return float
|
- 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
|
||||||
|
|
||||||
|
---
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ List of some MISSING features that are planned to be included. For specific func
|
|||||||
Submodules.
|
Submodules.
|
||||||
|
|
||||||
* Raygui
|
* Raygui
|
||||||
* Icons
|
|
||||||
* Raymath
|
* Raymath
|
||||||
* Quaternions
|
* Quaternions
|
||||||
* Physac
|
* 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
|
# 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".
|
* You should now have "ReiLua.exe".
|
||||||
|
|||||||
2
devnotes
2
devnotes
@@ -1,6 +1,4 @@
|
|||||||
Current {
|
Current {
|
||||||
* Raygui
|
|
||||||
* Advanced controls
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Backlog {
|
Backlog {
|
||||||
|
|||||||
@@ -101,4 +101,6 @@ function draw()
|
|||||||
|
|
||||||
colorPanel.color = RL_ColorFromHSV( colorPanel.hue, 1.0, 1.0 )
|
colorPanel.color = RL_ColorFromHSV( colorPanel.hue, 1.0, 1.0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RL_GuiDrawIcon( 121, { 6, 20 }, 2, WHITE )
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ int lguiGuiSetFont( lua_State *L );
|
|||||||
/* Style */
|
/* Style */
|
||||||
int lguiGuiSetStyle( lua_State *L );
|
int lguiGuiSetStyle( lua_State *L );
|
||||||
int lguiGuiGetStyle( lua_State *L );
|
int lguiGuiGetStyle( lua_State *L );
|
||||||
|
int lguiGuiLoadStyle( lua_State *L );
|
||||||
|
int lguiGuiLoadStyleDefault( lua_State *L );
|
||||||
/* Container. */
|
/* Container. */
|
||||||
int lguiGuiWindowBox( lua_State *L );
|
int lguiGuiWindowBox( lua_State *L );
|
||||||
int lguiGuiGroupBox( lua_State *L );
|
int lguiGuiGroupBox( lua_State *L );
|
||||||
@@ -39,3 +41,9 @@ int lguiGuiColorPicker( lua_State *L );
|
|||||||
int lguiGuiColorPanel( lua_State *L );
|
int lguiGuiColorPanel( lua_State *L );
|
||||||
int lguiGuiColorBarAlpha( lua_State *L );
|
int lguiGuiColorBarAlpha( lua_State *L );
|
||||||
int lguiGuiColorBarHue( 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 );
|
||||||
|
|||||||
@@ -811,6 +811,8 @@ void luaRegister() {
|
|||||||
/* Style. */
|
/* Style. */
|
||||||
lua_register( L, "RL_GuiSetStyle", lguiGuiSetStyle );
|
lua_register( L, "RL_GuiSetStyle", lguiGuiSetStyle );
|
||||||
lua_register( L, "RL_GuiGetStyle", lguiGuiGetStyle );
|
lua_register( L, "RL_GuiGetStyle", lguiGuiGetStyle );
|
||||||
|
lua_register( L, "RL_GuiLoadStyle", lguiGuiLoadStyle );
|
||||||
|
lua_register( L, "RL_GuiLoadStyleDefault", lguiGuiLoadStyleDefault );
|
||||||
/* Container. */
|
/* Container. */
|
||||||
lua_register( L, "RL_GuiWindowBox", lguiGuiWindowBox );
|
lua_register( L, "RL_GuiWindowBox", lguiGuiWindowBox );
|
||||||
lua_register( L, "RL_GuiGroupBox", lguiGuiGroupBox );
|
lua_register( L, "RL_GuiGroupBox", lguiGuiGroupBox );
|
||||||
@@ -840,6 +842,12 @@ void luaRegister() {
|
|||||||
lua_register( L, "RL_GuiColorPanel", lguiGuiColorPanel );
|
lua_register( L, "RL_GuiColorPanel", lguiGuiColorPanel );
|
||||||
lua_register( L, "RL_GuiColorBarAlpha", lguiGuiColorBarAlpha );
|
lua_register( L, "RL_GuiColorBarAlpha", lguiGuiColorBarAlpha );
|
||||||
lua_register( L, "RL_GuiColorBarHue", lguiGuiColorBarHue );
|
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. */
|
/* Lua util functions. */
|
||||||
|
|||||||
162
src/rgui.c
162
src/rgui.c
@@ -18,7 +18,7 @@ Enable gui controls ( Global state )
|
|||||||
int lguiGuiEnable( lua_State *L ) {
|
int lguiGuiEnable( lua_State *L ) {
|
||||||
GuiEnable();
|
GuiEnable();
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -29,7 +29,7 @@ Disable gui controls ( Global state )
|
|||||||
int lguiGuiDisable( lua_State *L ) {
|
int lguiGuiDisable( lua_State *L ) {
|
||||||
GuiDisable();
|
GuiDisable();
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -40,7 +40,7 @@ Lock gui controls ( Global state )
|
|||||||
int lguiGuiLock( lua_State *L ) {
|
int lguiGuiLock( lua_State *L ) {
|
||||||
GuiLock();
|
GuiLock();
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -51,7 +51,7 @@ Unlock gui controls ( Global state )
|
|||||||
int lguiGuiUnlock( lua_State *L ) {
|
int lguiGuiUnlock( lua_State *L ) {
|
||||||
GuiUnlock();
|
GuiUnlock();
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -121,6 +121,37 @@ int lguiGuiGetStyle( lua_State *L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> 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
|
## Gui - Container
|
||||||
*/
|
*/
|
||||||
@@ -873,3 +904,126 @@ int lguiGuiColorBarHue( lua_State *L ) {
|
|||||||
|
|
||||||
return 1;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user