summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjussi2023-04-06 19:19:44 +0300
committerjussi2023-04-06 19:19:44 +0300
commitfe15e836bd87963d10bd301a3a24652763059e0d (patch)
treea3bd6dbfcadfb3a5ba10a173d443da0595386d19 /src
parent2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a (diff)
downloadreilua-enhanced-fe15e836bd87963d10bd301a3a24652763059e0d.tar.gz
reilua-enhanced-fe15e836bd87963d10bd301a3a24652763059e0d.tar.bz2
reilua-enhanced-fe15e836bd87963d10bd301a3a24652763059e0d.zip
Switched to Raylib vertion 4.5. Removed some functions and added others. Main changes to camera3D.
Diffstat (limited to 'src')
-rw-r--r--src/audio.c50
-rw-r--r--src/core.c129
-rw-r--r--src/lua_core.c25
-rw-r--r--src/models.c68
-rw-r--r--src/rmath.c25
-rw-r--r--src/state.c3
-rw-r--r--src/textures.c98
7 files changed, 111 insertions, 287 deletions
diff --git a/src/audio.c b/src/audio.c
index 70c38e7..d62fcfd 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -398,56 +398,6 @@ int laudioResumeSound( lua_State *L ) {
}
/*
-> success = RL.PlaySoundMulti( Sound sound )
-
-Play a sound ( Using multichannel buffer pool )
-
-- Failure return false
-- Success return true
-*/
-int laudioPlaySoundMulti( lua_State *L ) {
- if ( !lua_isnumber( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.PlaySoundMulti( Sound sound )" );
- lua_pushboolean( L, false );
- return 1;
- }
- size_t soundId = lua_tointeger( L, -1 );
-
- if ( !validSound( soundId ) ) {
- lua_pushboolean( L, false );
- return 1;
- }
- PlaySoundMulti( *state->sounds[ soundId ] );
- lua_pushboolean( L, true );
-
- return 1;
-}
-
-/*
-> RL.StopSoundMulti()
-
-Stop any sound playing ( using multichannel buffer pool )
-*/
-int laudioStopSoundMulti( lua_State *L ) {
- StopSoundMulti();
-
- return 0;
-}
-
-/*
-> count = RL.GetSoundsPlaying()
-
-Get number of sounds playing in the multichannel
-
-- Success return int
-*/
-int laudioGetSoundsPlaying( lua_State *L ) {
- lua_pushinteger( L, GetSoundsPlaying() );
-
- return 1;
-}
-
-/*
> playing = RL.IsSoundPlaying( Sound sound )
Check if a sound is currently playing
diff --git a/src/core.c b/src/core.c
index 71d1505..02eff94 100644
--- a/src/core.c
+++ b/src/core.c
@@ -2547,7 +2547,7 @@ int lcoreSetCamera2DOffset( lua_State *L ) {
}
/*
-> success = RL.SetCamera2DRotation( camera3D camera, float rotation )
+> success = RL.SetCamera2DRotation( camera2D camera, float rotation )
Set camera rotation in degrees
@@ -2556,7 +2556,7 @@ Set camera rotation in degrees
*/
int lcoreSetCamera2DRotation( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetCamera2DRotation( camera3D camera, float rotation )" );
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetCamera2DRotation( camera2D camera, float rotation )" );
lua_pushboolean( L, false );
return 1;
}
@@ -2574,7 +2574,7 @@ int lcoreSetCamera2DRotation( lua_State *L ) {
}
/*
-> success = RL.SetCamera2DZoom( camera3D camera, float zoom )
+> success = RL.SetCamera2DZoom( camera2D camera, float zoom )
Set camera zoom ( scaling ), should be 1.0f by default
@@ -2583,7 +2583,7 @@ Set camera zoom ( scaling ), should be 1.0f by default
*/
int lcoreSetCamera2DZoom( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetCamera2DZoom( camera3D camera, float zoom )" );
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetCamera2DZoom( camera2D camera, float zoom )" );
lua_pushboolean( L, false );
return 1;
}
@@ -2727,7 +2727,6 @@ int lcoreCreateCamera3D( lua_State *L ) {
state->camera3Ds[i]->up = (Vector3){ 0.0, 0.0, 0.0 };
state->camera3Ds[i]->fovy = 45.0f;
state->camera3Ds[i]->projection = CAMERA_PERSPECTIVE;
- SetCameraMode( *state->camera3Ds[i], CAMERA_CUSTOM );
lua_pushinteger( L, i );
checkCamera3DRealloc(i);
@@ -2940,33 +2939,6 @@ int lcoreSetCamera3DProjection( lua_State *L ) {
}
/*
-> success = RL.SetCameraMode( camera3D camera, int mode )
-
-Set camera mode ( CAMERA_CUSTOM, CAMERA_FREE, CAMERA_ORBITAL... )
-
-- Failure return false
-- Success return true
-*/
-int lcoreSetCameraMode( lua_State *L ) {
- if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetCameraMode( camera3D camera, int mode )" );
- lua_pushboolean( L, false );
- return 1;
- }
- size_t cameraId = lua_tointeger( L, -2 );
-
- if ( !validCamera3D( cameraId ) ) {
- lua_pushboolean( L, false );
- return 1;
- }
-
- SetCameraMode( *state->camera3Ds[ cameraId ], lua_tointeger( L, -1 ) );
- lua_pushboolean( L, true );
-
- return 1;
-}
-
-/*
> position = RL.GetCamera3DPosition( camera3D camera )
Get camera position
@@ -3097,7 +3069,7 @@ int lcoreGetCamera3DProjection( lua_State *L ) {
}
/*
-> success = RL.UpdateCamera3D( camera3D camera )
+> success = RL.UpdateCamera3D( camera3D camera, int mode )
Update camera position for selected mode
@@ -3105,11 +3077,14 @@ Update camera position for selected mode
- Success return true
*/
int lcoreUpdateCamera3D( lua_State *L ) {
- if ( !lua_isnumber( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.UpdateCamera3D( camera3D camera )" );
+ if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.UpdateCamera3D( camera3D camera, int mode )" );
lua_pushboolean( L, false );
return 1;
}
+
+ int mode = lua_tointeger( L, -1 );
+ lua_pop( L, 1 );
size_t cameraId = lua_tointeger( L, -1 );
if ( !validCamera3D( cameraId ) ) {
@@ -3117,95 +3092,41 @@ int lcoreUpdateCamera3D( lua_State *L ) {
return 1;
}
- UpdateCamera( state->camera3Ds[ cameraId ] );
+ UpdateCamera( state->camera3Ds[ cameraId ], mode );
lua_pushboolean( L, true );
return 1;
}
/*
-> success = RL.SetCameraPanControl( int keyPan )
+> success = RL.UpdateCamera3DPro( camera3D camera, Vector3 movement, Vector3 rotation, float zoom )
-Set camera pan key to combine with mouse movement ( free camera )
+Update camera movement, movement/rotation values should be provided by user
- Failure return false
- Success return true
*/
-int lcoreSetCameraPanControl( lua_State *L ) {
- if ( !lua_isnumber( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetCameraPanControl( int keyPan )" );
+int lcoreUpdateCamera3DPro( lua_State *L ) {
+ if ( !lua_isnumber( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.UpdateCamera3DPro( camera3D camera, Vector3 movement, Vector3 rotation, float zoom )" );
lua_pushboolean( L, false );
return 1;
}
- SetCameraPanControl( lua_tointeger( L, -1 ) );
- lua_pushboolean( L, true );
- return 1;
-}
-
-/*
-> success = RL.SetCameraAltControl( int keyAlt )
-
-Set camera alt key to combine with mouse movement ( free camera )
-
-- Failure return false
-- Success return true
-*/
-int lcoreSetCameraAltControl( lua_State *L ) {
- if ( !lua_isnumber( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetCameraAltControl( int keyAlt )" );
- lua_pushboolean( L, false );
- return 1;
- }
- SetCameraAltControl( lua_tointeger( L, -1 ) );
- lua_pushboolean( L, true );
-
- return 1;
-}
-
-/*
-> success = RL.SetCameraSmoothZoomControl( int keySmoothZoom )
-
-Set camera smooth zoom key to combine with mouse ( free camera )
-
-- Failure return false
-- Success return true
-*/
-int lcoreSetCameraSmoothZoomControl( lua_State *L ) {
- if ( !lua_isnumber( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetCameraSmoothZoomControl( int keySmoothZoom )" );
- lua_pushboolean( L, false );
- return 1;
- }
- SetCameraSmoothZoomControl( lua_tointeger( L, -1 ) );
- lua_pushboolean( L, true );
-
- return 1;
-}
-
-/*
-> success = RL.SetCameraMoveControls( int keyFront, int keyBack, int keyRight, int keyLeft, int keyUp, int keyDown )
-
-Set camera move controls ( 1st person and 3rd person cameras )
+ float zoom = lua_tointeger( L, -1 );
+ lua_pop( L, 1 );
+ Vector3 rotation = uluaGetVector3( L );
+ lua_pop( L, 1 );
+ Vector3 movement = uluaGetVector3( L );
+ lua_pop( L, 1 );
+ size_t cameraId = lua_tointeger( L, -1 );
-- Failure return false
-- Success return true
-*/
-int lcoreSetCameraMoveControls( lua_State *L ) {
- if ( !lua_isnumber( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 )
- || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetCameraMoveControls( int keyFront, int keyBack, int keyRight, int keyLeft, int keyUp, int keyDown )" );
+ if ( !validCamera3D( cameraId ) ) {
lua_pushboolean( L, false );
return 1;
}
- int keyDown = lua_tointeger( L, -1 );
- int keyUp = lua_tointeger( L, -2 );
- int keyLeft = lua_tointeger( L, -3 );
- int keyRight = lua_tointeger( L, -4 );
- int keyBack = lua_tointeger( L, -5 );
- int keyFront = lua_tointeger( L, -6 );
- SetCameraMoveControls( keyFront, keyBack, keyRight, keyLeft, keyUp, keyDown );
+ UpdateCameraPro( state->camera3Ds[ cameraId ], movement, rotation, zoom );
lua_pushboolean( L, true );
return 1;
diff --git a/src/lua_core.c b/src/lua_core.c
index caea688..9197170 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -341,6 +341,7 @@ void defineGlobals() {
assignGlobalInt( BLEND_SUBTRACT_COLORS, "BLEND_SUBTRACT_COLORS" );
assignGlobalInt( BLEND_ALPHA_PREMULTIPLY, "BLEND_ALPHA_PREMULTIPLY" );
assignGlobalInt( BLEND_CUSTOM, "BLEND_CUSTOM" );
+ assignGlobalInt( BLEND_CUSTOM_SEPARATE, "BLEND_CUSTOM_SEPARATE" );
/* Gesture */
assignGlobalInt( GESTURE_NONE, "GESTURE_NONE" );
assignGlobalInt( GESTURE_TAP, "GESTURE_TAP" );
@@ -814,11 +815,12 @@ void luaRegister() {
assingGlobalFunction( "GetCamera3DFovy", lcoreGetCamera3DFovy );
assingGlobalFunction( "GetCamera3DProjection", lcoreGetCamera3DProjection );
assingGlobalFunction( "UpdateCamera3D", lcoreUpdateCamera3D );
- assingGlobalFunction( "SetCameraMode", lcoreSetCameraMode );
- assingGlobalFunction( "SetCameraPanControl", lcoreSetCameraPanControl );
- assingGlobalFunction( "SetCameraAltControl", lcoreSetCameraAltControl );
- assingGlobalFunction( "SetCameraSmoothZoomControl", lcoreSetCameraSmoothZoomControl );
- assingGlobalFunction( "SetCameraMoveControls", lcoreSetCameraMoveControls );
+ assingGlobalFunction( "UpdateCamera3DPro", lcoreUpdateCamera3DPro );
+ // assingGlobalFunction( "SetCameraMode", lcoreSetCameraMode );
+ // assingGlobalFunction( "SetCameraPanControl", lcoreSetCameraPanControl );
+ // assingGlobalFunction( "SetCameraAltControl", lcoreSetCameraAltControl );
+ // assingGlobalFunction( "SetCameraSmoothZoomControl", lcoreSetCameraSmoothZoomControl );
+ // assingGlobalFunction( "SetCameraMoveControls", lcoreSetCameraMoveControls );
/* Input-related Keyboard. */
assingGlobalFunction( "IsKeyPressed", lcoreIsKeyPressed );
assingGlobalFunction( "IsKeyDown", lcoreIsKeyDown );
@@ -987,10 +989,10 @@ void luaRegister() {
/* Texture Drawing. */
assingGlobalFunction( "DrawTexture", ltexturesDrawTexture );
assingGlobalFunction( "DrawTextureRec", ltexturesDrawTextureRec );
- assingGlobalFunction( "DrawTextureTiled", ltexturesDrawTextureTiled );
+ // assingGlobalFunction( "DrawTextureTiled", ltexturesDrawTextureTiled );
assingGlobalFunction( "DrawTexturePro", ltexturesDrawTexturePro );
assingGlobalFunction( "DrawTextureNPatch", ltexturesDrawTextureNPatch );
- assingGlobalFunction( "DrawTexturePoly", ltexturesDrawTexturePoly );
+ // assingGlobalFunction( "DrawTexturePoly", ltexturesDrawTexturePoly );
assingGlobalFunction( "BeginTextureMode", ltexturesBeginTextureMode );
assingGlobalFunction( "EndTextureMode", ltexturesEndTextureMode );
assingGlobalFunction( "SetTextureSource", ltexturesSetTextureSource );
@@ -1023,7 +1025,7 @@ void luaRegister() {
assingGlobalFunction( "DrawTriangle3D", lmodelsDrawTriangle3D );
assingGlobalFunction( "DrawCube", lmodelsDrawCube );
assingGlobalFunction( "DrawCubeWires", lmodelsDrawCubeWires );
- assingGlobalFunction( "DrawCubeTexture", lmodelsDrawCubeTexture );
+ // assingGlobalFunction( "DrawCubeTexture", lmodelsDrawCubeTexture );
assingGlobalFunction( "DrawSphere", lmodelsDrawSphere );
assingGlobalFunction( "DrawSphereEx", lmodelsDrawSphereEx );
assingGlobalFunction( "DrawSphereWires", lmodelsDrawSphereWires );
@@ -1123,9 +1125,9 @@ void luaRegister() {
assingGlobalFunction( "StopSound", laudioStopSound );
assingGlobalFunction( "PauseSound", laudioPauseSound );
assingGlobalFunction( "ResumeSound", laudioResumeSound );
- assingGlobalFunction( "PlaySoundMulti", laudioPlaySoundMulti );
- assingGlobalFunction( "StopSoundMulti", laudioStopSoundMulti );
- assingGlobalFunction( "GetSoundsPlaying", laudioGetSoundsPlaying );
+ // assingGlobalFunction( "PlaySoundMulti", laudioPlaySoundMulti );
+ // assingGlobalFunction( "StopSoundMulti", laudioStopSoundMulti );
+ // assingGlobalFunction( "GetSoundsPlaying", laudioGetSoundsPlaying );
assingGlobalFunction( "IsSoundPlaying", laudioIsSoundPlaying );
assingGlobalFunction( "SetSoundVolume", laudioSetSoundVolume );
assingGlobalFunction( "SetSoundPitch", laudioSetSoundPitch );
@@ -1167,6 +1169,7 @@ void luaRegister() {
assingGlobalFunction( "Vector2Distance", lmathVector2Distance );
assingGlobalFunction( "Vector2DistanceSqr", lmathVector2DistanceSqr );
assingGlobalFunction( "Vector2Angle", lmathVector2Angle );
+ assingGlobalFunction( "Vector2LineAngle", lmathVector2LineAngle );
assingGlobalFunction( "Vector2Scale", lmathVector2Scale );
assingGlobalFunction( "Vector2Multiply", lmathVector2Multiply );
assingGlobalFunction( "Vector2Negate", lmathVector2Negate );
diff --git a/src/models.c b/src/models.c
index cef36dd..313fdb1 100644
--- a/src/models.c
+++ b/src/models.c
@@ -120,6 +120,26 @@ static int newMesh() {
return i;
}
+// Unload model (but not meshes) from memory (RAM and/or VRAM)
+void UnloadModelKeepMeshes( Model model ) {
+ // Unload materials maps
+ // NOTE: As the user could be sharing shaders and textures between models,
+ // we don't unload the material but just free it's maps,
+ // the user is responsible for freeing models shaders and textures
+ for (int i = 0; i < model.materialCount; i++) RL_FREE(model.materials[i].maps);
+
+ // Unload arrays
+ RL_FREE(model.meshes);
+ RL_FREE(model.materials);
+ RL_FREE(model.meshMaterial);
+
+ // Unload animation data
+ RL_FREE(model.bones);
+ RL_FREE(model.bindPose);
+
+ TRACELOG(LOG_INFO, "MODEL: Unloaded model (but not meshes) from RAM and VRAM");
+}
+
/*
## Models - Basic
*/
@@ -292,30 +312,30 @@ Draw cube textured
- Failure return false
- Success return true
*/
-int lmodelsDrawCubeTexture( lua_State *L ) {
- if ( !lua_isnumber( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawCubeTexture( Texture2D texture, Vector3 position, Vector3 size, Color color )" );
- lua_pushboolean( L, false );
- return 1;
- }
- Color color = uluaGetColor( L );
- lua_pop( L, 1 );
- Vector3 size = uluaGetVector3( L );
- lua_pop( L, 1 );
- Vector3 pos = uluaGetVector3( L );
- lua_pop( L, 1 );
- size_t texId = lua_tointeger( L, -1 );
-
- if ( !validSourceTexture( texId ) ) {
- lua_pushboolean( L, false );
- return 1;
- }
-
- DrawCubeTexture( *texturesGetSourceTexture( texId ), pos, size.x, size.y, size.z, color );
- lua_pushboolean( L, true );
-
- return 1;
-}
+// int lmodelsDrawCubeTexture( lua_State *L ) {
+// if ( !lua_isnumber( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
+// TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawCubeTexture( Texture2D texture, Vector3 position, Vector3 size, Color color )" );
+// lua_pushboolean( L, false );
+// return 1;
+// }
+// Color color = uluaGetColor( L );
+// lua_pop( L, 1 );
+// Vector3 size = uluaGetVector3( L );
+// lua_pop( L, 1 );
+// Vector3 pos = uluaGetVector3( L );
+// lua_pop( L, 1 );
+// size_t texId = lua_tointeger( L, -1 );
+
+// if ( !validSourceTexture( texId ) ) {
+// lua_pushboolean( L, false );
+// return 1;
+// }
+
+// DrawCubeTexture( *texturesGetSourceTexture( texId ), pos, size.x, size.y, size.z, color );
+// lua_pushboolean( L, true );
+
+// return 1;
+// }
/*
> success = RL.DrawSphere( Vector3 centerPos, float radius, Color color )
diff --git a/src/rmath.c b/src/rmath.c
index 26054e4..0b4623d 100644
--- a/src/rmath.c
+++ b/src/rmath.c
@@ -412,6 +412,31 @@ int lmathVector2Angle( lua_State *L ) {
}
/*
+> result = RL.Vector2LineAngle( Vector2 start, Vector2 end )
+
+Calculate angle defined by a two vectors line.
+NOTE: Parameters need to be normalized.
+Current implementation should be aligned with glm::angle.
+
+- Failure return false
+- Success return float
+*/
+int lmathVector2LineAngle( lua_State *L ) {
+ if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.Vector2LineAngle( Vector2 start, Vector2 end )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ Vector2 end = uluaGetVector2( L );
+ lua_pop( L, 1 );
+ Vector2 start = uluaGetVector2( L );
+
+ lua_pushnumber( L, Vector2LineAngle( start, end ) );
+
+ return 1;
+}
+
+/*
> result = RL.Vector2Scale( Vector2 v, float scale )
Scale vector ( multiply by value )
diff --git a/src/state.c b/src/state.c
index 650e8b7..e9e12f4 100644
--- a/src/state.c
+++ b/src/state.c
@@ -2,6 +2,7 @@
#include "state.h"
#include "lua_core.h"
#include "textures.h"
+#include "models.h"
State *state;
@@ -167,7 +168,9 @@ void stateFree() {
}
for ( int i = 0; i < state->modelCount; ++i ) {
if ( state->models[i] != NULL ) {
+ //TODO Test if UnloadModel causes segfaults on exit.
UnloadModelKeepMeshes( *state->models[i] );
+ // UnloadModel( *state->models[i] );
free( state->models[i] );
}
}
diff --git a/src/textures.c b/src/textures.c
index 6398971..ab6e53f 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -1997,46 +1997,6 @@ int ltexturesDrawTextureRec( lua_State *L ) {
}
/*
-> success = RL.DrawTextureTiled( Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint )
-
-Draw part of a texture ( defined by a rectangle ) with rotation and scale tiled into dest
-
-- Failure return false
-- Success return true
-*/
-int ltexturesDrawTextureTiled( lua_State *L ) {
- if ( !lua_isnumber( L, -7 ) || !lua_istable( L, -6 ) || !lua_istable( L, -5 ) || !lua_istable( L, -4 )
- || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawTextureTiled( Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint )" );
- lua_pushboolean( L, false );
- return 1;
- }
- Color color = uluaGetColor( L );
- lua_pop( L, 1 );
- float scale = lua_tonumber( L, -1 );
- lua_pop( L, 1 );
- float rot = lua_tonumber( L, -1 );
- lua_pop( L, 1 );
- Vector2 origin = uluaGetVector2( L );
- lua_pop( L, 1 );
- Rectangle dstRect = uluaGetRectangle( L );
- lua_pop( L, 1 );
- Rectangle srcRect = uluaGetRectangle( L );
- lua_pop( L, 1 );
- size_t texId = lua_tointeger( L, -1 );
-
- if ( !validSourceTexture( texId ) ) {
- lua_pushboolean( L, false );
- return 1;
- }
-
- DrawTextureTiled( *texturesGetSourceTexture( texId ), srcRect, dstRect, origin, rot, scale, color );
- lua_pushboolean( L, true );
-
- return 1;
-}
-
-/*
> success = RL.DrawTexturePro( Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint )
Draw a part of a texture defined by a rectangle with "pro" parameters
@@ -2113,64 +2073,6 @@ int ltexturesDrawTextureNPatch( lua_State *L ) {
}
/*
-> success = RL.DrawTexturePoly( Texture2D texture, Vector2 center, Vector2{} points, Vector2{} texcoords, int pointsCount, Color tint )
-
-Draw a textured polygon ( Convex )
-
-- Failure return false
-- Success return true
-*/
-int ltexturesDrawTexturePoly( lua_State *L ) {
- if ( !lua_isnumber( L, -6 ) || !lua_istable( L, -5 ) || !lua_istable( L, -4 )
- || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
- TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawTexturePoly( Texture2D texture, Vector2 center, Vector2 points{}, Vector2 texcoords{}, int pointsCount, Color tint )" );
- lua_pushboolean( L, false );
- return 1;
- }
- Color color = uluaGetColor( L );
- lua_pop( L, 1 );
- int pointsCount = lua_tointeger( L, -1 );
- lua_pop( L, 1 );
- Vector2 texCoords[ pointsCount ];
-
- int t = lua_gettop( L ), i = 0;
- lua_pushnil( L );
-
- while ( lua_next( L, t ) != 0 ) {
- texCoords[i] = uluaGetVector2( L );
- i++;
- lua_pop( L, 1 );
- }
- lua_pop( L, 1 );
-
- Vector2 points[ pointsCount ];
-
- t = lua_gettop( L );
- i = 0;
- lua_pushnil( L );
-
- while ( lua_next( L, t ) != 0 ) {
- points[i] = uluaGetVector2( L );
- i++;
- lua_pop( L, 1 );
- }
- lua_pop( L, 1 );
- Vector2 center = uluaGetVector2( L );
- lua_pop( L, 1 );
- size_t texId = lua_tointeger( L, -1 );
-
- if ( !validSourceTexture( texId ) ) {
- lua_pushboolean( L, false );
- return 1;
- }
-
- DrawTexturePoly( *texturesGetSourceTexture( texId ), center, points, texCoords, pointsCount, color );
- lua_pushboolean( L, true );
-
- return 1;
-}
-
-/*
> success = RL.BeginTextureMode( RenderTexture2D target )
Begin drawing to render texture