New raylib 5.5 functions.

This commit is contained in:
jussi
2024-11-21 00:11:31 +02:00
parent 479726a5e4
commit 4c0eb17a9c
22 changed files with 1121 additions and 187 deletions

331
API.md
View File

@@ -1076,7 +1076,7 @@ Key: Android back button
---
> KEY_MENU = 82
> KEY_MENU = 5
Key: Android menu button
@@ -1910,12 +1910,6 @@ Layout is defined by a 4x3 cross with cubemap faces
---
> CUBEMAP_LAYOUT_PANORAMA = 5
Layout is defined by a panorama image (equirrectangular map)
---
## Defines - Font type, defines generation method
> FONT_DEFAULT = 0
@@ -2782,7 +2776,7 @@ Default projection matrix near cull distance
---
> RL_CULL_DISTANCE_FAR = 1000
> RL_CULL_DISTANCE_FAR = 1000.0
Default projection matrix far cull distance
@@ -4054,6 +4048,14 @@ Get clipboard text content
---
> image = RL.GetClipboardImage()
Get clipboard image content
- Success return Image
---
> RL.EnableEventWaiting()
Enable waiting for events on EndDrawing(), no automatic event polling
@@ -4228,9 +4230,9 @@ NOTE: Set nil if no shader
---
> isReady = RL.IsShaderReady( Shader shader )
> isReady = RL.IsShaderValid( Shader shader )
Check if a shader is ready
Check if a shader is valid (loaded on GPU)
- Success return bool
@@ -4310,27 +4312,19 @@ Unload shader from GPU memory (VRAM)
---
> ray = RL.GetMouseRay( Vector2 mousePosition, Camera3D camera )
> ray = RL.GetScreenToWorldRay( Vector2 mousePosition, Camera3D camera )
Get a ray trace from mouse position
Get a ray trace from screen position (i.e mouse)
- Success return Ray
---
> matrix = RL.GetCameraMatrix( Camera3D camera )
> ray = RL.GetScreenToWorldRayEx( Vector2 mousePosition, Camera3D camera, Vector2 size )
Get camera transform matrix (view matrix)
Get a ray trace from screen position (i.e mouse) in a viewport
- Success return Matrix
---
> matrix = RL.GetCameraMatrix2D( Camera2D camera )
Get camera 2d transform matrix
- Success return Matrix
- Success return Ray
---
@@ -4366,6 +4360,22 @@ Get the world space position for a 2d camera screen space position
---
> matrix = RL.GetCameraMatrix( Camera3D camera )
Get camera transform matrix (view matrix)
- Success return Matrix
---
> matrix = RL.GetCameraMatrix2D( Camera2D camera )
Get camera 2d transform matrix
- Success return Matrix
---
## Core - Timing-related functions
---
@@ -4662,19 +4672,11 @@ Get the directory of the running application (uses static string)
---
> fileNames = RL.LoadDirectoryFiles( string dirPath )
> success = RL.MakeDirectory( string dirPath )
Load directory filepaths
Create directories (including full path requested), returns 0 on success
- Success return string{}
---
> fileNames = RL.LoadDirectoryFilesEx( string basePath, string|nil filter, bool scanSubdirs )
Load directory filepaths with extension filtering and recursive directory scan
- Success return string{}
- Success return int
---
@@ -4694,6 +4696,30 @@ Check if a given path is a file or a directory
---
> isValid = RL.IsFileNameValid( string fileName )
Check if fileName is valid for the platform/OS
- Success return bool
---
> fileNames = RL.LoadDirectoryFiles( string dirPath )
Load directory filepaths
- Success return string{}
---
> fileNames = RL.LoadDirectoryFilesEx( string basePath, string|nil filter, bool scanSubdirs )
Load directory filepaths with extension filtering and recursive directory scan
- Success return string{}
---
> iSFileDropped = RL.IsFileDropped()
Check if a file has been dropped into window
@@ -4754,6 +4780,33 @@ Decode Base64 string data
---
> code = RL.ComputeCRC32( Buffer data )
Compute CRC32 hash code. Note! Buffer should be type BUFFER_UNSIGNED_CHAR
- Failure return false
- Success return int
---
> code = RL.ComputeMD5( Buffer data )
Compute MD5 hash code, returns static int[4] (16 bytes). Note! Buffer should be type BUFFER_UNSIGNED_CHAR
- Failure return false
- Success return int{4}
---
> code = RL.ComputeSHA1( Buffer data )
Compute SHA1 hash code, returns static int[5] (20 bytes). Note! Buffer should be type BUFFER_UNSIGNED_CHAR
- Failure return false
- Success return int{5}
---
## Core - Automation events functionality
---
@@ -5010,6 +5063,12 @@ Set internal gamepad mappings (SDL_GameControllerDB)
---
> RL.SetGamepadVibration( int gamepad, float leftMotor, float rightMotor, float duration )
Set gamepad vibration for both motors (duration in seconds)
---
## Core - Input-related functions: mouse
---
@@ -5588,6 +5647,22 @@ defining a font char white rectangle would allow drawing everything in a single
---
> texture = RL.GetShapesTexture()
Get texture that is used for shapes drawing. Return as lightuserdata
- Success return Texture
---
> source = RL.GetShapesTextureRectangle()
Get texture source rectangle that is used for shapes drawing
- Success return Rectangle
---
> RL.DrawPixel( Vector2 pos, Color color )
Draw a pixel
@@ -5714,7 +5789,13 @@ Draw rectangle with rounded edges
---
> RL.DrawRectangleRoundedLines( Rectangle rec, float roundness, int segments, int lineThick, Color color )
> RL.DrawRectangleRoundedLines( Rectangle rec, float roundness, int segments, Color color )
Draw rectangle lines with rounded edges
---
> RL.DrawRectangleRoundedLinesEx( Rectangle rec, float roundness, int segments, float lineThick, Color color )
Draw rectangle with rounded edges outline
@@ -5898,6 +5979,14 @@ Check collision between circle and rectangle
---
> collision = RL.CheckCollisionCircleLine( Vector2 center, float radius, Vector2 p1, Vector2 p2 )
Check if circle collides with a line created betweeen two points [p1] and [p2]
- Success return bool
---
> collision = RL.CheckCollisionPointRec( Vector2 point, Rectangle rec )
Check if point is inside rectangle
@@ -5976,14 +6065,6 @@ Load image from RAW file data
---
> image = RL.LoadImageSvg( string fileNameOrString, Vector2 size )
Load image from SVG file data or string with specified size
- Success return Image
---
> image, frameCount = RL.LoadImageAnim( string fileName )
Load image sequence from file (frames appended to image.data). All frames are returned in RGBA format
@@ -5993,6 +6074,14 @@ Load image sequence from file (frames appended to image.data). All frames are re
---
> image, frameCount = RL.LoadImageAnimFromMemory( string fileType, Buffer fileData )
Load image sequence from memory buffer. All frames are returned in RGBA format
- Success return Image, int
---
> image, frameCount = RL.LoadImageFromMemory( string fileType, Buffer data )
Load image from memory buffer, fileType refers to extension: i.e. '.png'
@@ -6025,9 +6114,9 @@ Load image from screen buffer and (screenshot)
---
> isReady = RL.IsImageReady( Image image )
> isReady = RL.IsImageValid( Image image )
Check if an image is ready
Check if an image is valid (data and parameters)
- Success return bool
@@ -6159,6 +6248,14 @@ Create an image from another image piece
---
> image = RL.ImageFromChannel( Image image, int selectedChannel )
Create an image from a selected channel of another image (GRAYSCALE)
- Success return Image
---
> image = RL.ImageText( string text, int fontSize, Color tint )
Create an image from text (default font)
@@ -6223,6 +6320,12 @@ Apply Gaussian blur using a box blur approximation
---
> RL.ImageKernelConvolution( Image image, float{} kernel )
Apply custom square convolution kernel to image
---
> RL.ImageResize( Image image, Vector2 size )
Resize image (Bicubic scaling algorithm)
@@ -6403,12 +6506,18 @@ Draw pixel within an image
---
> RL.ImageDrawLine( Image dst, Vector2 a, Vector2 b, Color color )
> RL.ImageDrawLine( Image dst, Vector2 start, Vector2 end, Color color )
Draw line within an image
---
> RL.ImageDrawLineEx( Image dst, Vector2 start, Vector2 end, int thick, Color color )
Draw a line defining thickness within an image
---
> RL.ImageDrawCircle( Image dst, Vector2 center, int radius, Color color )
Draw circle within an image
@@ -6433,6 +6542,36 @@ Draw rectangle lines within an image
---
> RL.ImageDrawTriangle( Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color )
Draw triangle within an image
---
> RL.ImageDrawTriangleEx( Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3 )
Draw triangle with interpolated colors within an image
---
> RL.ImageDrawTriangleLines( Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color )
Draw triangle outline within an image
---
> RL.ImageDrawTriangleFan( Image *dst, Vector2{} points, Color color )
Draw a triangle fan defined by points within an image (first vertex is the center)
---
> RL.ImageDrawTriangleStrip( Image *dst, Vector2{} points, Color color )
Draw a triangle strip defined by points within an image
---
> RL.ImageDraw( Image dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint )
Draw a source image within a destination image (Tint applied to source)
@@ -6512,9 +6651,9 @@ Load RenderTexture from data (framebuffer)
---
> isReady = RL.IsTextureReady( Texture texture )
> isReady = RL.IsTextureValid( Texture texture )
Check if a texture is ready
Check if a texture is valid (loaded in GPU)
- Success return bool
@@ -6526,9 +6665,9 @@ Unload texture from GPU memory (VRAM)
---
> isReady = RL.IsRenderTextureReady( RenderTexture target )
> isReady = RL.IsRenderTextureValid( RenderTexture target )
Check if a render texture is ready
Check if a render texture is valid (loaded in GPU)
- Success return bool
@@ -6680,6 +6819,14 @@ Get depth buffer attachment texture. Returns as lightuserdata
---
> isEqual = RL.ColorIsEqual( Color col1, Color col2 )
Check if two colors are equal
- Success return bool
---
> color = RL.Fade( Color color, float alpha )
Returns color with alpha applied, alpha goes from 0.0f to 1.0f
@@ -6768,6 +6915,14 @@ Returns src alpha-blended into dst color with tint
---
> color = RL.ColorLerp( Color color1, Color color2, float factor )
Get color lerp interpolation between two colors, factor [0.0f..1.0f]
- Success return Color
---
> color = RL.GetColor( int hexValue )
Get Color structure from hexadecimal value
@@ -6846,9 +7001,9 @@ Load font copy as new userdata
---
> isReady = RL.IsFontReady( Font font )
> isReady = RL.IsFontValid( Font font )
Check if a font is ready
Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
- Success return bool
@@ -7236,6 +7391,22 @@ Get Pascal case notation version of provided string
---
> text = RL.TextToSnake( string text )
Get Snake case notation version of provided string
- Success return string
---
> text = RL.TextToCamel( string text )
Get Camel case notation version of provided string
- Success return string
---
## Models - Basic geometric 3D shapes drawing functions
---
@@ -7387,9 +7558,9 @@ Load model from generated mesh (Default material)
---
> isReady = RL.IsModelReady( Model model )
> isReady = RL.IsModelValid( Model model )
Check if a model is ready
Check if a model is valid (loaded in GPU, VAO/VBOs)
- Success return bool
@@ -7553,6 +7724,18 @@ Draw a model wires (with texture if set) with extended parameters
---
> RL.DrawModelPoints( Model model, Vector3 position, float scale, Color tint )
Draw a model as points
---
> RL.DrawModelPointsEx( Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint )
Draw a model as points with extended parameters
---
> RL.DrawBoundingBox( BoundingBox box, Color color )
Draw bounding box (wires)
@@ -7624,6 +7807,14 @@ Export mesh data to file, returns true on success
---
> success = RL.ExportMeshAsCode( Mesh mesh, string fileName )
Export mesh as code file (.h) defining multiple arrays of vertex attributes
- Success return bool
---
> boundingBox = RL.GetMeshBoundingBox( Mesh mesh )
Compute mesh bounding box limits
@@ -7782,9 +7973,9 @@ Load material from table. See material table definition
---
> isReady = RL.IsMaterialReady( Material material )
> isReady = RL.IsMaterialValid( Material material )
Check if a material is ready
Check if a material is valid (shader assigned, map textures loaded in GPU)
- Success return bool
@@ -7885,6 +8076,12 @@ Update model animation pose
---
> RL.UpdateModelAnimationBones( Model model, ModelAnimation animation, int frame )
Update model animation mesh bone matrices (GPU skinning)
---
> RL.UnloadModelAnimation( ModelAnimation animation )
Unload animation data
@@ -8115,9 +8312,9 @@ Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
---
> isReady = RL.IsWaveReady( Wave wave )
> isReady = RL.IsWaveValid( Wave wave )
Checks if wave data is ready
Checks if wave data is valid (data loaded and parameters)
- Success return bool
@@ -8139,9 +8336,9 @@ Create a new sound that shares the same sample data as the source sound, does no
---
> isReady = RL.IsSoundReady( Sound sound )
> isReady = RL.IsSoundValid( Sound sound )
Checks if a sound is ready
Checks if a sound is valid (data loaded and buffers initialized)
- Success return bool
@@ -8289,9 +8486,9 @@ Load music stream from data
---
> isReady = RL.IsMusicReady( Music music )
> isReady = RL.IsMusicValid( Music music )
Checks if a music stream is ready
Checks if a music stream is valid (context and buffers initialized)
- Success return bool
@@ -10564,9 +10761,9 @@ Unload vertex buffer (VBO)
---
> RL.rlSetVertexAttribute( int index, int compSize, int type, bool normalized, int stride, buffer pointer )
> RL.rlSetVertexAttribute( int index, int compSize, int type, bool normalized, int stride, int offset )
Set vertex attribute.
Set vertex attribute data configuration
---
@@ -10626,9 +10823,9 @@ Load depth texture/renderbuffer (to be attached to fbo)
---
> id = RL.rlLoadTextureCubemap( Buffer data, int size, int format )
> id = RL.rlLoadTextureCubemap( Buffer data, int size, int format, int mipmapCount )
Load texture cubemap
Load texture cubemap data
- Success return int
@@ -10690,7 +10887,7 @@ Read screen pixel data (color buffer)
---
> fboId = RL.rlLoadFramebuffer( Vector2 size )
> fboId = RL.rlLoadFramebuffer()
Load an empty framebuffer

