summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjussi2024-11-21 00:11:31 +0200
committerjussi2024-11-21 00:11:31 +0200
commit4c0eb17a9c234bfee73af408faa38e38f2e450d9 (patch)
tree4aea4fe804a63ed13a1d092aada0ba5925dcf05f
parent479726a5e468a2f4d0f9337f082889082e535bfb (diff)
downloadreilua-enhanced-4c0eb17a9c234bfee73af408faa38e38f2e450d9.tar.gz
reilua-enhanced-4c0eb17a9c234bfee73af408faa38e38f2e450d9.tar.bz2
reilua-enhanced-4c0eb17a9c234bfee73af408faa38e38f2e450d9.zip
New raylib 5.5 functions.
-rw-r--r--API.md325
-rw-r--r--README.md2
-rw-r--r--ReiLua_API.lua340
-rw-r--r--apiScanner.lua5
-rw-r--r--changelog11
-rw-r--r--devnotes1
-rw-r--r--docgen.lua4
-rw-r--r--include/core.h11
-rw-r--r--include/lua_core.h3
-rw-r--r--include/models.h4
-rw-r--r--include/shapes.h3
-rw-r--r--include/state.h1
-rw-r--r--include/text.h2
-rw-r--r--include/textures.h11
-rw-r--r--src/core.c184
-rw-r--r--src/lua_core.c44
-rw-r--r--src/models.c64
-rw-r--r--src/platforms/core_desktop_glfw.c (renamed from src/platforms/core_desktop.c)0
-rw-r--r--src/shapes.c57
-rw-r--r--src/state.c1
-rw-r--r--src/text.c30
-rw-r--r--src/textures.c199
22 files changed, 1118 insertions, 184 deletions
diff --git a/API.md b/API.md
index c48f8d5..66e0531 100644
--- a/API.md
+++ b/API.md
@@ -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,38 +4672,54 @@ 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{}
+- Success return int
---
-> fileNames = RL.LoadDirectoryFilesEx( string basePath, string|nil filter, bool scanSubdirs )
+> success = RL.ChangeDirectory( string directory )
-Load directory filepaths with extension filtering and recursive directory scan
+Change working directory, return true on success
-- Success return string{}
+- Success return bool
---
-> success = RL.ChangeDirectory( string directory )
+> isFile = RL.IsPathFile( string path )
-Change working directory, return true on success
+Check if a given path is a file or a directory
- Success return bool
---
-> isFile = RL.IsPathFile( string path )
+> isValid = RL.IsFileNameValid( string fileName )
-Check if a given path is a file or a directory
+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,19 +6065,19 @@ Load image from RAW file data
---
-> image = RL.LoadImageSvg( string fileNameOrString, Vector2 size )
+> image, frameCount = RL.LoadImageAnim( string fileName )
-Load image from SVG file data or string with specified size
+Load image sequence from file (frames appended to image.data). All frames are returned in RGBA format
-- Success return Image
+- Failure return nil
+- Success return Image, int
---
-> image, frameCount = RL.LoadImageAnim( string fileName )
+> image, frameCount = RL.LoadImageAnimFromMemory( string fileType, Buffer fileData )
-Load image sequence from file (frames appended to image.data). All frames are returned in RGBA format
+Load image sequence from memory buffer. All frames are returned in RGBA format
-- Failure return nil
- Success return Image, int
---
@@ -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
diff --git a/README.md b/README.md
index 100e370..0a1a8ea 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/ReiLua_API.lua b/ReiLua_API.lua
index 114756b..c7d0c8a 100644
--- a/ReiLua_API.lua
+++ b/ReiLua_API.lua
@@ -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
-
----Get camera transform matrix (view matrix)
----- Success return Matrix
----@param camera any
----@return any matrix
-function RL.GetCameraMatrix( camera ) end
+function RL.GetScreenToWorldRay( mousePosition, camera ) end
----Get camera 2d transform 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.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,19 +2009,11 @@ function RL.GetWorkingDirectory() end
---@return any directory
function RL.GetApplicationDirectory() end
----Load directory filepaths
----- Success return string{}
+---Create directories (including full path requested), returns 0 on success
+---- Success return int
---@param dirPath string
----@return any fileNames
-function RL.LoadDirectoryFiles( dirPath ) end
-
----Load directory filepaths with extension filtering and recursive directory scan
----- Success return string{}
----@param basePath string
----@param filter string|nil
----@param scanSubdirs boolean
----@return any fileNames
-function RL.LoadDirectoryFilesEx( basePath, filter, scanSubdirs ) end
+---@return any success
+function RL.MakeDirectory( dirPath ) end
---Change working directory, return true on success
---- Success return bool
@@ -2024,6 +2027,26 @@ function RL.ChangeDirectory( directory ) end
---@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
+---@return any fileNames
+function RL.LoadDirectoryFiles( dirPath ) end
+
+---Load directory filepaths with extension filtering and recursive directory scan
+---- Success return string{}
+---@param basePath string
+---@param filter string|nil
+---@param scanSubdirs boolean
+---@return any fileNames
+function RL.LoadDirectoryFilesEx( basePath, filter, scanSubdirs ) 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 with rounded edges outline
+---Draw rectangle lines with rounded edges
---@param rec table
---@param roundness number
---@param segments integer
----@param lineThick integer
---@param color table
---@return any RL.DrawRectangleRoundedLines
-function RL.DrawRectangleRoundedLines( rec, roundness, segments, lineThick, color ) end
+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 number
+---@param color table
+---@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
diff --git a/apiScanner.lua b/apiScanner.lua
index ad29d9b..ddc391d 100644
--- a/apiScanner.lua
+++ b/apiScanner.lua
@@ -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 = {
diff --git a/changelog b/changelog
index 6e40772..b19814a 100644
--- a/changelog
+++ b/changelog
@@ -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
diff --git a/devnotes b/devnotes
index a348fff..67d2ad6 100644
--- a/devnotes
+++ b/devnotes
@@ -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().
}
diff --git a/docgen.lua b/docgen.lua
index b68d2e4..780e60c 100644
--- a/docgen.lua
+++ b/docgen.lua
@@ -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",
}
diff --git a/include/core.h b/include/core.h
index 54bd4c6..4dd6dda 100644
--- a/include/core.h
+++ b/include/core.h
@@ -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 );
diff --git a/include/lua_core.h b/include/lua_core.h
index 9deb44f..23213b1 100644
--- a/include/lua_core.h
+++ b/include/lua_core.h
@@ -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 );
diff --git a/include/models.h b/include/models.h
index c95507a..ec794da 100644
--- a/include/models.h
+++ b/include/models.h
@@ -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 );
diff --git a/include/shapes.h b/include/shapes.h
index b997f95..1e5c27a 100644
--- a/include/shapes.h
+++ b/include/shapes.h
@@ -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 );
diff --git a/include/state.h b/include/state.h
index 5fc3015..8dbe4e5 100644
--- a/include/state.h
+++ b/include/state.h
@@ -19,6 +19,7 @@ typedef struct {
Font guiFont;
Material defaultMaterial;
Texture defaultTexture;
+ Texture shapesTexture;
int* RLGLcurrentShaderLocs;
/* Events. */
#ifdef PLATFORM_DESKTOP
diff --git a/include/text.h b/include/text.h
index f95b813..dd8b9c6 100644
--- a/include/text.h
+++ b/include/text.h
@@ -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 );
diff --git a/include/textures.h b/include/textures.h
index 272c569..9f71ba0 100644
--- a/include/textures.h
+++ b/include/textures.h
@@ -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 );
diff --git a/src/core.c b/src/core.c
index 3473251..c3c07c5 100644
--- a/src/core.c
+++ b/src/core.c
@@ -560,6 +560,19 @@ int lcoreGetClipboardText( lua_State* L ) {
}
/*
+> image = RL.GetClipboardImage()
+
+Get clipboard image content
+
+- Success return Image
+*/
+int lcoreGetClipboardImage( lua_State* L ) {
+ uluaPushImage( L, GetClipboardImage() );
+
+ return 1;
+}
+
+/*
> RL.EnableEventWaiting()
Enable waiting for events on EndDrawing(), no automatic event polling
@@ -1783,6 +1796,60 @@ int lcoreGetApplicationDirectory( lua_State* L ) {
}
/*
+> 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 )
Load directory filepaths
@@ -1832,32 +1899,6 @@ int lcoreLoadDirectoryFilesEx( lua_State* L ) {
}
/*
-> 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()
Check if a file has been dropped into window
@@ -1998,6 +2039,81 @@ int lcoreDecodeDataBase64( lua_State* L ) {
}
/*
+> 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
*/
@@ -2491,6 +2607,22 @@ int lcoreSetGamepadMappings( lua_State* L ) {
}
/*
+> 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
*/
diff --git a/src/lua_core.c b/src/lua_core.c
index b7a2197..8a6a8f9 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -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 ) {
diff --git a/src/models.c b/src/models.c
index 1271713..0caae47 100644
--- a/src/models.c
+++ b/src/models.c
@@ -983,6 +983,40 @@ int lmodelsDrawModelWiresEx( lua_State* L ) {
}
/*
+> 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 )
Draw bounding box (wires)
@@ -1287,6 +1321,21 @@ int lmodelsExportMesh( lua_State* L ) {
}
/*
+> 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 )
Compute mesh bounding box limits
@@ -2191,6 +2240,21 @@ int lmodelsUpdateModelAnimation( lua_State* L ) {
}
/*
+> 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 )
Unload animation data
diff --git a/src/platforms/core_desktop.c b/src/platforms/core_desktop_glfw.c
index 8d9f01c..8d9f01c 100644
--- a/src/platforms/core_desktop.c
+++ b/src/platforms/core_desktop_glfw.c
diff --git a/src/shapes.c b/src/shapes.c
index 2efa78a..07f40c3 100644
--- a/src/shapes.c
+++ b/src/shapes.c
@@ -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,12 +19,40 @@ 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 )
Draw a pixel
@@ -875,6 +892,24 @@ int lshapesCheckCollisionCircleRec( lua_State* L ) {
}
/*
+> 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 )
Check if point is inside rectangle
diff --git a/src/state.c b/src/state.c
index 70045de..9f3fb5a 100644
--- a/src/state.c
+++ b/src/state.c
@@ -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();
diff --git a/src/text.c b/src/text.c
index 9b6fe95..2740bed 100644
--- a/src/text.c
+++ b/src/text.c
@@ -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;
+}
diff --git a/src/textures.c b/src/textures.c
index d571a32..eaf2284 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -78,6 +78,24 @@ int ltexturesLoadImageAnim( lua_State* L ) {
}
/*
+> 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 )
Load image from memory buffer, fileType refers to extension: i.e. '.png'
@@ -418,6 +436,22 @@ int ltexturesImageFromImage( lua_State* L ) {
}
/*
+> 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 )
Create an image from text (default font)
@@ -566,6 +600,32 @@ int ltexturesImageBlurGaussian( lua_State* L ) {
}
/*
+> 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 )
Resize image (Bicubic scaling algorithm)
@@ -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
*/
@@ -987,6 +1047,23 @@ int ltexturesImageDrawLine( lua_State* L ) {
}
/*
+> 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 )
Draw circle within an image
@@ -1050,6 +1127,93 @@ int ltexturesImageDrawRectangleLines( lua_State* L ) {
}
/*
+> 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 )
Draw a source image within a destination image (Tint applied to source)
@@ -1856,6 +2020,22 @@ int ltexturesGetRenderTextureDepthTexture( lua_State* L ) {
*/
/*
+> 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 )
Returns color with alpha applied, alpha goes from 0.0f to 1.0f
@@ -2030,6 +2210,23 @@ int ltexturesColorAlphaBlend( lua_State* L ) {
}
/*
+> 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 )
Get Color structure from hexadecimal value