diff options
| author | jussi | 2023-06-02 16:18:32 +0300 |
|---|---|---|
| committer | jussi | 2023-06-02 16:18:32 +0300 |
| commit | d550afa3d41e49c6cb215498db0eb547a628d578 (patch) | |
| tree | c5255c6ec1c021ca3917ee04236cf7ea4a8c85e5 /src | |
| parent | 9f979ad69c78a85bb88c2649a0613cea7890b650 (diff) | |
| download | reilua-enhanced-d550afa3d41e49c6cb215498db0eb547a628d578.tar.gz reilua-enhanced-d550afa3d41e49c6cb215498db0eb547a628d578.tar.bz2 reilua-enhanced-d550afa3d41e49c6cb215498db0eb547a628d578.zip | |
RLGL Textures state functions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core.c | 3 | ||||
| -rw-r--r-- | src/lua_core.c | 8 | ||||
| -rw-r--r-- | src/rlgl.c | 134 |
3 files changed, 143 insertions, 2 deletions
@@ -1568,8 +1568,7 @@ int lcoreGetKeyScancode( lua_State *L ) { } int key = lua_tointeger( L, 1 ); - int scancode = glfwGetKeyScancode( key ); - lua_pushinteger( L, scancode ); + lua_pushinteger( L, glfwGetKeyScancode( key ) ); return 1; } diff --git a/src/lua_core.c b/src/lua_core.c index 09684c7..0fa02da 100644 --- a/src/lua_core.c +++ b/src/lua_core.c @@ -1475,6 +1475,14 @@ void luaRegister() { assingGlobalFunction( "IsLightEnabled", llightsIsLightEnabled ); /* RLGL */ + /* Textures state */ + assingGlobalFunction( "rlActiveTextureSlot", lrlglActiveTextureSlot ); + assingGlobalFunction( "rlEnableTexture", lrlglEnableTexture ); + assingGlobalFunction( "rlDisableTexture", lrlglDisableTexture ); + assingGlobalFunction( "rlEnableTextureCubemap", lrlglEnableTextureCubemap ); + assingGlobalFunction( "rlDisableTextureCubemap", lrlglDisableTextureCubemap ); + assingGlobalFunction( "rlTextureParameters", lrlglTextureParameters ); + assingGlobalFunction( "rlCubemapParameters", lrlglCubemapParameters ); /* Framebuffer state. */ assingGlobalFunction( "rlEnableFramebuffer", lrlglEnableFramebuffer ); assingGlobalFunction( "rlDisableFramebuffer", lrlglDisableFramebuffer ); @@ -4,6 +4,140 @@ #include "lrlgl.h" /* +## RLGL - Textures state +*/ + +/* +> success = RL.rlActiveTextureSlot( int slot ) + +Select and active a texture slot + +- Failure return false +- Success return true +*/ +int lrlglActiveTextureSlot( lua_State *L ) { + if ( !lua_isnumber( L, 1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlActiveTextureSlot( int slot )" ); + lua_pushboolean( L, false ); + return 1; + } + rlActiveTextureSlot( lua_tointeger( L, 1 ) ); + lua_pushboolean( L, true ); + + return 1; +} + +/* +> success = RL.rlEnableTexture( int id ) + +Enable texture + +- Failure return false +- Success return true +*/ +int lrlglEnableTexture( lua_State *L ) { + if ( !lua_isnumber( L, 1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlEnableTexture( int id )" ); + lua_pushboolean( L, false ); + return 1; + } + rlEnableTexture( lua_tointeger( L, 1 ) ); + lua_pushboolean( L, true ); + + return 1; +} + +/* +> RL.rlDisableTexture() + +Disable texture +*/ +int lrlglDisableTexture( lua_State *L ) { + rlDisableTexture(); + + return 0; +} + +/* +> success = RL.rlEnableTextureCubemap( int id ) + +Enable texture cubemap + +- Failure return false +- Success return true +*/ +int lrlglEnableTextureCubemap( lua_State *L ) { + if ( !lua_isnumber( L, 1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlEnableTextureCubemap( int id )" ); + lua_pushboolean( L, false ); + return 1; + } + rlEnableTextureCubemap( lua_tointeger( L, 1 ) ); + lua_pushboolean( L, true ); + + return 1; +} + +/* +> RL.rlDisableTextureCubemap() + +Disable texture cubemap +*/ +int lrlglDisableTextureCubemap( lua_State *L ) { + rlDisableTextureCubemap(); + + return 0; +} + +/* +> success = RL.rlTextureParameters( int id, int param, int value ) + +Set texture parameters ( filter, wrap ) + +- Failure return false +- Success return true +*/ +int lrlglTextureParameters( lua_State *L ) { + if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlTextureParameters( int id, int param, int value )" ); + lua_pushboolean( L, false ); + return 1; + } + unsigned int id = lua_tointeger( L, 1 ); + int param = lua_tointeger( L, 2 ); + int value = lua_tointeger( L, 3 ); + + rlTextureParameters( id, param, value ); + lua_pushboolean( L, true ); + + return 1; +} + +/* +> success = RL.rlCubemapParameters( int id, int param, int value ) + +Set cubemap parameters ( filter, wrap ) + +- Failure return false +- Success return true +*/ +int lrlglCubemapParameters( lua_State *L ) { + if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlCubemapParameters( int id, int param, int value )" ); + lua_pushboolean( L, false ); + return 1; + } + unsigned int id = lua_tointeger( L, 1 ); + int param = lua_tointeger( L, 2 ); + int value = lua_tointeger( L, 3 ); + + rlCubemapParameters( id, param, value ); + lua_pushboolean( L, true ); + + return 1; +} + +/* ## RLGL - Framebuffer state */ |
