summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjussi2023-10-31 12:21:25 +0200
committerjussi2023-10-31 12:21:25 +0200
commitd351b7b025f95983e49afaecb2fafef7802996a0 (patch)
treeda35b3e896042d0f13e4d744df2fb7743d5e7499 /src
parentf8b4b709e62c0fe25e4483925bac4abea5d8cafe (diff)
downloadreilua-enhanced-d351b7b025f95983e49afaecb2fafef7802996a0.tar.gz
reilua-enhanced-d351b7b025f95983e49afaecb2fafef7802996a0.tar.bz2
reilua-enhanced-d351b7b025f95983e49afaecb2fafef7802996a0.zip
More RLGL Initialization functions.
Diffstat (limited to 'src')
-rw-r--r--src/lua_core.c7
-rw-r--r--src/rlgl.c98
-rw-r--r--src/state.c1
3 files changed, 106 insertions, 0 deletions
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 );
diff --git a/src/rlgl.c b/src/rlgl.c
index 5855f60..2dc1b37 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -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;