From d351b7b025f95983e49afaecb2fafef7802996a0 Mon Sep 17 00:00:00 2001 From: jussi Date: Tue, 31 Oct 2023 12:21:25 +0200 Subject: More RLGL Initialization functions. --- src/rlgl.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) (limited to 'src/rlgl.c') diff --git a/src/rlgl.c b/src/rlgl.c index 5855f60..2dc1b37 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -864,6 +864,104 @@ int lrlglGetVersion( lua_State *L ) { return 1; } +/* +> 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 */ -- cgit v1.2.3