diff options
| author | jussi | 2023-10-31 12:21:25 +0200 |
|---|---|---|
| committer | jussi | 2023-10-31 12:21:25 +0200 |
| commit | d351b7b025f95983e49afaecb2fafef7802996a0 (patch) | |
| tree | da35b3e896042d0f13e4d744df2fb7743d5e7499 | |
| parent | f8b4b709e62c0fe25e4483925bac4abea5d8cafe (diff) | |
| download | reilua-enhanced-d351b7b025f95983e49afaecb2fafef7802996a0.tar.gz reilua-enhanced-d351b7b025f95983e49afaecb2fafef7802996a0.tar.bz2 reilua-enhanced-d351b7b025f95983e49afaecb2fafef7802996a0.zip | |
More RLGL Initialization functions.
| -rw-r--r-- | API.md | 52 | ||||
| -rw-r--r-- | ReiLua_API.lua | 35 | ||||
| -rw-r--r-- | changelog | 1 | ||||
| -rw-r--r-- | include/lrlgl.h | 7 | ||||
| -rw-r--r-- | src/lua_core.c | 7 | ||||
| -rw-r--r-- | src/rlgl.c | 98 | ||||
| -rw-r--r-- | src/state.c | 1 |
7 files changed, 201 insertions, 0 deletions
@@ -6674,6 +6674,58 @@ Get current OpenGL version --- +> version = RL.rlSetFramebufferWidth( int width ) + +Set current framebuffer width + +--- + +> width = RL.rlGetFramebufferWidth() + +Get default framebuffer width + +- Success return int + +--- + +> version = RL.rlSetFramebufferHeight( int height ) + +Set current framebuffer height + +--- + +> height = RL.rlGetFramebufferHeight() + +Get default framebuffer height + +- Success return int + +--- + +> id = RL.rlGetTextureIdDefault() + +Get default texture id + +- Success return int + +--- + +> id = RL.rlGetShaderIdDefault() + +Get default shader id + +- Success return int + +--- + +> locations = RL.rlGetShaderLocsDefault() + +Get default shader locations + +- Success return int{} + +--- + ## RLGL - Render batch management --- diff --git a/ReiLua_API.lua b/ReiLua_API.lua index bcb2095..e03e8e0 100644 --- a/ReiLua_API.lua +++ b/ReiLua_API.lua @@ -5330,6 +5330,41 @@ function RL.rlSetBlendFactorsSeparate( glSrcRGB, glDstRGB, glSrcAlpha, glDstAlp ---@return any version function RL.rlGetVersion() end +---Set current framebuffer width +---@param width integer +---@return any version +function RL.rlSetFramebufferWidth( width ) end + +---Get default framebuffer width +---- Success return int +---@return any width +function RL.rlGetFramebufferWidth() end + +---Set current framebuffer height +---@param height integer +---@return any version +function RL.rlSetFramebufferHeight( height ) end + +---Get default framebuffer height +---- Success return int +---@return any height +function RL.rlGetFramebufferHeight() end + +---Get default texture id +---- Success return int +---@return any id +function RL.rlGetTextureIdDefault() end + +---Get default shader id +---- Success return int +---@return any id +function RL.rlGetShaderIdDefault() end + +---Get default shader locations +---- Success return int{} +---@return any locations +function RL.rlGetShaderLocsDefault() end + -- RLGL - Render batch management ---Update and draw internal render batch @@ -11,6 +11,7 @@ KEY CHANGES: Can be checked with IsGCUnloadEnabled - ADDED: Shaders management functions. - ADDED: Compute shader management and Buffer management. + - ADDED: More RLGL Initialization functions. DETAILED CHANGES: - CHANGED: GenImageColor now takes Vector2 as size. diff --git a/include/lrlgl.h b/include/lrlgl.h index dfe97e3..de5579e 100644 --- a/include/lrlgl.h +++ b/include/lrlgl.h @@ -76,6 +76,13 @@ int lrlglSetBlendFactors( lua_State *L ); int lrlglSetBlendFactorsSeparate( lua_State *L ); /* Initialization functions */ int lrlglGetVersion( lua_State *L ); +int lrlglSetFramebufferWidth( lua_State *L ); +int lrlglGetFramebufferWidth( lua_State *L ); +int lrlglSetFramebufferHeight( lua_State *L ); +int lrlglGetFramebufferHeight( lua_State *L ); +int lrlglGetTextureIdDefault( lua_State *L ); +int lrlglGetShaderIdDefault( lua_State *L ); +int lrlglGetShaderLocsDefault( lua_State *L ); /* Render batch management */ int lrlglDrawRenderBatchActive( lua_State *L ); int lrlglCheckRenderBatchLimit( lua_State *L ); diff --git a/src/lua_core.c b/src/lua_core.c index cd53c83..cb91583 100644 --- a/src/lua_core.c +++ b/src/lua_core.c @@ -2257,6 +2257,13 @@ void luaRegister() { assingGlobalFunction( "rlSetBlendFactorsSeparate", lrlglSetBlendFactorsSeparate ); /* Initialization functions. */ assingGlobalFunction( "rlGetVersion", lrlglGetVersion ); + assingGlobalFunction( "rlSetFramebufferWidth", lrlglSetFramebufferWidth ); + assingGlobalFunction( "rlGetFramebufferWidth", lrlglGetFramebufferWidth ); + assingGlobalFunction( "rlSetFramebufferHeight", lrlglSetFramebufferHeight ); + assingGlobalFunction( "rlGetFramebufferHeight", lrlglGetFramebufferHeight ); + assingGlobalFunction( "rlGetTextureIdDefault", lrlglGetTextureIdDefault ); + assingGlobalFunction( "rlGetShaderIdDefault", lrlglGetShaderIdDefault ); + assingGlobalFunction( "rlGetShaderLocsDefault", lrlglGetShaderLocsDefault ); /* Render batch management. */ assingGlobalFunction( "rlDrawRenderBatchActive", lrlglDrawRenderBatchActive ); assingGlobalFunction( "rlCheckRenderBatchLimit", lrlglCheckRenderBatchLimit ); @@ -865,6 +865,104 @@ int lrlglGetVersion( lua_State *L ) { } /* +> version = RL.rlSetFramebufferWidth( int width ) + +Set current framebuffer width +*/ +int lrlglSetFramebufferWidth( lua_State *L ) { + int width = luaL_checkinteger( L, 1 ); + + rlSetFramebufferWidth( width ); + + return 0; +} + +/* +> width = RL.rlGetFramebufferWidth() + +Get default framebuffer width + +- Success return int +*/ +int lrlglGetFramebufferWidth( lua_State *L ) { + lua_pushinteger( L, rlGetFramebufferWidth() ); + + return 1; +} + +/* +> version = RL.rlSetFramebufferHeight( int height ) + +Set current framebuffer height +*/ +int lrlglSetFramebufferHeight( lua_State *L ) { + int height = luaL_checkinteger( L, 1 ); + + rlSetFramebufferWidth( height ); + + return 0; +} + +/* +> height = RL.rlGetFramebufferHeight() + +Get default framebuffer height + +- Success return int +*/ +int lrlglGetFramebufferHeight( lua_State *L ) { + lua_pushinteger( L, rlGetFramebufferHeight() ); + + return 1; +} + +/* +> id = RL.rlGetTextureIdDefault() + +Get default texture id + +- Success return int +*/ +int lrlglGetTextureIdDefault( lua_State *L ) { + lua_pushinteger( L, rlGetTextureIdDefault() ); + + return 1; +} + +/* +> id = RL.rlGetShaderIdDefault() + +Get default shader id + +- Success return int +*/ +int lrlglGetShaderIdDefault( lua_State *L ) { + lua_pushinteger( L, rlGetShaderIdDefault() ); + + return 1; +} + +/* +> locations = RL.rlGetShaderLocsDefault() + +Get default shader locations + +- Success return int{} +*/ +int lrlglGetShaderLocsDefault( lua_State *L ) { + int *locs = rlGetShaderLocsDefault(); + + lua_createtable( L, RL_MAX_SHADER_LOCATIONS, 0 ); + + for ( int i = 0; i < RL_MAX_SHADER_LOCATIONS; i++ ) { + lua_pushinteger( L, locs[i] ); + lua_rawseti( L, -2, i + 1 ); + } + + return 1; +} + +/* ## RLGL - Render batch management */ diff --git a/src/state.c b/src/state.c index 228cbce..3706561 100644 --- a/src/state.c +++ b/src/state.c @@ -41,6 +41,7 @@ bool stateInit( int argn, const char **argc, const char *exePath ) { for ( int i = 0; i < RL_MAX_SHADER_LOCATIONS; i++ ) { state->RLGLcurrentShaderLocs[i] = defaultShaderLocs[i]; + printf( "defaultShaderLocs[%d] %d\n", i, defaultShaderLocs[i] ); } return state->run; |
