summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio.c38
-rw-r--r--src/core.c122
-rw-r--r--src/lua_core.c23
-rw-r--r--src/models.c43
-rw-r--r--src/text.c75
-rw-r--r--src/textures.c98
6 files changed, 349 insertions, 50 deletions
diff --git a/src/audio.c b/src/audio.c
index 04085b4..53031cd 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -189,6 +189,21 @@ int laudioIsSoundReady( lua_State* L ) {
}
/*
+> RL.UpdateSound( Sound sound, Buffer data, int sampleCount )
+
+Update sound buffer with new data
+*/
+int laudioUpdateSound( lua_State* L ) {
+ Sound* sound = uluaGetSound( L, 1 );
+ Buffer* buffer = uluaGetBuffer( L, 2 );
+ int sampleCount = luaL_checkinteger( L, 3 );
+
+ UpdateSound( *sound, buffer->data, sampleCount );
+
+ return 0;
+}
+
+/*
> RL.UnloadWave( Wave wave )
Unload wave data
@@ -387,6 +402,29 @@ int laudioWaveFormat( lua_State* L ) {
}
/*
+> samples = RL.LoadWaveSamples( Wave wave )
+
+Load samples data from wave as a 32bit float data array
+
+- Success return float{}
+*/
+int laudioLoadWaveSamples( lua_State* L ) {
+ Wave* wave = uluaGetWave( L, 1 );
+
+ float* samples = LoadWaveSamples( *wave );
+
+ lua_createtable( L, wave->frameCount * wave->channels, 0 );
+
+ for ( int i = 0; i < wave->frameCount * wave->channels; ++i ) {
+ lua_pushnumber( L, samples[i] );
+ lua_rawseti( L, -2, i+1 );
+ }
+ UnloadWaveSamples( samples );
+
+ return 1;
+}
+
+/*
> wave = RL.WaveCopy( Wave wave )
Copy a wave to a new wave
diff --git a/src/core.c b/src/core.c
index e9c93ba..58316bf 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1221,6 +1221,32 @@ int lcoreSetTargetFPS( lua_State* L ) {
}
/*
+> delta = RL.GetFrameTime()
+
+Get time in seconds for last frame drawn (Delta time)
+
+- Success return float
+*/
+int lcoreGetFrameTime( lua_State* L ) {
+ lua_pushnumber( L, GetFrameTime() );
+
+ return 1;
+}
+
+/*
+> time = RL.GetTime()
+
+Get elapsed time in seconds since InitWindow()
+
+- Success return float
+*/
+int lcoreGetTime( lua_State* L ) {
+ lua_pushnumber( L, GetTime() );
+
+ return 1;
+}
+
+/*
> FPS = RL.GetFPS()
Get current FPS
@@ -1234,29 +1260,42 @@ int lcoreGetFPS( lua_State* L ) {
}
/*
-> delta = RL.GetFrameTime()
+## Core - Custom frame control functions
+*/
-Get time in seconds for last frame drawn (Delta time)
+/*
+> RL.SwapScreenBuffer()
-- Success return float
+Swap back buffer with front buffer (screen drawing)
*/
-int lcoreGetFrameTime( lua_State* L ) {
- lua_pushnumber( L, GetFrameTime() );
+int lcoreSwapScreenBuffer( lua_State* L ) {
+ SwapScreenBuffer();
- return 1;
+ return 0;
}
/*
-> time = RL.GetTime()
+> RL.PollInputEvents()
-Get elapsed time in seconds since InitWindow()
+Register all input events
+*/
+int lcorePollInputEvents( lua_State* L ) {
+ PollInputEvents();
-- Success return float
+ return 0;
+}
+
+/*
+> RL.WaitTime( number seconds )
+
+Wait for some time (halt program execution)
*/
-int lcoreGetTime( lua_State* L ) {
- lua_pushnumber( L, GetTime() );
+int lcoreWaitTime( lua_State* L ) {
+ double seconds = luaL_checknumber( L, 1 );
- return 1;
+ WaitTime( seconds );
+
+ return 0;
}
/*
@@ -1908,6 +1947,21 @@ int lcoreIsKeyPressed( lua_State* L ) {
}
/*
+> pressed = RL.IsKeyPressedRepeat( int key )
+
+Check if a key has been pressed again (Only PLATFORM_DESKTOP)
+
+- Success return bool
+*/
+int lcoreIsKeyPressedRepeat( lua_State* L ) {
+ int key = luaL_checkinteger( L, 1 );
+
+ lua_pushboolean( L, IsKeyPressedRepeat( key ) );
+
+ return 1;
+}
+
+/*
> pressed = RL.IsKeyDown( int key )
Detect if a key is being pressed
@@ -2074,6 +2128,35 @@ int lcoreIsGamepadButtonReleased( lua_State* L ) {
}
/*
+> notPressed = RL.IsGamepadButtonUp( int gamepad, int button )
+
+Check if a gamepad button is NOT being pressed
+
+- Success return bool
+*/
+int lcoreIsGamepadButtonUp( lua_State* L ) {
+ int gamepad = luaL_checkinteger( L, 1 );
+ int button = luaL_checkinteger( L, 2 );
+
+ lua_pushboolean( L, IsGamepadButtonUp( gamepad, button ) );
+
+ return 1;
+}
+
+/*
+> button = RL.GetGamepadButtonPressed()
+
+Get the last gamepad button pressed
+
+- Success return int
+*/
+int lcoreGetGamepadButtonPressed( lua_State* L ) {
+ lua_pushinteger( L, GetGamepadButtonPressed() );
+
+ return 1;
+}
+
+/*
> count = RL.GetGamepadAxisCount( int gamepad )
Return gamepad axis count for a gamepad
@@ -2251,7 +2334,7 @@ int lcoreSetMouseScale( lua_State* L ) {
/*
> movement = RL.GetMouseWheelMove()
-Returns mouse wheel movement Y
+Get mouse wheel movement for X or Y, whichever is larger
- Success return float
*/
@@ -2262,6 +2345,19 @@ int lcoreGetMouseWheelMove( lua_State* L ) {
}
/*
+> movement = RL.GetMouseWheelMoveV()
+
+Get mouse wheel movement for both X and Y
+
+- Success return Vector2
+*/
+int lcoreGetMouseWheelMoveV( lua_State* L ) {
+ uluaPushVector2( L, GetMouseWheelMoveV() );
+
+ return 1;
+}
+
+/*
> RL.SetMouseCursor( int cursor )
Set mouse cursor
diff --git a/src/lua_core.c b/src/lua_core.c
index 3747791..a6078a9 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -1285,9 +1285,13 @@ void luaRegister() {
assingGlobalFunction( "GetScreenToWorld2D", lcoreGetScreenToWorld2D );
/* Timing-related functions. */
assingGlobalFunction( "SetTargetFPS", lcoreSetTargetFPS );
- assingGlobalFunction( "GetFPS", lcoreGetFPS );
assingGlobalFunction( "GetFrameTime", lcoreGetFrameTime );
assingGlobalFunction( "GetTime", lcoreGetTime );
+ assingGlobalFunction( "GetFPS", lcoreGetFPS );
+ /* Custom frame control functions. */
+ assingGlobalFunction( "SwapScreenBuffer", lcoreSwapScreenBuffer );
+ assingGlobalFunction( "PollInputEvents", lcorePollInputEvents );
+ assingGlobalFunction( "WaitTime", lcoreWaitTime );
/* Random values generation functions. */
assingGlobalFunction( "SetRandomSeed", lcoreSetRandomSeed );
assingGlobalFunction( "GetRandomValue", lcoreGetRandomValue );
@@ -1335,6 +1339,7 @@ void luaRegister() {
assingGlobalFunction( "DecodeDataBase64", lcoreDecodeDataBase64 );
/* Input-related functions: keyboard. */
assingGlobalFunction( "IsKeyPressed", lcoreIsKeyPressed );
+ assingGlobalFunction( "IsKeyPressedRepeat", lcoreIsKeyPressedRepeat );
assingGlobalFunction( "IsKeyDown", lcoreIsKeyDown );
assingGlobalFunction( "IsKeyReleased", lcoreIsKeyReleased );
assingGlobalFunction( "IsKeyUp", lcoreIsKeyUp );
@@ -1347,6 +1352,8 @@ void luaRegister() {
assingGlobalFunction( "IsGamepadButtonPressed", lcoreIsGamepadButtonPressed );
assingGlobalFunction( "IsGamepadButtonDown", lcoreIsGamepadButtonDown );
assingGlobalFunction( "IsGamepadButtonReleased", lcoreIsGamepadButtonReleased );
+ assingGlobalFunction( "IsGamepadButtonUp", lcoreIsGamepadButtonUp );
+ assingGlobalFunction( "GetGamepadButtonPressed", lcoreGetGamepadButtonPressed );
assingGlobalFunction( "GetGamepadAxisCount", lcoreGetGamepadAxisCount );
assingGlobalFunction( "GetGamepadAxisMovement", lcoreGetGamepadAxisMovement );
assingGlobalFunction( "SetGamepadMappings", lcoreSetGamepadMappings );
@@ -1361,6 +1368,7 @@ void luaRegister() {
assingGlobalFunction( "SetMouseOffset", lcoreSetMouseOffset );
assingGlobalFunction( "SetMouseScale", lcoreSetMouseScale );
assingGlobalFunction( "GetMouseWheelMove", lcoreGetMouseWheelMove );
+ assingGlobalFunction( "GetMouseWheelMoveV", lcoreGetMouseWheelMoveV );
assingGlobalFunction( "SetMouseCursor", lcoreSetMouseCursor );
/* Input-related functions: touch */
assingGlobalFunction( "GetTouchPosition", lcoreGetTouchPosition );
@@ -1513,6 +1521,7 @@ void luaRegister() {
assingGlobalFunction( "ImageCopy", ltexturesImageCopy );
assingGlobalFunction( "ImageFromImage", ltexturesImageFromImage );
assingGlobalFunction( "ImageText", ltexturesImageText );
+ assingGlobalFunction( "ImageTextEx", ltexturesImageTextEx );
assingGlobalFunction( "ImageFormat", ltexturesImageFormat );
assingGlobalFunction( "ImageToPOT", ltexturesImageToPOT );
assingGlobalFunction( "ImageCrop", ltexturesImageCrop );
@@ -1555,6 +1564,7 @@ void luaRegister() {
assingGlobalFunction( "ImageDrawRectangle", ltexturesImageDrawRectangle );
assingGlobalFunction( "ImageDrawRectangleLines", ltexturesImageDrawRectangleLines );
assingGlobalFunction( "ImageDraw", ltexturesImageDraw );
+ assingGlobalFunction( "ImageDrawText", ltexturesImageDrawText );
assingGlobalFunction( "ImageDrawTextEx", ltexturesImageDrawTextEx );
/* Texture loading functions. */
assingGlobalFunction( "GetTextureDefault", ltexturesGetTextureDefault );
@@ -1580,6 +1590,7 @@ void luaRegister() {
assingGlobalFunction( "GetTextureFormat", ltexturesGetTextureFormat );
/* Texture drawing functions. */
assingGlobalFunction( "DrawTexture", ltexturesDrawTexture );
+ assingGlobalFunction( "DrawTextureEx", ltexturesDrawTextureEx );
assingGlobalFunction( "DrawTextureRec", ltexturesDrawTextureRec );
assingGlobalFunction( "DrawTexturePro", ltexturesDrawTexturePro );
assingGlobalFunction( "DrawTextureNPatch", ltexturesDrawTextureNPatch );
@@ -1601,7 +1612,6 @@ void luaRegister() {
assingGlobalFunction( "ColorAlpha", ltexturesColorAlpha );
assingGlobalFunction( "ColorAlphaBlend", ltexturesColorAlphaBlend );
assingGlobalFunction( "GetColor", ltexturesGetColor );
- assingGlobalFunction( "GetPixelColor", ltexturesGetPixelColor );
assingGlobalFunction( "GetPixelDataSize", ltexturesGetPixelDataSize );
/* Models. */
@@ -1610,6 +1620,7 @@ void luaRegister() {
assingGlobalFunction( "DrawPoint3D", lmodelsDrawPoint3D );
assingGlobalFunction( "DrawCircle3D", lmodelsDrawCircle3D );
assingGlobalFunction( "DrawTriangle3D", lmodelsDrawTriangle3D );
+ assingGlobalFunction( "DrawTriangleStrip3D", lmodelsDrawTriangleStrip3D );
assingGlobalFunction( "DrawCube", lmodelsDrawCube );
assingGlobalFunction( "DrawCubeWires", lmodelsDrawCubeWires );
assingGlobalFunction( "DrawSphere", lmodelsDrawSphere );
@@ -1668,11 +1679,13 @@ void luaRegister() {
assingGlobalFunction( "GenMeshPlane", lmodelsGenMeshPlane );
assingGlobalFunction( "GenMeshCube", lmodelsGenMeshCube );
assingGlobalFunction( "GenMeshSphere", lmodelsGenMeshSphere );
+ assingGlobalFunction( "GenMeshHemiSphere", lmodelsGenMeshHemiSphere );
assingGlobalFunction( "GenMeshCylinder", lmodelsGenMeshCylinder );
assingGlobalFunction( "GenMeshCone", lmodelsGenMeshCone );
assingGlobalFunction( "GenMeshTorus", lmodelsGenMeshTorus );
assingGlobalFunction( "GenMeshKnot", lmodelsGenMeshKnot );
assingGlobalFunction( "GenMeshHeightmap", lmodelsGenMeshHeightmap );
+ assingGlobalFunction( "GenMeshCubicmap", lmodelsGenMeshCubicmap );
assingGlobalFunction( "GenMeshCustom", lmodelsGenMeshCustom );
/* Material management functions. */
assingGlobalFunction( "LoadMaterials", lmodelsLoadMaterials );
@@ -1740,6 +1753,7 @@ void luaRegister() {
/* Text font info functions. */
assingGlobalFunction( "SetTextLineSpacing", ltextSetTextLineSpacing );
assingGlobalFunction( "MeasureText", ltextMeasureText );
+ assingGlobalFunction( "MeasureTextEx", ltextMeasureTextEx );
assingGlobalFunction( "GetGlyphIndex", ltextGetGlyphIndex );
assingGlobalFunction( "GetGlyphInfo", ltextGetGlyphInfo );
assingGlobalFunction( "GetGlyphInfoByIndex", ltextGetGlyphInfoByIndex );
@@ -1769,9 +1783,12 @@ void luaRegister() {
assingGlobalFunction( "GetCodepointPrevious", ltextGetCodepointPrevious );
assingGlobalFunction( "CodepointToUTF8", ltextCodepointToUTF8 );
/* Text strings management functions (no UTF-8 strings, only byte chars) */
+ assingGlobalFunction( "TextSubtext", ltextTextSubtext );
+ assingGlobalFunction( "TextReplace", ltextTextReplace );
assingGlobalFunction( "TextInsert", ltextTextInsert );
assingGlobalFunction( "TextSplit", ltextTextSplit );
assingGlobalFunction( "TextFindIndex", ltextTextFindIndex );
+ assingGlobalFunction( "TextToPascal", ltextTextToPascal );
/* Audio. */
/* Audio device management functions. */
@@ -1788,6 +1805,7 @@ void luaRegister() {
assingGlobalFunction( "LoadSoundFromWave", laudioLoadSoundFromWave );
assingGlobalFunction( "LoadSoundAlias", laudioLoadSoundAlias );
assingGlobalFunction( "IsSoundReady", laudioIsSoundReady );
+ assingGlobalFunction( "UpdateSound", laudioUpdateSound );
assingGlobalFunction( "UnloadWave", laudioUnloadWave );
assingGlobalFunction( "UnloadSound", laudioUnloadSound );
assingGlobalFunction( "UnloadSoundAlias", laudioUnloadSoundAlias );
@@ -1803,6 +1821,7 @@ void luaRegister() {
assingGlobalFunction( "SetSoundPitch", laudioSetSoundPitch );
assingGlobalFunction( "SetSoundPan", laudioSetSoundPan );
assingGlobalFunction( "WaveFormat", laudioWaveFormat );
+ assingGlobalFunction( "LoadWaveSamples", laudioLoadWaveSamples );
assingGlobalFunction( "WaveCopy", laudioWaveCopy );
assingGlobalFunction( "WaveCrop", laudioWaveCrop );
/* Music management functions. */
diff --git a/src/models.c b/src/models.c
index 2133632..db98b31 100644
--- a/src/models.c
+++ b/src/models.c
@@ -173,6 +173,32 @@ int lmodelsDrawTriangle3D( lua_State* L ) {
}
/*
+> RL.DrawTriangleStrip3D( Vector3{} points, Color color )
+
+Draw a triangle strip defined by points
+*/
+int lmodelsDrawTriangleStrip3D( lua_State* L ) {
+ int pointCount = uluaGetTableLen( L, 1 );
+ Color color = uluaGetColor( L, 2 );
+
+ Vector3 points[ pointCount ];
+
+ int t = 1, i = 0;
+ lua_pushnil( L );
+
+ while ( lua_next( L, t ) != 0 ) {
+ if ( lua_istable( L, -1 ) ) {
+ points[i] = uluaGetVector3( L, lua_gettop( L ) );
+ }
+ i++;
+ lua_pop( L, 1 );
+ }
+ DrawTriangleStrip3D( points, pointCount, color );
+
+ return 0;
+}
+
+/*
> RL.DrawCube( Vector3 position, Vector3 size, Color color )
Draw cube
@@ -1305,6 +1331,23 @@ int lmodelsGenMeshSphere( lua_State* L ) {
}
/*
+> mesh = RL.GenMeshHemiSphere( float radius, int rings, int slices )
+
+Generate half-sphere mesh (no bottom cap)
+
+- Success return Mesh
+*/
+int lmodelsGenMeshHemiSphere( lua_State* L ) {
+ float radius = luaL_checknumber( L, 1 );
+ int rings = luaL_checkinteger( L, 2 );
+ int slices = luaL_checkinteger( L, 3 );
+
+ uluaPushMesh( L, GenMeshHemiSphere( radius, rings, slices ) );
+
+ return 1;
+}
+
+/*
> mesh = RL.GenMeshCylinder( float radius, float height, int slices )
Generate cylinder mesh
diff --git a/src/text.c b/src/text.c
index 43069d1..f4ed7a2 100644
--- a/src/text.c
+++ b/src/text.c
@@ -663,18 +663,35 @@ int ltextSetTextLineSpacing( lua_State* L ) {
}
/*
-> size = RL.MeasureText( Font font, string text, float fontSize, float spacing )
+> width = RL.MeasureText( string text, int fontSize )
+
+Measure string width for default font
+
+- Success return int
+*/
+int ltextMeasureText( lua_State* L ) {
+ const char* text = luaL_checkstring( L, 1 );
+ int fontSize = luaL_checkinteger( L, 2 );
+
+ lua_pushinteger( L, MeasureText( text, fontSize ) );
+
+ return 1;
+}
+
+/*
+> size = RL.MeasureTextEx( Font font, string text, float fontSize, float spacing )
Measure string size for Font
- Success return Vector2
*/
-int ltextMeasureText( lua_State* L ) {
+int ltextMeasureTextEx( lua_State* L ) {
Font* font = uluaGetFont( L, 1 );
+ const char* text = luaL_checkstring( L, 2 );
float fontSize = luaL_checknumber( L, 3 );
float spacing = luaL_checknumber( L, 4 );
- uluaPushVector2( L, MeasureTextEx( *font, luaL_checkstring( L, 2 ), fontSize, spacing ) );
+ uluaPushVector2( L, MeasureTextEx( *font, text, fontSize, spacing ) );
return 1;
}
@@ -1144,6 +1161,43 @@ int ltextCodepointToUTF8( lua_State* L ) {
*/
/*
+> text = RL.TextSubtext( string text, int position, int length )
+
+Get a piece of a text string
+
+- Success return string
+*/
+int ltextTextSubtext( lua_State* L ) {
+ const char* text = luaL_checkstring( L, 1 );
+ int position = luaL_checkinteger( L, 2 );
+ int length = luaL_checkinteger( L, 3 );
+
+ lua_pushstring( L, TextSubtext( text, position, length ) );
+
+ return 1;
+}
+
+/*
+> text = RL.TextReplace( string text, string replace, string by )
+
+Replace text string
+
+- Success return string
+*/
+int ltextTextReplace( lua_State* L ) {
+ char* text = (char*)luaL_checkstring( L, 1 );
+ const char* replace = luaL_checkstring( L, 2 );
+ const char* by = luaL_checkstring( L, 3 );
+
+ char* result = TextReplace( text, replace, by );
+
+ lua_pushstring( L, result );
+ free( result );
+
+ return 1;
+}
+
+/*
> text = RL.TextInsert( string text, string insert, int position )
Insert text in a specific position, moves all text forward
@@ -1213,3 +1267,18 @@ int ltextTextFindIndex( lua_State* L ) {
return 1;
}
+
+/*
+> text = RL.TextToPascal( string text )
+
+Get Pascal case notation version of provided string
+
+- Success return string
+*/
+int ltextTextToPascal( lua_State* L ) {
+ const char* text = luaL_checkstring( L, 1 );
+
+ lua_pushstring( L, TextToPascal( text ) );
+
+ return 1;
+}
diff --git a/src/textures.c b/src/textures.c
index aa9a053..6eff7bb 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -433,19 +433,37 @@ int ltexturesImageFromImage( lua_State* L ) {
}
/*
-> image = RL.ImageText( Font font, string text, float fontSize, float spacing, Color tint )
+> image = RL.ImageText( string text, int fontSize, Color tint )
-Create an image from text (custom sprite font)
+Create an image from text (default font)
- Success return Image
*/
int ltexturesImageText( lua_State* L ) {
+ const char* text = luaL_checkstring( L, 1 );
+ int fontSize = luaL_checkinteger( L, 2 );
+ Color tint = uluaGetColor( L, 3 );
+
+ uluaPushImage( L, ImageText( text, fontSize, tint ) );
+
+ return 1;
+}
+
+/*
+> image = RL.ImageTextEx( Font font, string text, float fontSize, float spacing, Color tint )
+
+Create an image from text (custom sprite font)
+
+- Success return Image
+*/
+int ltexturesImageTextEx( lua_State* L ) {
Font* font = uluaGetFont( L, 1 );
- float fontSize = lua_tonumber( L, 3 );
- float spacing = lua_tonumber( L, 4 );
+ const char* text = luaL_checkstring( L, 2 );
+ float fontSize = luaL_checknumber( L, 3 );
+ float spacing = luaL_checknumber( L, 4 );
Color tint = uluaGetColor( L, 5 );
- uluaPushImage( L, ImageTextEx( *font, luaL_checkstring( L, 2 ), fontSize, spacing, tint ) );
+ uluaPushImage( L, ImageTextEx( *font, text, fontSize, spacing, tint ) );
return 1;
}
@@ -499,7 +517,7 @@ Crop image depending on alpha value
*/
int ltexturesImageAlphaCrop( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
- float threshold = lua_tonumber( L, 2 );
+ float threshold = luaL_checknumber( L, 2 );
ImageAlphaCrop( image, threshold );
@@ -514,7 +532,7 @@ Clear alpha channel to desired color
int ltexturesImageAlphaClear( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
Color color = uluaGetColor( L, 2 );
- float threshold = lua_tonumber( L, 3 );
+ float threshold = luaL_checknumber( L, 3 );
ImageAlphaClear( image, color, threshold );
@@ -1064,6 +1082,23 @@ int ltexturesImageDraw( lua_State* L ) {
}
/*
+> RL.ImageDrawText( Image dst, string text, Vector2 position, float fontSize, Color tint )
+
+Draw text (using default font) within an image (destination)
+*/
+int ltexturesImageDrawText( lua_State* L ) {
+ Image* image = uluaGetImage( L, 1 );
+ const char* text = luaL_checkstring( L, 2 );
+ Vector2 position = uluaGetVector2( L, 3 );
+ float fontSize = luaL_checknumber( L, 4 );
+ Color tint = uluaGetColor( L, 5 );
+
+ ImageDrawText( image, text, position.x, position.y, fontSize, tint );
+
+ return 0;
+}
+
+/*
> RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )
Draw text (Custom sprite font) within an image (Destination)
@@ -1071,12 +1106,13 @@ Draw text (Custom sprite font) within an image (Destination)
int ltexturesImageDrawTextEx( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
Font* font = uluaGetFont( L, 2 );
+ const char* text = luaL_checkstring( L, 3 );
Vector2 position = uluaGetVector2( L, 4 );
float fontSize = luaL_checknumber( L, 5 );
float spacing = luaL_checknumber( L, 6 );
Color tint = uluaGetColor( L, 7 );
- ImageDrawTextEx( image, *font, luaL_checkstring( L, 3 ), position, fontSize, spacing, tint );
+ ImageDrawTextEx( image, *font, text, position, fontSize, spacing, tint );
return 0;
}
@@ -1487,10 +1523,26 @@ Draw a Texture2D
*/
int ltexturesDrawTexture( lua_State* L ) {
Texture* texture = uluaGetTexture( L, 1 );
- Vector2 pos = uluaGetVector2( L, 2 );
+ Vector2 position = uluaGetVector2( L, 2 );
Color color = uluaGetColor( L, 3 );
- DrawTexture( *texture, pos.x, pos.y, color );
+ DrawTexture( *texture, position.x, position.y, color );
+ return 0;
+}
+
+/*
+> RL.DrawTextureEx( Texture texture, Vector2 position, float rotation, float scale, Color tint )
+
+Draw a Texture2D with extended parameters
+*/
+int ltexturesDrawTextureEx( lua_State* L ) {
+ Texture* texture = uluaGetTexture( L, 1 );
+ Vector2 position = uluaGetVector2( L, 2 );
+ float rotation = luaL_checknumber( L, 3 );
+ float scale = luaL_checknumber( L, 4 );
+ Color color = uluaGetColor( L, 5 );
+
+ DrawTextureEx( *texture, position, rotation, scale, color );
return 0;
}
@@ -1502,10 +1554,10 @@ Draw a part of a texture defined by a rectangle
int ltexturesDrawTextureRec( lua_State* L ) {
Texture* texture = uluaGetTexture( L, 1 );
Rectangle srcRect = uluaGetRectangle( L, 2 );
- Vector2 pos = uluaGetVector2( L, 3 );
+ Vector2 position = uluaGetVector2( L, 3 );
Color tint = uluaGetColor( L, 4 );
- DrawTextureRec( *texture, srcRect, pos, tint );
+ DrawTextureRec( *texture, srcRect, position, tint );
return 0;
}
@@ -1519,10 +1571,10 @@ int ltexturesDrawTexturePro( lua_State* L ) {
Rectangle srcRect = uluaGetRectangle( L, 2 );
Rectangle dstRect = uluaGetRectangle( L, 3 );
Vector2 origin = uluaGetVector2( L, 4 );
- float rot = luaL_checknumber( L, 5 );
+ float rotation = luaL_checknumber( L, 5 );
Color color = uluaGetColor( L, 6 );
- DrawTexturePro( *texture, srcRect, dstRect, origin, rot, color );
+ DrawTexturePro( *texture, srcRect, dstRect, origin, rotation, color );
return 0;
}
@@ -2006,24 +2058,6 @@ int ltexturesGetColor( lua_State* L ) {
}
/*
-> color = RL.GetPixelColor( Texture texture, Vector2 position )
-
-Get pixel color from source texture
-
-- Success return Color
-*/
-int ltexturesGetPixelColor( lua_State* L ) {
- Texture* texture = uluaGetTexture( L, 1 );
- Vector2 pos = uluaGetVector2( L, 2 );
- Image srcImage = LoadImageFromTexture( *texture );
-
- uluaPushColor( L, GetImageColor( srcImage, pos.x, pos.y ) );
- UnloadImage( srcImage );
-
- return 1;
-}
-
-/*
> size = RL.GetPixelDataSize( int width, int height, int format )
Get pixel data size in bytes for certain format