Shapes, RLGL, Math, Gui and Easings to new style.

This commit is contained in:
jussi
2023-10-29 15:21:10 +02:00
parent 76911d45a8
commit 0df40e2ac0
11 changed files with 1076 additions and 3952 deletions

792
API.md

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -787,7 +787,7 @@ NOTE: Set nil if no shader
*/ */
int lcoreLoadShader( lua_State *L ) { int lcoreLoadShader( lua_State *L ) {
if ( !( lua_isstring( L, 1 ) || lua_isnil( L, 1 ) ) || !( lua_isstring( L, 2 ) || lua_isnil( L, 2 ) ) ) { if ( !( lua_isstring( L, 1 ) || lua_isnil( L, 1 ) ) || !( lua_isstring( L, 2 ) || lua_isnil( L, 2 ) ) ) {
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.LoadShader( string vsFileName, string fsFileName )" ); TraceLog( state->logLevelInvalid, "%s", "Argument needs to be string or nil" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }

View File

@@ -13,19 +13,13 @@
Ease linear Ease linear
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseLinear( lua_State *L ) { int leasingsEaseLinear( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseLinear( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseLinearNone( t, b, c, d ) ); lua_pushnumber( L, EaseLinearNone( t, b, c, d ) );
@@ -41,19 +35,13 @@ int leasingsEaseLinear( lua_State *L ) {
Ease sine in Ease sine in
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseSineIn( lua_State *L ) { int leasingsEaseSineIn( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseSineIn( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseSineIn( t, b, c, d ) ); lua_pushnumber( L, EaseSineIn( t, b, c, d ) );
@@ -65,19 +53,13 @@ int leasingsEaseSineIn( lua_State *L ) {
Ease sine out Ease sine out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseSineOut( lua_State *L ) { int leasingsEaseSineOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseSineOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseSineOut( t, b, c, d ) ); lua_pushnumber( L, EaseSineOut( t, b, c, d ) );
@@ -89,19 +71,13 @@ int leasingsEaseSineOut( lua_State *L ) {
Ease sine in out Ease sine in out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseSineInOut( lua_State *L ) { int leasingsEaseSineInOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseSineInOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseSineInOut( t, b, c, d ) ); lua_pushnumber( L, EaseSineInOut( t, b, c, d ) );
@@ -117,19 +93,13 @@ int leasingsEaseSineInOut( lua_State *L ) {
Ease circle in Ease circle in
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseCircIn( lua_State *L ) { int leasingsEaseCircIn( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseCircIn( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseCircIn( t, b, c, d ) ); lua_pushnumber( L, EaseCircIn( t, b, c, d ) );
@@ -141,19 +111,13 @@ int leasingsEaseCircIn( lua_State *L ) {
Ease circle out Ease circle out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseCircOut( lua_State *L ) { int leasingsEaseCircOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseCircOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseCircOut( t, b, c, d ) ); lua_pushnumber( L, EaseCircOut( t, b, c, d ) );
@@ -165,19 +129,13 @@ int leasingsEaseCircOut( lua_State *L ) {
Ease circle in out Ease circle in out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseCircInOut( lua_State *L ) { int leasingsEaseCircInOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseCircInOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseCircInOut( t, b, c, d ) ); lua_pushnumber( L, EaseCircInOut( t, b, c, d ) );
@@ -193,19 +151,13 @@ int leasingsEaseCircInOut( lua_State *L ) {
Ease cubic in Ease cubic in
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseCubicIn( lua_State *L ) { int leasingsEaseCubicIn( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseCubicIn( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseCubicIn( t, b, c, d ) ); lua_pushnumber( L, EaseCubicIn( t, b, c, d ) );
@@ -217,19 +169,13 @@ int leasingsEaseCubicIn( lua_State *L ) {
Ease cubic out Ease cubic out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseCubicOut( lua_State *L ) { int leasingsEaseCubicOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseCubicOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseCubicOut( t, b, c, d ) ); lua_pushnumber( L, EaseCubicOut( t, b, c, d ) );
@@ -241,19 +187,13 @@ int leasingsEaseCubicOut( lua_State *L ) {
Ease cubic in out Ease cubic in out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseCubicInOut( lua_State *L ) { int leasingsEaseCubicInOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseCubicInOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseCubicInOut( t, b, c, d ) ); lua_pushnumber( L, EaseCubicInOut( t, b, c, d ) );
@@ -269,19 +209,13 @@ int leasingsEaseCubicInOut( lua_State *L ) {
Ease quadratic in Ease quadratic in
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseQuadIn( lua_State *L ) { int leasingsEaseQuadIn( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseQuadIn( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseQuadIn( t, b, c, d ) ); lua_pushnumber( L, EaseQuadIn( t, b, c, d ) );
@@ -293,19 +227,13 @@ int leasingsEaseQuadIn( lua_State *L ) {
Ease quadratic out Ease quadratic out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseQuadOut( lua_State *L ) { int leasingsEaseQuadOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseQuadOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseQuadOut( t, b, c, d ) ); lua_pushnumber( L, EaseQuadOut( t, b, c, d ) );
@@ -317,19 +245,13 @@ int leasingsEaseQuadOut( lua_State *L ) {
Ease quadratic in out Ease quadratic in out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseQuadInOut( lua_State *L ) { int leasingsEaseQuadInOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseQuadInOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseQuadInOut( t, b, c, d ) ); lua_pushnumber( L, EaseQuadInOut( t, b, c, d ) );
@@ -345,19 +267,13 @@ int leasingsEaseQuadInOut( lua_State *L ) {
Ease exponential in Ease exponential in
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseExpoIn( lua_State *L ) { int leasingsEaseExpoIn( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseExpoIn( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseExpoIn( t, b, c, d ) ); lua_pushnumber( L, EaseExpoIn( t, b, c, d ) );
@@ -369,19 +285,13 @@ int leasingsEaseExpoIn( lua_State *L ) {
Ease exponential out Ease exponential out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseExpoOut( lua_State *L ) { int leasingsEaseExpoOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseExpoOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseExpoOut( t, b, c, d ) ); lua_pushnumber( L, EaseExpoOut( t, b, c, d ) );
@@ -393,19 +303,13 @@ int leasingsEaseExpoOut( lua_State *L ) {
Ease exponential in out Ease exponential in out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseExpoInOut( lua_State *L ) { int leasingsEaseExpoInOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseExpoInOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseExpoInOut( t, b, c, d ) ); lua_pushnumber( L, EaseExpoInOut( t, b, c, d ) );
@@ -421,19 +325,13 @@ int leasingsEaseExpoInOut( lua_State *L ) {
Ease back in Ease back in
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseBackIn( lua_State *L ) { int leasingsEaseBackIn( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseBackIn( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseBackIn( t, b, c, d ) ); lua_pushnumber( L, EaseBackIn( t, b, c, d ) );
@@ -445,19 +343,13 @@ int leasingsEaseBackIn( lua_State *L ) {
Ease back out Ease back out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseBackOut( lua_State *L ) { int leasingsEaseBackOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseBackOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseBackOut( t, b, c, d ) ); lua_pushnumber( L, EaseBackOut( t, b, c, d ) );
@@ -469,19 +361,13 @@ int leasingsEaseBackOut( lua_State *L ) {
Ease back in out Ease back in out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseBackInOut( lua_State *L ) { int leasingsEaseBackInOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseBackInOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseBackInOut( t, b, c, d ) ); lua_pushnumber( L, EaseBackInOut( t, b, c, d ) );
@@ -497,19 +383,13 @@ int leasingsEaseBackInOut( lua_State *L ) {
Ease bounce in Ease bounce in
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseBounceIn( lua_State *L ) { int leasingsEaseBounceIn( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseBounceIn( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseBounceIn( t, b, c, d ) ); lua_pushnumber( L, EaseBounceIn( t, b, c, d ) );
@@ -521,19 +401,13 @@ int leasingsEaseBounceIn( lua_State *L ) {
Ease bounce out Ease bounce out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseBounceOut( lua_State *L ) { int leasingsEaseBounceOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseBounceOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseBounceOut( t, b, c, d ) ); lua_pushnumber( L, EaseBounceOut( t, b, c, d ) );
@@ -545,19 +419,13 @@ int leasingsEaseBounceOut( lua_State *L ) {
Ease bounce in out Ease bounce in out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseBounceInOut( lua_State *L ) { int leasingsEaseBounceInOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseBounceInOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseBounceInOut( t, b, c, d ) ); lua_pushnumber( L, EaseBounceInOut( t, b, c, d ) );
@@ -573,19 +441,13 @@ int leasingsEaseBounceInOut( lua_State *L ) {
Ease elastic in Ease elastic in
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseElasticIn( lua_State *L ) { int leasingsEaseElasticIn( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseElasticIn( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseElasticIn( t, b, c, d ) ); lua_pushnumber( L, EaseElasticIn( t, b, c, d ) );
@@ -597,19 +459,13 @@ int leasingsEaseElasticIn( lua_State *L ) {
Ease elastic out Ease elastic out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseElasticOut( lua_State *L ) { int leasingsEaseElasticOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseElasticOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseElasticOut( t, b, c, d ) ); lua_pushnumber( L, EaseElasticOut( t, b, c, d ) );
@@ -621,19 +477,13 @@ int leasingsEaseElasticOut( lua_State *L ) {
Ease elastic in out Ease elastic in out
- Failure return false
- Success return float - Success return float
*/ */
int leasingsEaseElasticInOut( lua_State *L ) { int leasingsEaseElasticInOut( lua_State *L ) {
if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) ) { float t = luaL_checknumber( L, 1 );
TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.EaseElasticInOut( float t, float b, float c, float d )" ); float b = luaL_checknumber( L, 2 );
lua_pushboolean( L, false ); float c = luaL_checknumber( L, 3 );
return 1; float d = luaL_checknumber( L, 4 );
}
float t = lua_tonumber( L, 1 );
float b = lua_tonumber( L, 2 );
float c = lua_tonumber( L, 3 );
float d = lua_tonumber( L, 4 );
lua_pushnumber( L, EaseElasticInOut( t, b, c, d ) ); lua_pushnumber( L, EaseElasticInOut( t, b, c, d ) );

View File

@@ -15,25 +15,29 @@ Copy a block of pixels from one framebuffer object to another.
Use -1 RenderTexture for window framebuffer. Use -1 RenderTexture for window framebuffer.
*/ */
int lglBlitFramebuffer( lua_State *L ) { int lglBlitFramebuffer( lua_State *L ) {
// TODO Currently doesn't support setting window render target because of luaL_checkudata. if ( !( lua_isuserdata( L, 1 ) || lua_isnil( L, 1 ) ) || !( lua_isuserdata( L, 2 ) || lua_isnil( L, 2 ) ) ) {
RenderTexture *srcTex = luaL_checkudata( L, 1, "RenderTexture" ); TraceLog( state->logLevelInvalid, "%s", "Argument needs to be RenderTexture or nil" );
RenderTexture *dstTex = luaL_checkudata( L, 2, "RenderTexture" ); lua_pushnil( L );
return 1;
}
Rectangle srcRect = uluaGetRectangleIndex( L, 3 ); Rectangle srcRect = uluaGetRectangleIndex( L, 3 );
Rectangle dstRect = uluaGetRectangleIndex( L, 4 ); Rectangle dstRect = uluaGetRectangleIndex( L, 4 );
int mask = luaL_checkinteger( L, 5 ); int mask = luaL_checkinteger( L, 5 );
int filter = luaL_checkinteger( L, 6 ); int filter = luaL_checkinteger( L, 6 );
if ( lua_tointeger( L, 1 ) == -1 ) { if ( lua_isnil( L, 1 ) ) {
glBindFramebuffer( GL_READ_FRAMEBUFFER, 0 ); glBindFramebuffer( GL_READ_FRAMEBUFFER, 0 );
} }
else { else {
RenderTexture *srcTex = luaL_checkudata( L, 1, "RenderTexture" );
glBindFramebuffer( GL_READ_FRAMEBUFFER, srcTex->id ); glBindFramebuffer( GL_READ_FRAMEBUFFER, srcTex->id );
} }
if ( lua_tointeger( L, 2 ) == -1 ) { if ( lua_isnil( L, 2 ) ) {
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 );
} }
else { else {
RenderTexture *dstTex = luaL_checkudata( L, 2, "RenderTexture" );
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, dstTex->id ); glBindFramebuffer( GL_DRAW_FRAMEBUFFER, dstTex->id );
} }

View File

@@ -16,7 +16,7 @@
/* Define types. */ /* Define types. */
/* Buffer. */ /* Buffer. */
static int gcBuffer( lua_State *L ) { static int gcBuffer( lua_State *L ) {
Buffer *buffer = luaL_checkudata ( L, 1, "Buffer" ); Buffer *buffer = luaL_checkudata ( L, 1, "Buffer" );
free( buffer->data ); free( buffer->data );
@@ -32,7 +32,7 @@ static void defineBuffer() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* Image */ /* Image */
static int gcImage( lua_State *L ) { static int gcImage( lua_State *L ) {
Image *image = luaL_checkudata ( L, 1, "Image" ); Image *image = luaL_checkudata ( L, 1, "Image" );
printf( "gcImage\n" ); printf( "gcImage\n" );
@@ -50,7 +50,7 @@ static void defineImage() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* Texture */ /* Texture */
static int gcTexture( lua_State *L ) { static int gcTexture( lua_State *L ) {
Texture *texture = luaL_checkudata ( L, 1, "Texture" ); Texture *texture = luaL_checkudata ( L, 1, "Texture" );
printf( "gcTexture\n" ); printf( "gcTexture\n" );
@@ -68,7 +68,7 @@ static void defineTexture() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* RenderRexture. */ /* RenderRexture. */
static int gcRenderTexture( lua_State *L ) { static int gcRenderTexture( lua_State *L ) {
RenderTexture *renderTexture = luaL_checkudata ( L, 1, "RenderTexture" ); RenderTexture *renderTexture = luaL_checkudata ( L, 1, "RenderTexture" );
printf( "gcRenderTexture\n" ); printf( "gcRenderTexture\n" );
@@ -86,7 +86,7 @@ static void defineRenderTexture() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* Camera2D. */ /* Camera2D. */
static void defineCamera2D() { static void defineCamera2D() {
lua_State *L = state->luaState; lua_State *L = state->luaState;
@@ -95,7 +95,7 @@ static void defineCamera2D() {
lua_setfield( L, -2, "__index" ); lua_setfield( L, -2, "__index" );
} }
/* Camera3D. */ /* Camera3D. */
static void defineCamera3D() { static void defineCamera3D() {
lua_State *L = state->luaState; lua_State *L = state->luaState;
@@ -104,7 +104,7 @@ static void defineCamera3D() {
lua_setfield( L, -2, "__index" ); lua_setfield( L, -2, "__index" );
} }
/* Shader. */ /* Shader. */
static int gcShader( lua_State *L ) { static int gcShader( lua_State *L ) {
Shader *shader = luaL_checkudata ( L, 1, "Shader" ); Shader *shader = luaL_checkudata ( L, 1, "Shader" );
printf( "gcShader\n" ); printf( "gcShader\n" );
@@ -122,7 +122,7 @@ static void defineShader() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* Font. */ /* Font. */
static int gcFont( lua_State *L ) { static int gcFont( lua_State *L ) {
Font *font = luaL_checkudata ( L, 1, "Font" ); Font *font = luaL_checkudata ( L, 1, "Font" );
printf( "gcFont\n" ); printf( "gcFont\n" );
@@ -140,7 +140,7 @@ static void defineFont() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* Wave. */ /* Wave. */
static int gcWave( lua_State *L ) { static int gcWave( lua_State *L ) {
Wave *wave = luaL_checkudata ( L, 1, "Wave" ); Wave *wave = luaL_checkudata ( L, 1, "Wave" );
printf( "gcWave\n" ); printf( "gcWave\n" );
@@ -158,7 +158,7 @@ static void defineWave() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* Sound. */ /* Sound. */
static int gcSound( lua_State *L ) { static int gcSound( lua_State *L ) {
Sound *sound = luaL_checkudata ( L, 1, "Sound" ); Sound *sound = luaL_checkudata ( L, 1, "Sound" );
printf( "gcSound\n" ); printf( "gcSound\n" );
@@ -176,7 +176,7 @@ static void defineSound() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* Music. */ /* Music. */
static int gcMusic( lua_State *L ) { static int gcMusic( lua_State *L ) {
Music *music = luaL_checkudata ( L, 1, "Music" ); Music *music = luaL_checkudata ( L, 1, "Music" );
printf( "gcMusic\n" ); printf( "gcMusic\n" );
@@ -194,7 +194,7 @@ static void defineMusic() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* Light. */ /* Light. */
static void defineLight() { static void defineLight() {
lua_State *L = state->luaState; lua_State *L = state->luaState;
@@ -203,7 +203,7 @@ static void defineLight() {
lua_setfield( L, -2, "__index" ); lua_setfield( L, -2, "__index" );
} }
/* Material. */ /* Material. */
static int gcMaterial( lua_State *L ) { static int gcMaterial( lua_State *L ) {
Material *material = luaL_checkudata ( L, 1, "Material" ); Material *material = luaL_checkudata ( L, 1, "Material" );
printf( "gcMaterial\n" ); printf( "gcMaterial\n" );
@@ -235,7 +235,7 @@ static void defineMaterial() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* Mesh. */ /* Mesh. */
static int gcMesh( lua_State *L ) { static int gcMesh( lua_State *L ) {
Mesh *mesh = luaL_checkudata ( L, 1, "Mesh" ); Mesh *mesh = luaL_checkudata ( L, 1, "Mesh" );
printf( "gcMesh\n" ); printf( "gcMesh\n" );
@@ -253,7 +253,7 @@ static void defineMesh() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* Model. */ /* Model. */
static int gcModel( lua_State *L ) { static int gcModel( lua_State *L ) {
Model *model = luaL_checkudata ( L, 1, "Model" ); Model *model = luaL_checkudata ( L, 1, "Model" );
printf( "gcModel\n" ); printf( "gcModel\n" );
@@ -272,7 +272,7 @@ static void defineModel() {
lua_setfield( L, -2, "__gc" ); lua_setfield( L, -2, "__gc" );
} }
/* ModelAnimation. */ /* ModelAnimation. */
static int gcModelAnimation( lua_State *L ) { static int gcModelAnimation( lua_State *L ) {
ModelAnimation *modelAnimation = luaL_checkudata ( L, 1, "ModelAnimation" ); ModelAnimation *modelAnimation = luaL_checkudata ( L, 1, "ModelAnimation" );
printf( "gcModelAnimation\n" ); printf( "gcModelAnimation\n" );
@@ -2332,10 +2332,6 @@ Color uluaGetColorIndex( lua_State *L, int index ) {
luaL_checktype( L, index, LUA_TTABLE ); luaL_checktype( L, index, LUA_TTABLE );
Color color = { 0, 0, 0, 255 }; Color color = { 0, 0, 0, 255 };
if ( !lua_istable( L, index ) ) {
TraceLog( state->logLevelInvalid, "%s", "Error. Wrong color value. Returning { 0, 0, 0, 255 }" );
return color;
}
int t = index, i = 0; int t = index, i = 0;
lua_pushnil( L ); lua_pushnil( L );
@@ -2388,10 +2384,6 @@ Vector2 uluaGetVector2Index( lua_State *L, int index ) {
luaL_checktype( L, index, LUA_TTABLE ); luaL_checktype( L, index, LUA_TTABLE );
Vector2 vector = { 0.0f, 0.0f }; Vector2 vector = { 0.0f, 0.0f };
if ( !lua_istable( L, index ) ) {
TraceLog( state->logLevelInvalid, "%s", "Error. Wrong vector2 value. Returning { 0, 0 }" );
return vector;
}
int t = index, i = 0; int t = index, i = 0;
lua_pushnil( L ); lua_pushnil( L );
@@ -2432,10 +2424,6 @@ Vector3 uluaGetVector3Index( lua_State *L, int index ) {
luaL_checktype( L, index, LUA_TTABLE ); luaL_checktype( L, index, LUA_TTABLE );
Vector3 vector = { 0.0f, 0.0f, 0.0f }; Vector3 vector = { 0.0f, 0.0f, 0.0f };
if ( !lua_istable( L, index ) ) {
TraceLog( state->logLevelInvalid, "%s", "Error. Wrong vector3 value. Returning { 0, 0, 0 }" );
return vector;
}
int t = index, i = 0; int t = index, i = 0;
lua_pushnil( L ); lua_pushnil( L );
@@ -2482,10 +2470,6 @@ Vector4 uluaGetVector4Index( lua_State *L, int index ) {
luaL_checktype( L, index, LUA_TTABLE ); luaL_checktype( L, index, LUA_TTABLE );
Vector4 vector = { 0.0f, 0.0f, 0.0f, 0.0f }; Vector4 vector = { 0.0f, 0.0f, 0.0f, 0.0f };
if ( !lua_istable( L, index ) ) {
TraceLog( state->logLevelInvalid, "%s", "Error. Wrong vector4 value. Returning { 0, 0, 0, 0 }" );
return vector;
}
int t = index, i = 0; int t = index, i = 0;
lua_pushnil( L ); lua_pushnil( L );
@@ -2538,11 +2522,6 @@ Rectangle uluaGetRectangleIndex( lua_State *L, int index ) {
luaL_checktype( L, index, LUA_TTABLE ); luaL_checktype( L, index, LUA_TTABLE );
Rectangle rect = { 0.0f, 0.0f, 0.0f, 0.0f }; Rectangle rect = { 0.0f, 0.0f, 0.0f, 0.0f };
if ( !lua_istable( L, index ) ) {
TraceLog( state->logLevelInvalid, "%s", "Error. Wrong rectangle value. Returning { 0, 0, 0, 0 }" );
return rect;
}
int t = index, i = 0; int t = index, i = 0;
lua_pushnil( L ); lua_pushnil( L );
@@ -2595,10 +2574,6 @@ Quaternion uluaGetQuaternionIndex( lua_State *L, int index ) {
luaL_checktype( L, index, LUA_TTABLE ); luaL_checktype( L, index, LUA_TTABLE );
Quaternion quaternion = { 0.0f, 0.0f, 0.0f, 0.0f }; Quaternion quaternion = { 0.0f, 0.0f, 0.0f, 0.0f };
if ( !lua_istable( L, index ) ) {
TraceLog( state->logLevelInvalid, "%s", "Error. Wrong quaternion value. Returning { 0, 0, 0, 0 }" );
return quaternion;
}
int t = index, i = 0; int t = index, i = 0;
lua_pushnil( L ); lua_pushnil( L );
@@ -2652,10 +2627,6 @@ Matrix uluaGetMatrixIndex( lua_State *L, int index ) {
Matrix matrix = { 0.0f }; Matrix matrix = { 0.0f };
float m[4][4]; float m[4][4];
if ( !lua_istable( L, index ) ) {
TraceLog( state->logLevelInvalid, "%s", "Error. Wrong matrix value. Returning MatrixIdentity." );
return MatrixIdentity();
}
int t = index, i = 0; int t = index, i = 0;
lua_pushnil( L ); lua_pushnil( L );
@@ -2691,10 +2662,6 @@ BoundingBox uluaGetBoundingBoxIndex( lua_State *L, int index ) {
luaL_checktype( L, index, LUA_TTABLE ); luaL_checktype( L, index, LUA_TTABLE );
BoundingBox box = { .min = { 0.0, 0.0, 0.0 }, .max = { 0.0, 0.0, 0.0 } }; BoundingBox box = { .min = { 0.0, 0.0, 0.0 }, .max = { 0.0, 0.0, 0.0 } };
if ( !lua_istable( L, index ) ) {
TraceLog( state->logLevelInvalid, "%s", "Error. Wrong boundingbox value. Returning { min{ 0, 0, 0 }, max{ 0, 0, 0 } }." );
return box;
}
int t = index, i = 0; int t = index, i = 0;
lua_pushnil( L ); lua_pushnil( L );
@@ -2736,10 +2703,6 @@ Ray uluaGetRayIndex( lua_State *L, int index ) {
luaL_checktype( L, index, LUA_TTABLE ); luaL_checktype( L, index, LUA_TTABLE );
Ray ray = { .position = { 0.0, 0.0, 0.0 }, .direction = { 0.0, 0.0, 0.0 } }; Ray ray = { .position = { 0.0, 0.0, 0.0 }, .direction = { 0.0, 0.0, 0.0 } };
if ( !lua_istable( L, index ) ) {
TraceLog( state->logLevelInvalid, "%s", "Error. Wrong ray value. Returning { position{ 0, 0, 0 }, direction{ 0, 0, 0 } }." );
return ray;
}
int t = index, i = 0; int t = index, i = 0;
lua_pushnil( L ); lua_pushnil( L );
@@ -2781,10 +2744,6 @@ NPatchInfo uluaGetNPatchInfoIndex( lua_State *L, int index ) {
luaL_checktype( L, index, LUA_TTABLE ); luaL_checktype( L, index, LUA_TTABLE );
NPatchInfo npatch = { .source = { 0.0, 0.0, 0.0, 0.0 }, .left = 0, .top = 0, .right = 0, .bottom = 0, .layout = NPATCH_NINE_PATCH }; NPatchInfo npatch = { .source = { 0.0, 0.0, 0.0, 0.0 }, .left = 0, .top = 0, .right = 0, .bottom = 0, .layout = NPATCH_NINE_PATCH };
if ( !lua_istable( L, index ) ) {
TraceLog( state->logLevelInvalid, "%s", "Error. Wrong ray value. Returning { source = { 0.0, 0.0, 0.0, 0.0 }, left = 0, top = 0, right = 0, bottom = 0, layout = NPATCH_NINE_PATCH }." );
return npatch;
}
int t = index, i = 0; int t = index, i = 0;
lua_pushnil( L ); lua_pushnil( L );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -276,30 +276,17 @@ int ltexturesImageFromImage( lua_State *L ) {
Create an image from text (custom sprite font) Create an image from text (custom sprite font)
- Failure return -1 - Success return Image
- Success return int
*/ */
int ltexturesImageText( lua_State *L ) { int ltexturesImageText( lua_State *L ) {
// if ( !lua_isnumber( L, 1 ) || !lua_isstring( L, 2 ) || !lua_isnumber( L, 3 ) Font *font = luaL_checkudata( L, 1, "Font" );
// || !lua_isnumber( L, 4 ) || !lua_istable( L, 5 ) ) { float fontSize = lua_tonumber( L, 3 );
// TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.ImageText( Font font, string text, float fontSize, float spacing, Color tint )" ); float spacing = lua_tonumber( L, 4 );
// lua_pushinteger( L, -1 ); Color tint = uluaGetColorIndex( L, 5 );
// return 1;
// }
// size_t fontId = lua_tointeger( L, 1 );
// float fontSize = lua_tonumber( L, 3 );
// float spacing = lua_tonumber( L, 4 );
// Color tint = uluaGetColorIndex( L, 5 );
// if ( !validFont( fontId ) ) { uluaPushImage( L, ImageTextEx( *font, luaL_checkstring( L, 2 ), fontSize, spacing, tint ) );
// lua_pushinteger( L, -1 );
// return 1;
// }
// int i = newImage();
// *state->images[i] = ImageTextEx( *state->fonts[ fontId ], lua_tostring( L, 2 ), fontSize, spacing, tint );
// lua_pushinteger( L, i );
return 0; return 1;
} }
/* /*