From dc2edd69440fcc2470a45562149166695d4edbcc Mon Sep 17 00:00:00 2001 From: jussi Date: Fri, 14 Apr 2023 00:11:58 +0300 Subject: Raygui wrapper lib. --- src/gl.c | 5 +++-- src/lua_core.c | 1 + src/rgui.c | 16 +++++++++++++++- src/state.c | 1 + 4 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gl.c b/src/gl.c index 18947d5..a6777a9 100644 --- a/src/gl.c +++ b/src/gl.c @@ -55,10 +55,11 @@ int lglBlitFramebuffer( lua_State *L ) { dstRect.x, dstRect.y, dstRect.width, dstRect.height, mask, filter - // GL_COLOR_BUFFER_BIT, // mask - // GL_NEAREST // filter ); + glBindFramebuffer( GL_READ_FRAMEBUFFER, 0 ); + glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); + lua_pushboolean( L, true ); return 1; diff --git a/src/lua_core.c b/src/lua_core.c index 3c839c6..6bb6237 100644 --- a/src/lua_core.c +++ b/src/lua_core.c @@ -1290,6 +1290,7 @@ void luaRegister() { assingGlobalFunction( "GuiGetState", lguiGuiGetState ); /* Font. */ assingGlobalFunction( "GuiSetFont", lguiGuiSetFont ); + assingGlobalFunction( "GuiGetFont", lguiGuiGetFont ); /* Style. */ assingGlobalFunction( "GuiSetStyle", lguiGuiSetStyle ); assingGlobalFunction( "GuiGetStyle", lguiGuiGetStyle ); diff --git a/src/rgui.c b/src/rgui.c index 57f4a4d..e2c1fa0 100644 --- a/src/rgui.c +++ b/src/rgui.c @@ -131,7 +131,7 @@ int lguiGuiGetState( lua_State *L ) { /* > success = RL.GuiSetFont( Font font ) -Set gui custom font ( Global state ) +Set gui custom font ( global state ) - Failure return false - Success return true @@ -143,6 +143,7 @@ int lguiGuiSetFont( lua_State *L ) { return 1; } size_t fontId = lua_tointeger( L, 1 ); + state->guiFont = fontId; GuiSetFont( *state->fonts[ fontId ] ); lua_pushboolean( L, true ); @@ -150,6 +151,19 @@ int lguiGuiSetFont( lua_State *L ) { return 1; } +/* +> font = RL.GuiGetFont() + +Get gui custom font ( global state ) + +- Success return int +*/ +int lguiGuiGetFont( lua_State *L ) { + lua_pushinteger( L, state->guiFont ); + + return 1; +} + /* ## Gui - Style */ diff --git a/src/state.c b/src/state.c index e9e12f4..877464e 100644 --- a/src/state.c +++ b/src/state.c @@ -17,6 +17,7 @@ bool stateInit( const char *exePath ) { state->resolution = (Vector2){ 800, 600 }; state->luaState = NULL; state->textureSource = TEXTURE_SOURCE_TEXTURE; + state->guiFont = 0; /* Images. */ state->imageAlloc = ALLOC_PAGE_SIZE; state->imageCount = 0; -- cgit v1.2.3