View File

@@ -10,7 +10,7 @@ Reilua means fair in finnish.
## Status
ReiLua is WIP and some planned raylib functionality is still missing but it already has over 900. Current Raylib version 5.5.
ReiLua is WIP and some planned raylib functionality is still missing but it already has over 1000 functions. Current Raylib version 5.5.
Included submodules.

View File

@@ -290,7 +290,7 @@ RL.KEY_KP_EQUAL=336
---Key: Android back button
RL.KEY_BACK=4
---Key: Android menu button
RL.KEY_MENU=82
RL.KEY_MENU=5
---Key: Android volume up button
RL.KEY_VOLUME_UP=24
---Key: Android volume down button
@@ -595,8 +595,6 @@ RL.CUBEMAP_LAYOUT_LINE_HORIZONTAL=2
RL.CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR=3
---Layout is defined by a 4x3 cross with cubemap faces
RL.CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE=4
---Layout is defined by a panorama image (equirrectangular map)
RL.CUBEMAP_LAYOUT_PANORAMA=5
-- Defines - Font type, defines generation method
@@ -944,7 +942,7 @@ RL.RL_MAX_SHADER_LOCATIONS=32
---Default projection matrix near cull distance
RL.RL_CULL_DISTANCE_NEAR=0.01
---Default projection matrix far cull distance
RL.RL_CULL_DISTANCE_FAR=1000
RL.RL_CULL_DISTANCE_FAR=1000.0
-- Defines - RLGL Texture parameters
@@ -1526,6 +1524,11 @@ function RL.SetClipboardText( text ) end
---@return any text
function RL.GetClipboardText() end
---Get clipboard image content
---- Success return Image
---@return any image
function RL.GetClipboardImage() end
---Enable waiting for events on EndDrawing(), no automatic event polling
---@return any RL.EnableEventWaiting
function RL.EnableEventWaiting() end
@@ -1651,11 +1654,11 @@ function RL.LoadShader( vsFileName, fsFileName ) end
---@return any shader
function RL.LoadShaderFromMemory( vsCode, fsCode ) end
---Check if a shader is ready
---Check if a shader is valid (loaded on GPU)
---- Success return bool
---@param shader any
---@return any isReady
function RL.IsShaderReady( shader ) end
function RL.IsShaderValid( shader ) end
---Get shader program id
---- Success return int
@@ -1731,24 +1734,20 @@ function RL.UnloadShader( shader ) end
-- Core - Screen-space-related functions
---Get a ray trace from mouse position
---Get a ray trace from screen position (i.e mouse)
---- Success return Ray
---@param mousePosition table
---@param camera any
---@return any ray
function RL.GetMouseRay( mousePosition, camera ) end
function RL.GetScreenToWorldRay( mousePosition, camera ) end
---Get camera transform matrix (view matrix)
---- Success return Matrix
---Get a ray trace from screen position (i.e mouse) in a viewport
---- Success return Ray
---@param mousePosition table
---@param camera any
---@return any matrix
function RL.GetCameraMatrix( camera ) end
---Get camera 2d transform matrix
---- Success return Matrix
---@param camera any
---@return any matrix
function RL.GetCameraMatrix2D( camera ) end
---@param size table
---@return any ray
function RL.GetScreenToWorldRayEx( mousePosition, camera, size ) end
---Get the screen space position for a 3d world space position
---- Success return Vector2
@@ -1779,6 +1778,18 @@ function RL.GetWorldToScreen2D( position, camera ) end
---@return any position
function RL.GetScreenToWorld2D( position, camera ) end
---Get camera transform matrix (view matrix)
---- Success return Matrix
---@param camera any
---@return any matrix
function RL.GetCameraMatrix( camera ) end
---Get camera 2d transform matrix
---- Success return Matrix
---@param camera any
---@return any matrix
function RL.GetCameraMatrix2D( camera ) end
-- Core - Timing-related functions
---Set target FPS (maximum)
@@ -1998,6 +2009,30 @@ function RL.GetWorkingDirectory() end
---@return any directory
function RL.GetApplicationDirectory() end
---Create directories (including full path requested), returns 0 on success
---- Success return int
---@param dirPath string
---@return any success
function RL.MakeDirectory( dirPath ) end
---Change working directory, return true on success
---- Success return bool
---@param directory string
---@return any success
function RL.ChangeDirectory( directory ) end
---Check if a given path is a file or a directory
---- Success return bool
---@param path string
---@return any isFile
function RL.IsPathFile( path ) end
---Check if fileName is valid for the platform/OS
---- Success return bool
---@param fileName string
---@return any isValid
function RL.IsFileNameValid( fileName ) end
---Load directory filepaths
---- Success return string{}
---@param dirPath string
@@ -2012,18 +2047,6 @@ function RL.LoadDirectoryFiles( dirPath ) end
---@return any fileNames
function RL.LoadDirectoryFilesEx( basePath, filter, scanSubdirs ) end
---Change working directory, return true on success
---- Success return bool
---@param directory string
---@return any success
function RL.ChangeDirectory( directory ) end
---Check if a given path is a file or a directory
---- Success return bool
---@param path string
---@return any isFile
function RL.IsPathFile( path ) end
---Check if a file has been dropped into window
---- Success return bool
---@return any iSFileDropped
@@ -2068,6 +2091,27 @@ function RL.EncodeDataBase64( data ) end
---@return any outputSize
function RL.DecodeDataBase64( data ) end
---Compute CRC32 hash code. Note! Buffer should be type BUFFER_UNSIGNED_CHAR
---- Failure return false
---- Success return int
---@param data any
---@return any code
function RL.ComputeCRC32( data ) end
---Compute MD5 hash code, returns static int[4] (16 bytes). Note! Buffer should be type BUFFER_UNSIGNED_CHAR
---- Failure return false
---- Success return int{4}
---@param data any
---@return any code
function RL.ComputeMD5( data ) end
---Compute SHA1 hash code, returns static int[5] (20 bytes). Note! Buffer should be type BUFFER_UNSIGNED_CHAR
---- Failure return false
---- Success return int{5}
---@param data any
---@return any code
function RL.ComputeSHA1( data ) end
-- Core - Automation events functionality
---Load automation events list from file, nil for empty list, capacity = MAX_AUTOMATION_EVENTS
@@ -2262,6 +2306,14 @@ function RL.GetGamepadAxisMovement( gamepad, axis ) end
---@return any result
function RL.SetGamepadMappings( mappings ) end
---Set gamepad vibration for both motors (duration in seconds)
---@param gamepad integer
---@param leftMotor number
---@param rightMotor number
---@param duration number
---@return any RL.SetGamepadVibration
function RL.SetGamepadVibration( gamepad, leftMotor, rightMotor, duration ) end
-- Core - Input-related functions: mouse
---Detect if a mouse button has been pressed once
@@ -2732,6 +2784,16 @@ function RL.ExportBuffer( buffer, path ) end
---@return any RL.SetShapesTexture
function RL.SetShapesTexture( texture, source ) end
---Get texture that is used for shapes drawing. Return as lightuserdata
---- Success return Texture
---@return any texture
function RL.GetShapesTexture() end
---Get texture source rectangle that is used for shapes drawing
---- Success return Rectangle
---@return any source
function RL.GetShapesTextureRectangle() end
---Draw a pixel
---@param pos table
---@param color table
@@ -2898,14 +2960,22 @@ function RL.DrawRectangleLinesEx( rec, lineThick, color ) end
---@return any RL.DrawRectangleRounded
function RL.DrawRectangleRounded( rec, roundness, segments, color ) end
---Draw rectangle lines with rounded edges
---@param rec table
---@param roundness number
---@param segments integer
---@param color table
---@return any RL.DrawRectangleRoundedLines
function RL.DrawRectangleRoundedLines( rec, roundness, segments, color ) end
---Draw rectangle with rounded edges outline
---@param rec table
---@param roundness number
---@param segments integer
---@param lineThick integer
---@param lineThick number
---@param color table
---@return any RL.DrawRectangleRoundedLines
function RL.DrawRectangleRoundedLines( rec, roundness, segments, lineThick, color ) end
---@return any RL.DrawRectangleRoundedLinesEx
function RL.DrawRectangleRoundedLinesEx( rec, roundness, segments, lineThick, color ) end
---Draw a color-filled triangle (Vertex in counter-clockwise order!)
---@param v1 table
@@ -3122,6 +3192,15 @@ function RL.CheckCollisionCircles( center1, radius1, center2, radius2 ) end
---@return any collision
function RL.CheckCollisionCircleRec( center, radius, rec ) end
---Check if circle collides with a line created betweeen two points [p1] and [p2]
---- Success return bool
---@param center table
---@param radius number
---@param p1 table
---@param p2 table
---@return any collision
function RL.CheckCollisionCircleLine( center, radius, p1, p2 ) end
---Check if point is inside rectangle
---- Success return bool
---@param point table
@@ -3198,13 +3277,6 @@ function RL.LoadImage( fileName ) end
---@return any image
function RL.LoadImageRaw( fileName, size, format, headerSize ) end
---Load image from SVG file data or string with specified size
---- Success return Image
---@param fileNameOrString string
---@param size table
---@return any image
function RL.LoadImageSvg( fileNameOrString, size ) end
---Load image sequence from file (frames appended to image.data). All frames are returned in RGBA format
---- Failure return nil
---- Success return Image, int
@@ -3213,6 +3285,14 @@ function RL.LoadImageSvg( fileNameOrString, size ) end
---@return any frameCount
function RL.LoadImageAnim( fileName ) end
---Load image sequence from memory buffer. All frames are returned in RGBA format
---- Success return Image, int
---@param fileType string
---@param fileData any
---@return any image
---@return any frameCount
function RL.LoadImageAnimFromMemory( fileType, fileData ) end
---Load image from memory buffer, fileType refers to extension: i.e. '.png'
---- Success return Image
---@param fileType string
@@ -3242,11 +3322,11 @@ function RL.LoadImageFromTexture( texture ) end
---@return any image
function RL.LoadImageFromScreen() end
---Check if an image is ready
---Check if an image is valid (data and parameters)
---- Success return bool
---@param image any
---@return any isReady
function RL.IsImageReady( image ) end
function RL.IsImageValid( image ) end
---Unload image from CPU memory (RAM)
---@param image any
@@ -3363,6 +3443,13 @@ function RL.ImageCopy( image ) end
---@return any image
function RL.ImageFromImage( image, rec ) end
---Create an image from a selected channel of another image (GRAYSCALE)
---- Success return Image
---@param image any
---@param selectedChannel integer
---@return any image
function RL.ImageFromChannel( image, selectedChannel ) end
---Create an image from text (default font)
---- Success return Image
---@param text string
@@ -3429,6 +3516,12 @@ function RL.ImageAlphaPremultiply( image ) end
---@return any RL.ImageBlurGaussian
function RL.ImageBlurGaussian( image, blurSize ) end
---Apply custom square convolution kernel to image
---@param image any
---@param kernel table
---@return any RL.ImageKernelConvolution
function RL.ImageKernelConvolution( image, kernel ) end
---Resize image (Bicubic scaling algorithm)
---@param image any
---@param size table
@@ -3591,11 +3684,20 @@ function RL.ImageDrawPixel( dst, position, color ) end
---Draw line within an image
---@param dst any
---@param a table
---@param b table
---@param start table
---@param end table
---@param color table
---@return any RL.ImageDrawLine
function RL.ImageDrawLine( dst, a, b, color ) end
function RL.ImageDrawLine( dst, start, end, color ) end
---Draw a line defining thickness within an image
---@param dst any
---@param start table
---@param end table
---@param thick integer
---@param color table
---@return any RL.ImageDrawLineEx
function RL.ImageDrawLineEx( dst, start, end, thick, color ) end
---Draw circle within an image
---@param dst any
@@ -3628,6 +3730,49 @@ function RL.ImageDrawRectangle( dst, rec, color ) end
---@return any RL.ImageDrawRectangleLines
function RL.ImageDrawRectangleLines( dst, rec, thick, color ) end
---Draw triangle within an image
---@param *dst any
---@param v1 table
---@param v2 table
---@param v3 table
---@param color table
---@return any RL.ImageDrawTriangle
function RL.ImageDrawTriangle( *dst, v1, v2, v3, color ) end
---Draw triangle with interpolated colors within an image
---@param *dst any
---@param v1 table
---@param v2 table
---@param v3 table
---@param c1 table
---@param c2 table
---@param c3 table
---@return any RL.ImageDrawTriangleEx
function RL.ImageDrawTriangleEx( *dst, v1, v2, v3, c1, c2, c3 ) end
---Draw triangle outline within an image
---@param *dst any
---@param v1 table
---@param v2 table
---@param v3 table
---@param color table
---@return any RL.ImageDrawTriangleLines
function RL.ImageDrawTriangleLines( *dst, v1, v2, v3, color ) end
---Draw a triangle fan defined by points within an image (first vertex is the center)
---@param *dst any
---@param points table
---@param color table
---@return any RL.ImageDrawTriangleFan
function RL.ImageDrawTriangleFan( *dst, points, color ) end
---Draw a triangle strip defined by points within an image
---@param *dst any
---@param points table
---@param color table
---@return any RL.ImageDrawTriangleStrip
function RL.ImageDrawTriangleStrip( *dst, points, color ) end
---Draw a source image within a destination image (Tint applied to source)
---@param dst any
---@param src any
@@ -3702,22 +3847,22 @@ function RL.LoadRenderTexture( size ) end
---@return any renderTexture
function RL.LoadRenderTextureFromData( renderTextureData ) end
---Check if a texture is ready
---Check if a texture is valid (loaded in GPU)
---- Success return bool
---@param texture any
---@return any isReady
function RL.IsTextureReady( texture ) end
function RL.IsTextureValid( texture ) end
---Unload texture from GPU memory (VRAM)
---@param texture any
---@return any RL.UnloadTexture
function RL.UnloadTexture( texture ) end
---Check if a render texture is ready
---Check if a render texture is valid (loaded in GPU)
---- Success return bool
---@param target any
---@return any isReady
function RL.IsRenderTextureReady( target ) end
function RL.IsRenderTextureValid( target ) end
---Unload render texture from GPU memory (VRAM)
---@param target any
@@ -3860,6 +4005,13 @@ function RL.GetRenderTextureDepthTexture( renderTexture ) end
-- Textures - Color/pixel related functions
---Check if two colors are equal
---- Success return bool
---@param col1 table
---@param col2 table
---@return any isEqual
function RL.ColorIsEqual( col1, col2 ) end
---Returns color with alpha applied, alpha goes from 0.0f to 1.0f
---- Success return Color
---@param color table
@@ -3935,6 +4087,14 @@ function RL.ColorAlpha( color, alpha ) end
---@return any color
function RL.ColorAlphaBlend( dst, src, tint ) end
---Get color lerp interpolation between two colors, factor [0.0f..1.0f]
---- Success return Color
---@param color1 table
---@param color2 table
---@param factor number
---@return any color
function RL.ColorLerp( color1, color2, factor ) end
---Get Color structure from hexadecimal value
---- Success return Color
---@param hexValue integer
@@ -4000,11 +4160,11 @@ function RL.LoadFontFromData( fontData ) end
---@return any font
function RL.FontCopy( font ) end
---Check if a font is ready
---Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
---- Success return bool
---@param font any
---@return any isReady
function RL.IsFontReady( font ) end
function RL.IsFontValid( font ) end
---Load font data for further use. NOTE: fileData type should be unsigned char
---- Success return GlyphInfo{}
@@ -4370,6 +4530,18 @@ function RL.TextFindIndex( text, find ) end
---@return any text
function RL.TextToPascal( text ) end
---Get Snake case notation version of provided string
---- Success return string
---@param text string
---@return any text
function RL.TextToSnake( text ) end
---Get Camel case notation version of provided string
---- Success return string
---@param text string
---@return any text
function RL.TextToCamel( text ) end
-- Models - Basic geometric 3D shapes drawing functions
---Draw a line in 3D world space
@@ -4559,11 +4731,11 @@ function RL.LoadModel( fileName ) end
---@return any model
function RL.LoadModelFromMesh( mesh ) end
---Check if a model is ready
---Check if a model is valid (loaded in GPU, VAO/VBOs)
---- Success return bool
---@param model any
---@return any isReady
function RL.IsModelReady( model ) end
function RL.IsModelValid( model ) end
---Unload model (meshes/materials) from memory (RAM and/or VRAM)
---@param model any
@@ -4719,6 +4891,24 @@ function RL.DrawModelWires( model, position, scale, tint ) end
---@return any RL.DrawModelWiresEx
function RL.DrawModelWiresEx( model, position, rotationAxis, rotationAngle, scale, tint ) end
---Draw a model as points
---@param model any
---@param position table
---@param scale number
---@param tint table
---@return any RL.DrawModelPoints
function RL.DrawModelPoints( model, position, scale, tint ) end
---Draw a model as points with extended parameters
---@param model any
---@param position table
---@param rotationAxis table
---@param rotationAngle number
---@param scale table
---@param tint table
---@return any RL.DrawModelPointsEx
function RL.DrawModelPointsEx( model, position, rotationAxis, rotationAngle, scale, tint ) end
---Draw bounding box (wires)
---@param box any
---@param color table
@@ -4802,6 +4992,13 @@ function RL.SetMeshColor( mesh, color ) end
---@return any success
function RL.ExportMesh( mesh, fileName ) end
---Export mesh as code file (.h) defining multiple arrays of vertex attributes
---- Success return bool
---@param mesh any
---@param fileName string
---@return any success
function RL.ExportMeshAsCode( mesh, fileName ) end
---Compute mesh bounding box limits
---- Success return BoundingBox
---@param mesh any
@@ -4938,11 +5135,11 @@ function RL.LoadMaterialDefault() end
---@return any material
function RL.CreateMaterial( materialData ) end
---Check if a material is ready
---Check if a material is valid (shader assigned, map textures loaded in GPU)
---- Success return bool
---@param material any
---@return any isReady
function RL.IsMaterialReady( material ) end
function RL.IsMaterialValid( material ) end
---Unload material from GPU memory (VRAM). Note! Use freeAll to unload shaders and textures
---@param material any
@@ -5032,6 +5229,13 @@ function RL.LoadModelAnimations( fileName ) end
---@return any RL.UpdateModelAnimation
function RL.UpdateModelAnimation( model, animation, frame ) end
---Update model animation mesh bone matrices (GPU skinning)
---@param model any
---@param animation any
---@param frame integer
---@return any RL.UpdateModelAnimationBones
function RL.UpdateModelAnimationBones( model, animation, frame ) end
---Unload animation data
---@param animation any
---@return any RL.UnloadModelAnimation
@@ -5234,11 +5438,11 @@ function RL.LoadWave( fileName ) end
---@return any wave
function RL.LoadWaveFromMemory( fileType, data ) end
---Checks if wave data is ready
---Checks if wave data is valid (data loaded and parameters)
---- Success return bool
---@param wave any
---@return any isReady
function RL.IsWaveReady( wave ) end
function RL.IsWaveValid( wave ) end
---Load sound from wave data
---- Success return Sound
@@ -5252,11 +5456,11 @@ function RL.LoadSoundFromWave( wave ) end
---@return any sound
function RL.LoadSoundAlias( source ) end
---Checks if a sound is ready
---Checks if a sound is valid (data loaded and buffers initialized)
---- Success return bool
---@param sound any
---@return any isReady
function RL.IsSoundReady( sound ) end
function RL.IsSoundValid( sound ) end
---Update sound buffer with new data
---@param sound any
@@ -5382,11 +5586,11 @@ function RL.LoadMusicStream( fileName ) end
---@return any music
function RL.LoadMusicStreamFromMemory( fileType, data ) end
---Checks if a music stream is ready
---Checks if a music stream is valid (context and buffers initialized)
---- Success return bool
---@param music any
---@return any isReady
function RL.IsMusicReady( music ) end
function RL.IsMusicValid( music ) end
---Unload music stream
---@param music any
@@ -7362,15 +7566,15 @@ function RL.rlUnloadVertexArray( vaoId ) end
---@return any RL.rlUnloadVertexBuffer
function RL.rlUnloadVertexBuffer( vboId ) end
---Set vertex attribute.
---Set vertex attribute data configuration
---@param index integer
---@param compSize integer
---@param type integer
---@param normalized boolean
---@param stride integer
---@param pointer any
---@param offset integer
---@return any RL.rlSetVertexAttribute
function RL.rlSetVertexAttribute( index, compSize, type, normalized, stride, pointer ) end
function RL.rlSetVertexAttribute( index, compSize, type, normalized, stride, offset ) end
---Set vertex attribute divisor
---@param index integer
@@ -7431,13 +7635,14 @@ function RL.rlLoadTexture( data, size, format, mipmapCount ) end
---@return any id
function RL.rlLoadTextureDepth( size, useRenderBuffer ) end
---Load texture cubemap
---Load texture cubemap data
---- Success return int
---@param data any
---@param size integer
---@param format integer
---@param mipmapCount integer
---@return any id
function RL.rlLoadTextureCubemap( data, size, format ) end
function RL.rlLoadTextureCubemap( data, size, format, mipmapCount ) end
---Update GPU texture with new data
---@param id integer
@@ -7493,9 +7698,8 @@ function RL.rlReadScreenPixels( size ) end
---Load an empty framebuffer
---- Success return int
---@param size table
---@return any fboId
function RL.rlLoadFramebuffer( size ) end
function RL.rlLoadFramebuffer() end
---Attach texture/renderbuffer to a framebuffer
---@param fboId integer

View File

@@ -59,6 +59,7 @@ local raylib = {
TextToUpper = "Can be replaced by Lua equivalent",
TextToLower = "Can be replaced by Lua equivalent",
TextToInteger = "Can be replaced by Lua equivalent",
TextToFloat = "Can be replaced by Lua equivalent",
DrawCubeV = "Replaced by DrawCube",
DrawCubeWiresV = "Replaced by DrawCubeWires",
UploadMesh = "Handled internally",
@@ -68,10 +69,6 @@ local raylib = {
SetPixelColor = "Not seen necessary",
},
info = {
GenMeshHemiSphere = "Will be added",
GenMeshCubicmap = "Will be added",
UpdateSound = "Will be added",
LoadWaveSamples = "Will be added",
}
}
local rlgl = {

View File

@@ -7,6 +7,17 @@ KEY CHANGES:
DETAILED CHANGES:
- CHANGE: Is*Ready to Is*Valid functions.
- CHANGE: GetScreenToWorldRay and GetScreenToWorldRayEx.
- ADDED: GetClipboardImage.
- ADDED: MakeDirectory and IsFileNameValid.
- ADDED: ComputeCRC32, ComputeMD5 and ComputeSHA1.
- ADDED: SetGamepadVibration.
- ADDED: GetShapesTexture and GetShapesTextureRectangle.
- ADDED: CheckCollisionCircleLine.
- ADDED: LoadImageAnimFromMemory, ImageFromChannel and ImageKernelConvolution.
- ADDED: ImageDrawLineEx and ImageDrawTriangle* functions.
- ADDED: ColorIsEqual and ColorLerp.
- ADDED: TextToSnake and TextToCamel.
- ADDED: DrawModelPoints, DrawModelPointsEx, ExportMeshAsCode and UpdateModelAnimationBones.
------------------------------------------------------------------------
Release: ReiLua version 0.8.0 Using Raylib 5.0 and Forked Raygui 4.0

View File

@@ -39,7 +39,6 @@ Bugs {
Notes {
* raylib 5.5
* DrawBillboardPro BREAKING CHANGE.
* Some functions for data validation has been renamed from Is**Ready() to Is**Valid().
}

View File

@@ -278,7 +278,7 @@ end
local definesCount = 0
local sourceFiles = {
"lua_core",
"platforms/core_desktop",
"platforms/core_desktop_glfw",
-- "platforms/core_desktop_sdl",
}
@@ -372,7 +372,7 @@ sourceFiles = {
"gl",
"easings",
"bitwiseOp",
"platforms/core_desktop",
"platforms/core_desktop_glfw",
-- "platforms/core_desktop_sdl",
}

View File

@@ -44,6 +44,7 @@ int lcoreGetWindowScaleDPI( lua_State* L );
int lcoreGetMonitorName( lua_State* L );
int lcoreSetClipboardText( lua_State* L );
int lcoreGetClipboardText( lua_State* L );
int lcoreGetClipboardImage( lua_State* L );
int lcoreEnableEventWaiting( lua_State* L );
int lcoreDisableEventWaiting( lua_State* L );
/* Cursor-related functions. */
@@ -135,10 +136,12 @@ int lcoreGetDirectoryPath( lua_State* L );
int lcoreGetPrevDirectoryPath( lua_State* L );
int lcoreGetWorkingDirectory( lua_State* L );
int lcoreGetApplicationDirectory( lua_State* L );
int lcoreLoadDirectoryFiles( lua_State* L );
int lcoreLoadDirectoryFilesEx( lua_State* L );
int lcoreMakeDirectory( lua_State* L );
int lcoreChangeDirectory( lua_State* L );
int lcoreIsPathFile( lua_State* L );
int lcoreIsFileNameValid( lua_State* L );
int lcoreLoadDirectoryFiles( lua_State* L );
int lcoreLoadDirectoryFilesEx( lua_State* L );
int lcoreIsFileDropped( lua_State* L );
int lcoreLoadDroppedFiles( lua_State* L );
int lcoreGetFileModTime( lua_State* L );
@@ -147,6 +150,9 @@ int lcoreCompressData( lua_State* L );
int lcoreDecompressData( lua_State* L );
int lcoreEncodeDataBase64( lua_State* L );
int lcoreDecodeDataBase64( lua_State* L );
int lcoreComputeCRC32( lua_State* L );
int lcoreComputeMD5( lua_State* L );
int lcoreComputeSHA1( lua_State* L );
/* Automation events functionality. */
int lcoreLoadAutomationEventList( lua_State* L );
int lcoreUnloadAutomationEventList( lua_State* L );
@@ -184,6 +190,7 @@ int lcoreGetGamepadButtonPressed( lua_State* L );
int lcoreGetGamepadAxisCount( lua_State* L );
int lcoreGetGamepadAxisMovement( lua_State* L );
int lcoreSetGamepadMappings( lua_State* L );
int lcoreSetGamepadVibration( lua_State* L );
/* Input-related functions: mouse. */
int lcoreIsMouseButtonPressed( lua_State* L );
int lcoreIsMouseButtonDown( lua_State* L );

View File

@@ -47,7 +47,6 @@ Ray uluaGetRay( lua_State* L, int index );
NPatchInfo uluaGetNPatchInfo( lua_State* L, int index );
BoneInfo uluaGetBoneInfo( lua_State* L, int index );
Transform uluaGetTransform( lua_State* L, int index );
// AutomationEvent uluaGetAutomationEvent( lua_State* L, int index );
Buffer* uluaGetBuffer( lua_State* L, int index );
Image* uluaGetImage( lua_State* L, int index );
Texture* uluaGetTexture( lua_State* L, int index );
@@ -68,6 +67,8 @@ ModelAnimation* uluaGetModelAnimation( lua_State* L, int index );
rlRenderBatch* uluaGetRLRenderBatch( lua_State* L, int index );
AutomationEvent* uluaGetAutomationEvent( lua_State* L, int index );
AutomationEventList* uluaGetAutomationEventList( lua_State* L, int index );
void getVector2Array( lua_State* L, int index, Vector2 points[] );
/* Lua push types. */
void uluaPushColor( lua_State* L, Color color );
void uluaPushVector2( lua_State* L, Vector2 vector );

View File

@@ -53,6 +53,8 @@ int lmodelsDrawModel( lua_State* L );
int lmodelsDrawModelEx( lua_State* L );
int lmodelsDrawModelWires( lua_State* L );
int lmodelsDrawModelWiresEx( lua_State* L );
int lmodelsDrawModelPoints( lua_State* L );
int lmodelsDrawModelPointsEx( lua_State* L );
int lmodelsDrawBoundingBox( lua_State* L );
int lmodelsDrawBillboard( lua_State* L );
int lmodelsDrawBillboardRec( lua_State* L );
@@ -64,6 +66,7 @@ int lmodelsDrawMesh( lua_State* L );
int lmodelsDrawMeshInstanced( lua_State* L );
int lmodelsSetMeshColor( lua_State* L );
int lmodelsExportMesh( lua_State* L );
int lmodelsExportMeshAsCode( lua_State* L );
int lmodelsGetMeshBoundingBox( lua_State* L );
int lmodelsGenMeshTangents( lua_State* L );
int lmodelsGetMeshData( lua_State* L );
@@ -100,6 +103,7 @@ int lmodelsGetMaterialParams( lua_State* L );
/* Model animations management functions. */
int lmodelsLoadModelAnimations( lua_State* L );
int lmodelsUpdateModelAnimation( lua_State* L );
int lmodelsUpdateModelAnimationBones( lua_State* L );
int lmodelsUnloadModelAnimation( lua_State* L );
int lmodelsUnloadModelAnimations( lua_State* L );
int lmodelsIsModelAnimationValid( lua_State* L );

View File

@@ -2,6 +2,8 @@
/* Basic shapes drawing functions. */
int lshapesSetShapesTexture( lua_State* L );
int lshapesGetShapesTexture( lua_State* L );
int lshapesGetShapesTextureRectangle( lua_State* L );
int lshapesDrawPixel( lua_State* L );
int lshapesDrawLine( lua_State* L );
int lshapesDrawLineBezier( lua_State* L );
@@ -53,6 +55,7 @@ int lshapesGetSplinePointBezierCubic( lua_State* L );
int lshapesCheckCollisionRecs( lua_State* L );
int lshapesCheckCollisionCircles( lua_State* L );
int lshapesCheckCollisionCircleRec( lua_State* L );
int lshapesCheckCollisionCircleLine( lua_State* L );
int lshapesCheckCollisionPointRec( lua_State* L );
int lshapesCheckCollisionPointCircle( lua_State* L );
int lshapesCheckCollisionPointTriangle( lua_State* L );

View File

@@ -19,6 +19,7 @@ typedef struct {
Font guiFont;
Material defaultMaterial;
Texture defaultTexture;
Texture shapesTexture;
int* RLGLcurrentShaderLocs;
/* Events. */
#ifdef PLATFORM_DESKTOP

View File

@@ -63,3 +63,5 @@ int ltextTextInsert( lua_State* L );
int ltextTextSplit( lua_State* L );
int ltextTextFindIndex( lua_State* L );
int ltextTextToPascal( lua_State* L );
int ltextTextToSnake( lua_State* L );
int ltextTextToCamel( lua_State* L );

View File

@@ -4,6 +4,7 @@
int ltexturesLoadImage( lua_State* L );
int ltexturesLoadImageRaw( lua_State* L );
int ltexturesLoadImageAnim( lua_State* L );
int ltexturesLoadImageAnimFromMemory( lua_State* L );
int ltexturesLoadImageFromMemory( lua_State* L );
int ltexturesLoadImageFromData( lua_State* L );
int ltexturesLoadImageFromTexture( lua_State* L );
@@ -26,6 +27,7 @@ int ltexturesGenImageText( lua_State* L );
/* Image manipulation functions. */
int ltexturesImageCopy( lua_State* L );
int ltexturesImageFromImage( lua_State* L );
int ltexturesImageFromChannel( lua_State* L );
int ltexturesImageText( lua_State* L );
int ltexturesImageTextEx( lua_State* L );
int ltexturesImageFormat( lua_State* L );
@@ -36,6 +38,7 @@ int ltexturesImageAlphaClear( lua_State* L );
int ltexturesImageAlphaMask( lua_State* L );
int ltexturesImageAlphaPremultiply( lua_State* L );
int ltexturesImageBlurGaussian( lua_State* L );
int ltexturesImageKernelConvolution( lua_State* L );
int ltexturesImageResize( lua_State* L );
int ltexturesImageResizeNN( lua_State* L );
int ltexturesImageResizeCanvas( lua_State* L );
@@ -65,10 +68,16 @@ int ltexturesGetImageFormat( lua_State* L );
int ltexturesImageClearBackground( lua_State* L );
int ltexturesImageDrawPixel( lua_State* L );
int ltexturesImageDrawLine( lua_State* L );
int ltexturesImageDrawLineEx( lua_State* L );
int ltexturesImageDrawCircle( lua_State* L );
int ltexturesImageDrawCircleLines( lua_State* L );
int ltexturesImageDrawRectangle( lua_State* L );
int ltexturesImageDrawRectangleLines( lua_State* L );
int ltexturesImageDrawTriangle( lua_State* L );
int ltexturesImageDrawTriangleEx( lua_State* L );
int ltexturesImageDrawTriangleLines( lua_State* L );
int ltexturesImageDrawTriangleFan( lua_State* L );
int ltexturesImageDrawTriangleStrip( lua_State* L );
int ltexturesImageDraw( lua_State* L );
int ltexturesImageDrawText( lua_State* L );
int ltexturesImageDrawTextEx( lua_State* L );
@@ -106,6 +115,7 @@ int ltexturesGetRenderTextureId( lua_State* L );
int ltexturesGetRenderTextureTexture( lua_State* L );
int ltexturesGetRenderTextureDepthTexture( lua_State* L );
/* Color/pixel related functions. */
int ltexturesColorIsEqual( lua_State* L );
int ltexturesFade( lua_State* L );
int ltexturesColorToInt( lua_State* L );
int ltexturesColorNormalize( lua_State* L );
@@ -117,5 +127,6 @@ int ltexturesColorBrightness( lua_State* L );
int ltexturesColorContrast( lua_State* L );
int ltexturesColorAlpha( lua_State* L );
int ltexturesColorAlphaBlend( lua_State* L );
int ltexturesColorLerp( lua_State* L );
int ltexturesGetColor( lua_State* L );
int ltexturesGetPixelDataSize( lua_State* L );

View File

@@ -559,6 +559,19 @@ int lcoreGetClipboardText( lua_State* L ) {
return 1;
}
/*
> image = RL.GetClipboardImage()
Get clipboard image content
- Success return Image
*/
int lcoreGetClipboardImage( lua_State* L ) {
uluaPushImage( L, GetClipboardImage() );
return 1;
}
/*
> RL.EnableEventWaiting()
@@ -1782,6 +1795,60 @@ int lcoreGetApplicationDirectory( lua_State* L ) {
return 1;
}
/*
> success = RL.MakeDirectory( string dirPath )
Create directories (including full path requested), returns 0 on success
- Success return int
*/
int lcoreMakeDirectory( lua_State* L ) {
const char *dirPath = luaL_checkstring( L, 1 );
lua_pushinteger( L, MakeDirectory( dirPath ) );
return 1;
}
/*
> success = RL.ChangeDirectory( string directory )
Change working directory, return true on success
- Success return bool
*/
int lcoreChangeDirectory( lua_State* L ) {
lua_pushboolean( L, ChangeDirectory( luaL_checkstring( L, 1 ) ) );
return 1;
}
/*
> isFile = RL.IsPathFile( string path )
Check if a given path is a file or a directory
- Success return bool
*/
int lcoreIsPathFile( lua_State* L ) {
lua_pushboolean( L, IsPathFile( luaL_checkstring( L, 1 ) ) );
return 1;
}
/*
> isValid = RL.IsFileNameValid( string fileName )
Check if fileName is valid for the platform/OS
- Success return bool
*/
int lcoreIsFileNameValid( lua_State* L ) {
lua_pushboolean( L, IsFileNameValid( luaL_checkstring( L, 1 ) ) );
return 1;
}
/*
> fileNames = RL.LoadDirectoryFiles( string dirPath )
@@ -1831,32 +1898,6 @@ int lcoreLoadDirectoryFilesEx( lua_State* L ) {
return 1;
}
/*
> success = RL.ChangeDirectory( string directory )
Change working directory, return true on success
- Success return bool
*/
int lcoreChangeDirectory( lua_State* L ) {
lua_pushboolean( L, ChangeDirectory( luaL_checkstring( L, 1 ) ) );
return 1;
}
/*
> isFile = RL.IsPathFile( string path )
Check if a given path is a file or a directory
- Success return bool
*/
int lcoreIsPathFile( lua_State* L ) {
lua_pushboolean( L, IsPathFile( luaL_checkstring( L, 1 ) ) );
return 1;
}
/*
> iSFileDropped = RL.IsFileDropped()
@@ -1997,6 +2038,81 @@ int lcoreDecodeDataBase64( lua_State* L ) {
return 2;
}
/*
> code = RL.ComputeCRC32( Buffer data )
Compute CRC32 hash code. Note! Buffer should be type BUFFER_UNSIGNED_CHAR
- Failure return false
- Success return int
*/
int lcoreComputeCRC32( lua_State* L ) {
Buffer* buffer = uluaGetBuffer( L, 1 );
if ( buffer->type == BUFFER_UNSIGNED_CHAR ) {
lua_pushinteger( L, ComputeCRC32( buffer->data, buffer->size ) );
}
else {
lua_pushboolean( L, false );
}
return 1;
}
/*
> code = RL.ComputeMD5( Buffer data )
Compute MD5 hash code, returns static int[4] (16 bytes). Note! Buffer should be type BUFFER_UNSIGNED_CHAR
- Failure return false
- Success return int{4}
*/
int lcoreComputeMD5( lua_State* L ) {
Buffer* buffer = uluaGetBuffer( L, 1 );
if ( buffer->type == BUFFER_UNSIGNED_CHAR ) {
unsigned int* code = ComputeMD5( buffer->data, buffer->size );
lua_createtable( L, 4, 0 );
for ( unsigned int i = 0; i < 4; i++ ) {
lua_pushinteger( L, code[i] );
lua_rawseti( L, -2, i + 1 );
}
}
else {
lua_pushboolean( L, false );
}
return 1;
}
/*
> code = RL.ComputeSHA1( Buffer data )
Compute SHA1 hash code, returns static int[5] (20 bytes). Note! Buffer should be type BUFFER_UNSIGNED_CHAR
- Failure return false
- Success return int{5}
*/
int lcoreComputeSHA1( lua_State* L ) {
Buffer* buffer = uluaGetBuffer( L, 1 );
if ( buffer->type == BUFFER_UNSIGNED_CHAR ) {
unsigned int* code = ComputeSHA1( buffer->data, buffer->size );
lua_createtable( L, 5, 0 );
for ( unsigned int i = 0; i < 5; i++ ) {
lua_pushinteger( L, code[i] );
lua_rawseti( L, -2, i + 1 );
}
}
else {
lua_pushboolean( L, false );
}
return 1;
}
/*
## Core - Automation events functionality
*/
@@ -2490,6 +2606,22 @@ int lcoreSetGamepadMappings( lua_State* L ) {
return 1;
}
/*
> RL.SetGamepadVibration( int gamepad, float leftMotor, float rightMotor, float duration )
Set gamepad vibration for both motors (duration in seconds)
*/
int lcoreSetGamepadVibration( lua_State* L ) {
int gamepad = luaL_checkinteger( L, 1 );
float leftMotor = luaL_checknumber( L, 2 );
float rightMotor = luaL_checknumber( L, 2 );
float duration = luaL_checknumber( L, 2 );
SetGamepadVibration( gamepad, leftMotor, rightMotor, duration );
return 0;
}
/*
## Core - Input-related functions: mouse
*/

View File

@@ -16,7 +16,7 @@
#include "bitwiseOp.h"
#ifdef PLATFORM_DESKTOP
#include "platforms/core_desktop.c"
#include "platforms/core_desktop_glfw.c"
#elif PLATFORM_DESKTOP_SDL
#include "platforms/core_desktop_sdl.c"
#elif PLATFORM_WEB
@@ -1310,6 +1310,7 @@ void luaRegister() {
assingGlobalFunction( "GetMonitorName", lcoreGetMonitorName );
assingGlobalFunction( "SetClipboardText", lcoreSetClipboardText );
assingGlobalFunction( "GetClipboardText", lcoreGetClipboardText );
assingGlobalFunction( "GetClipboardImage", lcoreGetClipboardImage );
assingGlobalFunction( "EnableEventWaiting", lcoreEnableEventWaiting );
assingGlobalFunction( "DisableEventWaiting", lcoreDisableEventWaiting );
/* Cursor-related functions. */
@@ -1401,10 +1402,12 @@ void luaRegister() {
assingGlobalFunction( "GetPrevDirectoryPath", lcoreGetPrevDirectoryPath );
assingGlobalFunction( "GetWorkingDirectory", lcoreGetWorkingDirectory );
assingGlobalFunction( "GetApplicationDirectory", lcoreGetApplicationDirectory );
assingGlobalFunction( "LoadDirectoryFiles", lcoreLoadDirectoryFiles );
assingGlobalFunction( "LoadDirectoryFilesEx", lcoreLoadDirectoryFilesEx );
assingGlobalFunction( "MakeDirectory", lcoreMakeDirectory );
assingGlobalFunction( "ChangeDirectory", lcoreChangeDirectory );
assingGlobalFunction( "IsPathFile", lcoreIsPathFile );
assingGlobalFunction( "IsFileNameValid", lcoreIsFileNameValid );
assingGlobalFunction( "LoadDirectoryFiles", lcoreLoadDirectoryFiles );
assingGlobalFunction( "LoadDirectoryFilesEx", lcoreLoadDirectoryFilesEx );
assingGlobalFunction( "IsFileDropped", lcoreIsFileDropped );
assingGlobalFunction( "LoadDroppedFiles", lcoreLoadDroppedFiles );
assingGlobalFunction( "GetFileModTime", lcoreGetFileModTime );
@@ -1413,6 +1416,9 @@ void luaRegister() {
assingGlobalFunction( "DecompressData", lcoreDecompressData );
assingGlobalFunction( "EncodeDataBase64", lcoreEncodeDataBase64 );
assingGlobalFunction( "DecodeDataBase64", lcoreDecodeDataBase64 );
assingGlobalFunction( "ComputeCRC32", lcoreComputeCRC32 );
assingGlobalFunction( "ComputeMD5", lcoreComputeMD5 );
assingGlobalFunction( "ComputeSHA1", lcoreComputeSHA1 );
/* Automation events functionality. */
assingGlobalFunction( "LoadAutomationEventList", lcoreLoadAutomationEventList );
assingGlobalFunction( "UnloadAutomationEventList", lcoreUnloadAutomationEventList );
@@ -1448,6 +1454,7 @@ void luaRegister() {
assingGlobalFunction( "GetGamepadAxisCount", lcoreGetGamepadAxisCount );
assingGlobalFunction( "GetGamepadAxisMovement", lcoreGetGamepadAxisMovement );
assingGlobalFunction( "SetGamepadMappings", lcoreSetGamepadMappings );
assingGlobalFunction( "SetGamepadVibration", lcoreSetGamepadVibration );
/* Input-related functions: mouse. */
assingGlobalFunction( "IsMouseButtonPressed", lcoreIsMouseButtonPressed );
assingGlobalFunction( "IsMouseButtonDown", lcoreIsMouseButtonDown );
@@ -1531,6 +1538,8 @@ void luaRegister() {
/* Shapes. */
/* Basic shapes drawing functions. */
assingGlobalFunction( "SetShapesTexture", lshapesSetShapesTexture );
assingGlobalFunction( "GetShapesTexture", lshapesGetShapesTexture );
assingGlobalFunction( "GetShapesTextureRectangle", lshapesGetShapesTextureRectangle );
assingGlobalFunction( "DrawPixel", lshapesDrawPixel );
assingGlobalFunction( "DrawLine", lshapesDrawLine );
assingGlobalFunction( "DrawLineBezier", lshapesDrawLineBezier );
@@ -1582,6 +1591,7 @@ void luaRegister() {
assingGlobalFunction( "CheckCollisionRecs", lshapesCheckCollisionRecs );
assingGlobalFunction( "CheckCollisionCircles", lshapesCheckCollisionCircles );
assingGlobalFunction( "CheckCollisionCircleRec", lshapesCheckCollisionCircleRec );
assingGlobalFunction( "CheckCollisionCircleLine", lshapesCheckCollisionCircleLine );
assingGlobalFunction( "CheckCollisionPointRec", lshapesCheckCollisionPointRec );
assingGlobalFunction( "CheckCollisionPointCircle", lshapesCheckCollisionPointCircle );
assingGlobalFunction( "CheckCollisionPointTriangle", lshapesCheckCollisionPointTriangle );
@@ -1595,6 +1605,7 @@ void luaRegister() {
assingGlobalFunction( "LoadImage", ltexturesLoadImage );
assingGlobalFunction( "LoadImageRaw", ltexturesLoadImageRaw );
assingGlobalFunction( "LoadImageAnim", ltexturesLoadImageAnim );
assingGlobalFunction( "LoadImageAnimFromMemory", ltexturesLoadImageAnimFromMemory );
assingGlobalFunction( "LoadImageFromMemory", ltexturesLoadImageFromMemory );
assingGlobalFunction( "LoadImageFromData", ltexturesLoadImageFromData );
assingGlobalFunction( "LoadImageFromTexture", ltexturesLoadImageFromTexture );
@@ -1617,6 +1628,7 @@ void luaRegister() {
/* Image manipulation functions. */
assingGlobalFunction( "ImageCopy", ltexturesImageCopy );
assingGlobalFunction( "ImageFromImage", ltexturesImageFromImage );
assingGlobalFunction( "ImageFromChannel", ltexturesImageFromChannel );
assingGlobalFunction( "ImageText", ltexturesImageText );
assingGlobalFunction( "ImageTextEx", ltexturesImageTextEx );
assingGlobalFunction( "ImageFormat", ltexturesImageFormat );
@@ -1627,6 +1639,7 @@ void luaRegister() {
assingGlobalFunction( "ImageAlphaMask", ltexturesImageAlphaMask );
assingGlobalFunction( "ImageAlphaPremultiply", ltexturesImageAlphaPremultiply );
assingGlobalFunction( "ImageBlurGaussian", ltexturesImageBlurGaussian );
assingGlobalFunction( "ImageKernelConvolution", ltexturesImageKernelConvolution );
assingGlobalFunction( "ImageResize", ltexturesImageResize );
assingGlobalFunction( "ImageResizeNN", ltexturesImageResizeNN );
assingGlobalFunction( "ImageResizeCanvas", ltexturesImageResizeCanvas );
@@ -1656,10 +1669,16 @@ void luaRegister() {
assingGlobalFunction( "ImageClearBackground", ltexturesImageClearBackground );
assingGlobalFunction( "ImageDrawPixel", ltexturesImageDrawPixel );
assingGlobalFunction( "ImageDrawLine", ltexturesImageDrawLine );
assingGlobalFunction( "ImageDrawLineEx", ltexturesImageDrawLineEx );
assingGlobalFunction( "ImageDrawCircle", ltexturesImageDrawCircle );
assingGlobalFunction( "ImageDrawCircleLines", ltexturesImageDrawCircleLines );
assingGlobalFunction( "ImageDrawRectangle", ltexturesImageDrawRectangle );
assingGlobalFunction( "ImageDrawRectangleLines", ltexturesImageDrawRectangleLines );
assingGlobalFunction( "ImageDrawTriangle", ltexturesImageDrawTriangle );
assingGlobalFunction( "ImageDrawTriangleEx", ltexturesImageDrawTriangleEx );
assingGlobalFunction( "ImageDrawTriangleLines", ltexturesImageDrawTriangleLines );
assingGlobalFunction( "ImageDrawTriangleFan", ltexturesImageDrawTriangleFan );
assingGlobalFunction( "ImageDrawTriangleStrip", ltexturesImageDrawTriangleStrip );
assingGlobalFunction( "ImageDraw", ltexturesImageDraw );
assingGlobalFunction( "ImageDrawText", ltexturesImageDrawText );
assingGlobalFunction( "ImageDrawTextEx", ltexturesImageDrawTextEx );
@@ -1697,6 +1716,7 @@ void luaRegister() {
assingGlobalFunction( "GetRenderTextureTexture", ltexturesGetRenderTextureTexture );
assingGlobalFunction( "GetRenderTextureDepthTexture", ltexturesGetRenderTextureDepthTexture );
/* Color/pixel related functions */
assingGlobalFunction( "ColorIsEqual", ltexturesColorIsEqual );
assingGlobalFunction( "Fade", ltexturesFade );
assingGlobalFunction( "ColorToInt", ltexturesColorToInt );
assingGlobalFunction( "ColorNormalize", ltexturesColorNormalize );
@@ -1708,6 +1728,7 @@ void luaRegister() {
assingGlobalFunction( "ColorContrast", ltexturesColorContrast );
assingGlobalFunction( "ColorAlpha", ltexturesColorAlpha );
assingGlobalFunction( "ColorAlphaBlend", ltexturesColorAlphaBlend );
assingGlobalFunction( "ColorLerp", ltexturesColorLerp );
assingGlobalFunction( "GetColor", ltexturesGetColor );
assingGlobalFunction( "GetPixelDataSize", ltexturesGetPixelDataSize );
@@ -1759,6 +1780,8 @@ void luaRegister() {
assingGlobalFunction( "DrawModelEx", lmodelsDrawModelEx );
assingGlobalFunction( "DrawModelWires", lmodelsDrawModelWires );
assingGlobalFunction( "DrawModelWiresEx", lmodelsDrawModelWiresEx );
assingGlobalFunction( "DrawModelPoints", lmodelsDrawModelPoints );
assingGlobalFunction( "DrawModelPointsEx", lmodelsDrawModelPointsEx );
assingGlobalFunction( "DrawBoundingBox", lmodelsDrawBoundingBox );
assingGlobalFunction( "DrawBillboard", lmodelsDrawBillboard );
assingGlobalFunction( "DrawBillboardRec", lmodelsDrawBillboardRec );
@@ -1770,6 +1793,7 @@ void luaRegister() {
assingGlobalFunction( "DrawMeshInstanced", lmodelsDrawMeshInstanced );
assingGlobalFunction( "SetMeshColor", lmodelsSetMeshColor );
assingGlobalFunction( "ExportMesh", lmodelsExportMesh );
assingGlobalFunction( "ExportMeshAsCode", lmodelsExportMeshAsCode );
assingGlobalFunction( "GetMeshBoundingBox", lmodelsGetMeshBoundingBox );
assingGlobalFunction( "GenMeshTangents", lmodelsGenMeshTangents );
assingGlobalFunction( "GetMeshData", lmodelsGetMeshData );
@@ -1806,6 +1830,7 @@ void luaRegister() {
/* Model animations management functions. */
assingGlobalFunction( "LoadModelAnimations", lmodelsLoadModelAnimations );
assingGlobalFunction( "UpdateModelAnimation", lmodelsUpdateModelAnimation );
assingGlobalFunction( "UpdateModelAnimationBones", lmodelsUpdateModelAnimationBones );
assingGlobalFunction( "UnloadModelAnimation", lmodelsUnloadModelAnimation );
assingGlobalFunction( "UnloadModelAnimations", lmodelsUnloadModelAnimations );
assingGlobalFunction( "IsModelAnimationValid", lmodelsIsModelAnimationValid );
@@ -1891,6 +1916,8 @@ void luaRegister() {
assingGlobalFunction( "TextSplit", ltextTextSplit );
assingGlobalFunction( "TextFindIndex", ltextTextFindIndex );
assingGlobalFunction( "TextToPascal", ltextTextToPascal );
assingGlobalFunction( "TextToSnake", ltextTextToSnake );
assingGlobalFunction( "TextToCamel", ltextTextToCamel );
/* Audio. */
/* Audio device management functions. */
@@ -3423,6 +3450,17 @@ AutomationEventList* uluaGetAutomationEventList( lua_State* L, int index ) {
}
}
void getVector2Array( lua_State* L, int index, Vector2 points[] ) {
int t = index, i = 0;
lua_pushnil( L );
while ( lua_next( L, t ) != 0 ) {
points[i] = uluaGetVector2( L, lua_gettop( L ) );
i++;
lua_pop( L, 1 );
}
}
/* Push types. */
void uluaPushColor( lua_State* L, Color color ) {

View File

@@ -982,6 +982,40 @@ int lmodelsDrawModelWiresEx( lua_State* L ) {
return 0;
}
/*
> RL.DrawModelPoints( Model model, Vector3 position, float scale, Color tint )
Draw a model as points
*/
int lmodelsDrawModelPoints( lua_State* L ) {
Model* model = uluaGetModel( L, 1 );
Vector3 position = uluaGetVector3( L, 2 );
float scale = luaL_checknumber( L, 3 );
Color tint = uluaGetColor( L, 4 );
DrawModelPoints( *model, position, scale, tint );
return 0;
}
/*
> RL.DrawModelPointsEx( Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint )
Draw a model as points with extended parameters
*/
int lmodelsDrawModelPointsEx( lua_State* L ) {
Model* model = uluaGetModel( L, 1 );
Vector3 position = uluaGetVector3( L, 2 );
Vector3 rotationAxis = uluaGetVector3( L, 3 );
float rotationAngle = luaL_checknumber( L, 4 );
Vector3 scale = uluaGetVector3( L, 5 );
Color tint = uluaGetColor( L, 6 );
DrawModelPointsEx( *model, position, rotationAxis, rotationAngle, scale, tint );
return 0;
}
/*
> RL.DrawBoundingBox( BoundingBox box, Color color )
@@ -1286,6 +1320,21 @@ int lmodelsExportMesh( lua_State* L ) {
return 1;
}
/*
> success = RL.ExportMeshAsCode( Mesh mesh, string fileName )
Export mesh as code file (.h) defining multiple arrays of vertex attributes
- Success return bool
*/
int lmodelsExportMeshAsCode( lua_State* L ) {
Mesh* mesh = uluaGetMesh( L, 1 );
lua_pushboolean( L, ExportMeshAsCode( *mesh, luaL_checkstring( L, 2 ) ) );
return 1;
}
/*
> boundingBox = RL.GetMeshBoundingBox( Mesh mesh )
@@ -2190,6 +2239,21 @@ int lmodelsUpdateModelAnimation( lua_State* L ) {
return 0;
}
/*
> RL.UpdateModelAnimationBones( Model model, ModelAnimation animation, int frame )
Update model animation mesh bone matrices (GPU skinning)
*/
int lmodelsUpdateModelAnimationBones( lua_State* L ) {
Model* model = uluaGetModel( L, 1 );
ModelAnimation* animation = uluaGetModelAnimation( L, 2 );
int frame = luaL_checkinteger( L, 3 );
UpdateModelAnimationBones( *model, *animation, frame );
return 0;
}
/*
> RL.UnloadModelAnimation( ModelAnimation animation )

View File

@@ -4,17 +4,6 @@
#include "lua_core.h"
#include "textures.h"
static inline void getVector2Array( lua_State* L, int index, Vector2 points[] ) {
int t = index, i = 0;
lua_pushnil( L );
while ( lua_next( L, t ) != 0 ) {
points[i] = uluaGetVector2( L, lua_gettop( L ) );
i++;
lua_pop( L, 1 );
}
}
/*
## Shapes - Basic shapes drawing functions
*/
@@ -30,11 +19,39 @@ int lshapesSetShapesTexture( lua_State* L ) {
Texture* texture = uluaGetTexture( L, 1 );
Rectangle source = uluaGetRectangle( L, 2 );
state->shapesTexture = *texture;
SetShapesTexture( *texture, source );
return 0;
}
/*
> texture = RL.GetShapesTexture()
Get texture that is used for shapes drawing. Return as lightuserdata
- Success return Texture
*/
int lshapesGetShapesTexture( lua_State* L ) {
lua_pushlightuserdata( L, &state->shapesTexture );
return 1;
}
/*
> source = RL.GetShapesTextureRectangle()
Get texture source rectangle that is used for shapes drawing
- Success return Rectangle
*/
int lshapesGetShapesTextureRectangle( lua_State* L ) {
uluaPushRectangle( L, GetShapesTextureRectangle() );
return 1;
}
/*
> RL.DrawPixel( Vector2 pos, Color color )
@@ -874,6 +891,24 @@ int lshapesCheckCollisionCircleRec( lua_State* L ) {
return 1;
}
/*
> collision = RL.CheckCollisionCircleLine( Vector2 center, float radius, Vector2 p1, Vector2 p2 )
Check if circle collides with a line created betweeen two points [p1] and [p2]
- Success return bool
*/
int lshapesCheckCollisionCircleLine( lua_State* L ) {
Vector2 center = uluaGetVector2( L, 1 );
float radius = luaL_checknumber( L, 2 );
Vector2 p1 = uluaGetVector2( L, 3 );
Vector2 p2 = uluaGetVector2( L, 4 );
lua_pushboolean( L, CheckCollisionCircleLine( center, radius, p1, p2 ) );
return 1;
}
/*
> collision = RL.CheckCollisionPointRec( Vector2 point, Rectangle rec )

View File

@@ -35,6 +35,7 @@ bool stateInit( int argn, const char** argc, const char* basePath ) {
state->guiFont = GuiGetFont();
state->defaultMaterial = LoadMaterialDefault();
state->defaultTexture = (Texture){ 1, 1, 1, 1, 7 };
state->shapesTexture = (Texture){ 1, 1, 1, 1, 7 };
state->RLGLcurrentShaderLocs = malloc( RL_MAX_SHADER_LOCATIONS * sizeof( int ) );
int* defaultShaderLocs = rlGetShaderLocsDefault();

View File

@@ -1242,3 +1242,33 @@ int ltextTextToPascal( lua_State* L ) {
return 1;
}
/*
> text = RL.TextToSnake( string text )
Get Snake case notation version of provided string
- Success return string
*/
int ltextTextToSnake( lua_State* L ) {
const char* text = luaL_checkstring( L, 1 );
lua_pushstring( L, TextToSnake( text ) );
return 1;
}
/*
> text = RL.TextToCamel( string text )
Get Camel case notation version of provided string
- Success return string
*/
int ltextTextToCamel( lua_State* L ) {
const char* text = luaL_checkstring( L, 1 );
lua_pushstring( L, TextToCamel( text ) );
return 1;
}

View File

@@ -77,6 +77,24 @@ int ltexturesLoadImageAnim( lua_State* L ) {
return 1;
}
/*
> image, frameCount = RL.LoadImageAnimFromMemory( string fileType, Buffer fileData )
Load image sequence from memory buffer. All frames are returned in RGBA format
- Success return Image, int
*/
int ltexturesLoadImageAnimFromMemory( lua_State* L ) {
const char* fileType = luaL_checkstring( L, 1 );
Buffer* buffer = uluaGetBuffer( L, 2 );
int frameCount = 0;
uluaPushImage( L, LoadImageAnimFromMemory( fileType, buffer->data, buffer->size, &frameCount ) );
lua_pushinteger( L, frameCount );
return 2;
}
/*
> image, frameCount = RL.LoadImageFromMemory( string fileType, Buffer data )
@@ -417,6 +435,22 @@ int ltexturesImageFromImage( lua_State* L ) {
return 1;
}
/*
> image = RL.ImageFromChannel( Image image, int selectedChannel )
Create an image from a selected channel of another image (GRAYSCALE)
- Success return Image
*/
int ltexturesImageFromChannel( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
int selectedChannel = luaL_checkinteger( L, 2 );
uluaPushImage( L, ImageFromChannel( *image, selectedChannel ) );
return 1;
}
/*
> image = RL.ImageText( string text, int fontSize, Color tint )
@@ -565,6 +599,32 @@ int ltexturesImageBlurGaussian( lua_State* L ) {
return 0;
}
/*
> RL.ImageKernelConvolution( Image image, float{} kernel )
Apply custom square convolution kernel to image
*/
int ltexturesImageKernelConvolution( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
int kernelSize = uluaGetTableLen( L, 2 );
float kernel[ kernelSize ];
int t = lua_gettop( L );
int i = 0;
lua_pushnil( L );
while ( lua_next( L, t ) != 0 ) {
kernel[i] = lua_tonumber( L, -1 );
i++;
lua_pop( L, 1 );
}
ImageKernelConvolution( image, kernel, kernelSize );
return 0;
}
/*
> RL.ImageResize( Image image, Vector2 size )
@@ -971,7 +1031,7 @@ int ltexturesImageDrawPixel( lua_State* L ) {
}
/*
> RL.ImageDrawLine( Image dst, Vector2 a, Vector2 b, Color color )
> RL.ImageDrawLine( Image dst, Vector2 start, Vector2 end, Color color )
Draw line within an image
*/
@@ -986,6 +1046,23 @@ int ltexturesImageDrawLine( lua_State* L ) {
return 0;
}
/*
> RL.ImageDrawLineEx( Image dst, Vector2 start, Vector2 end, int thick, Color color )
Draw a line defining thickness within an image
*/
int ltexturesImageDrawLineEx( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
Vector2 start = uluaGetVector2( L, 2 );
Vector2 end = uluaGetVector2( L, 3 );
int thick = luaL_checkinteger( L, 4 );
Color color = uluaGetColor( L, 5 );
ImageDrawLineEx( image, start, end, thick, color );
return 0;
}
/*
> RL.ImageDrawCircle( Image dst, Vector2 center, int radius, Color color )
@@ -1049,6 +1126,93 @@ int ltexturesImageDrawRectangleLines( lua_State* L ) {
return 0;
}
/*
> RL.ImageDrawTriangle( Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color )
Draw triangle within an image
*/
int ltexturesImageDrawTriangle( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
Vector2 v1 = uluaGetVector2( L, 2 );
Vector2 v2 = uluaGetVector2( L, 3 );
Vector2 v3 = uluaGetVector2( L, 4 );
Color color = uluaGetColor( L, 5 );
ImageDrawTriangle( image, v1, v2, v3, color );
return 0;
}
/*
> RL.ImageDrawTriangleEx( Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3 )
Draw triangle with interpolated colors within an image
*/
int ltexturesImageDrawTriangleEx( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
Vector2 v1 = uluaGetVector2( L, 2 );
Vector2 v2 = uluaGetVector2( L, 3 );
Vector2 v3 = uluaGetVector2( L, 4 );
Color c1 = uluaGetColor( L, 5 );
Color c2 = uluaGetColor( L, 6 );
Color c3 = uluaGetColor( L, 7 );
ImageDrawTriangleEx( image, v1, v2, v3, c1, c2, c3 );
return 0;
}
/*
> RL.ImageDrawTriangleLines( Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color )
Draw triangle outline within an image
*/
int ltexturesImageDrawTriangleLines( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
Vector2 v1 = uluaGetVector2( L, 2 );
Vector2 v2 = uluaGetVector2( L, 3 );
Vector2 v3 = uluaGetVector2( L, 4 );
Color color = uluaGetColor( L, 5 );
ImageDrawTriangleLines( image, v1, v2, v3, color );
return 0;
}
/*
> RL.ImageDrawTriangleFan( Image *dst, Vector2{} points, Color color )
Draw a triangle fan defined by points within an image (first vertex is the center)
*/
int ltexturesImageDrawTriangleFan( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
int pointCount = uluaGetTableLen( L, 2 );
Vector2 points[ pointCount ];
getVector2Array( L, 2, points );
Color color = uluaGetColor( L, 3 );
ImageDrawTriangleFan( image, points, pointCount, color );
return 0;
}
/*
> RL.ImageDrawTriangleStrip( Image *dst, Vector2{} points, Color color )
Draw a triangle strip defined by points within an image
*/
int ltexturesImageDrawTriangleStrip( lua_State* L ) {
Image* image = uluaGetImage( L, 1 );
int pointCount = uluaGetTableLen( L, 2 );
Vector2 points[ pointCount ];
getVector2Array( L, 2, points );
Color color = uluaGetColor( L, 3 );
ImageDrawTriangleStrip( image, points, pointCount, color );
return 0;
}
/*
> RL.ImageDraw( Image dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint )
@@ -1855,6 +2019,22 @@ int ltexturesGetRenderTextureDepthTexture( lua_State* L ) {
## Textures - Color/pixel related functions
*/
/*
> isEqual = RL.ColorIsEqual( Color col1, Color col2 )
Check if two colors are equal
- Success return bool
*/
int ltexturesColorIsEqual( lua_State* L ) {
Color col1 = uluaGetColor( L, 1 );
Color col2 = uluaGetColor( L, 2 );
lua_pushboolean( L, ColorIsEqual( col1, col2 ) );
return 1;
}
/*
> color = RL.Fade( Color color, float alpha )
@@ -2029,6 +2209,23 @@ int ltexturesColorAlphaBlend( lua_State* L ) {
return 1;
}
/*
> color = RL.ColorLerp( Color color1, Color color2, float factor )
Get color lerp interpolation between two colors, factor [0.0f..1.0f]
- Success return Color
*/
int ltexturesColorLerp( lua_State* L ) {
Color color1 = uluaGetColor( L, 1 );
Color color2 = uluaGetColor( L, 2 );
float factor = luaL_checknumber( L, 3 );
uluaPushColor( L, ColorLerp( color1, color2, factor ) );
return 1;
}
/*
> color = RL.GetColor( int hexValue )