diff options
| -rw-r--r-- | API.md | 932 | ||||
| -rw-r--r-- | ReiLua_API.lua | 1005 | ||||
| -rw-r--r-- | devnotes | 8 | ||||
| -rw-r--r-- | src/core.c | 900 |
4 files changed, 817 insertions, 2028 deletions
@@ -684,12 +684,6 @@ NPATCH_THREE_PATCH_VERTICAL = 1 NPATCH_THREE_PATCH_HORIZONTAL = 2 -## Globals - TextureTypes -TEXTURE_TYPE_TEXTURE = 0 - -TEXTURE_TYPE_RENDER_TEXTURE = 1 - - ## Globals - Colors LIGHTGRAY = { 200, 200, 200, 255 } @@ -1487,7 +1481,7 @@ Check if window is currently fullscreen > state = RL.IsWindowHidden() -Check if window is currently hidden ( only PLATFORM_DESKTOP ) +Check if window is currently hidden (only PLATFORM_DESKTOP) - Success return bool @@ -1495,7 +1489,7 @@ Check if window is currently hidden ( only PLATFORM_DESKTOP ) > state = RL.IsWindowMinimized() -Check if window is currently minimized ( only PLATFORM_DESKTOP ) +Check if window is currently minimized (only PLATFORM_DESKTOP) - Success return bool @@ -1503,7 +1497,7 @@ Check if window is currently minimized ( only PLATFORM_DESKTOP ) > state = RL.IsWindowMaximized() -Check if window is currently maximized ( only PLATFORM_DESKTOP ) +Check if window is currently maximized (only PLATFORM_DESKTOP) - Success return bool @@ -1511,45 +1505,33 @@ Check if window is currently maximized ( only PLATFORM_DESKTOP ) > state = RL.IsWindowFocused() -Check if window is currently focused ( only PLATFORM_DESKTOP ) +Check if window is currently focused (only PLATFORM_DESKTOP) - Success return bool --- -> success = RL.SetWindowMonitor( int monitor ) +> RL.SetWindowMonitor( int monitor ) Set monitor for the current window (fullscreen mode) -- Failure return false -- Success return true - --- -> success = RL.SetWindowPosition( Vector2 pos ) +> RL.SetWindowPosition( Vector2 pos ) Set window position on screen -- Failure return false -- Success return true - --- -> success = RL.SetWindowSize( Vector2 size ) +> RL.SetWindowSize( Vector2 size ) Set window dimensions -- Failure return false -- Success return true - --- -> success = RL.SetWindowMinSize( Vector2 size ) - -Set window minimum dimensions ( for FLAG_WINDOW_RESIZABLE ) +> RL.SetWindowMinSize( Vector2 size ) -- Failure return false -- Success return true +Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) --- @@ -1557,7 +1539,6 @@ Set window minimum dimensions ( for FLAG_WINDOW_RESIZABLE ) Get specified monitor position -- Failure return nil - Success return Vector2 --- @@ -1566,7 +1547,6 @@ Get specified monitor position Get specified monitor size -- Failure return nil - Success return Vector2 --- @@ -1587,27 +1567,23 @@ Get screen size --- -> success = RL.SetWindowState( int flag ) +> RL.SetWindowState( int flag ) -Set window configuration state using flags ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... ) - -- Failure return false -- Success return true +Set window configuration state using flags (FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE...) --- > state = RL.IsWindowState( int flag ) -Check if one specific window flag is enabled ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... ) +Check if one specific window flag is enabled (FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE...) -- Failure return nil - Success return bool --- > resized = RL.ClearWindowState( int flag ) -Clear window configuration state flags ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... ) +Clear window configuration state flags (FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE...) - Success return bool @@ -1621,21 +1597,15 @@ Check if window has been resized from last frame --- -> success = RL.SetWindowIcon( Image image ) +> RL.SetWindowIcon( Image image ) -Set icon for window ( Only PLATFORM_DESKTOP ) - -- Failure return false -- Success return true +Set icon for window (Only PLATFORM_DESKTOP) --- -> success = RL.SetWindowTitle( string title ) - -Set title for window ( Only PLATFORM_DESKTOP ) +> RL.SetWindowTitle( string title ) -- Failure return false -- Success return true +Set title for window (Only PLATFORM_DESKTOP) --- @@ -1659,21 +1629,19 @@ Get current connected monitor Get specified monitor physical size in millimetres -- Failure return false - Success return Vector2 --- -> size = RL.GetMonitorRefreshRate( int monitor ) +> refreshRate = RL.GetMonitorRefreshRate( int monitor ) Get specified monitor refresh rate -- Failure return false - Success return int --- -> scale = RL.GetWindowScaleDPI() +> dpi = RL.GetWindowScaleDPI() Get window scale DPI factor @@ -1685,7 +1653,6 @@ Get window scale DPI factor Get the human-readable, UTF-8 encoded name of the monitor -- Failure return false - Success return string --- @@ -1696,13 +1663,10 @@ Close window and unload OpenGL context and free all resources --- -> success = RL.SetClipboardText( string text ) +> RL.SetClipboardText( string text ) Set clipboard text content -- Failure return false -- Success return true - --- > text = RL.GetClipboardText() @@ -1717,12 +1681,9 @@ Get clipboard text content --- -> success = RL.SetTargetFPS( int fps ) +> RL.SetTargetFPS( int fps ) -Set target FPS ( maximum ) - -- Failure return false -- Success return true +Set target FPS (maximum) --- @@ -1736,7 +1697,7 @@ Get current FPS > delta = RL.GetFrameTime() -Get time in seconds for last frame drawn ( Delta time ) +Get time in seconds for last frame drawn (Delta time) - Success return float @@ -1754,49 +1715,34 @@ Get elapsed time in seconds since InitWindow() --- -> success = RL.TakeScreenshot( string fileName ) - -Takes a screenshot of current screen ( filename extension defines format ) +> RL.TakeScreenshot( string fileName ) -- Failure return false -- Success return true +Takes a screenshot of current screen (filename extension defines format) --- -> success = RL.SetConfigFlags( int flags ) +> RL.SetConfigFlags( int flags ) -Setup init configuration flags ( view FLAGS ) - -- Failure return false -- Success return true +Setup init configuration flags (view FLAGS) --- -> success = RL.TraceLog( int logLevel, string text ) - -Show trace log messages ( LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR... ) +> RL.TraceLog( int logLevel, string text ) -- Failure return false -- Success return true +Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) --- -> success = RL.SetTraceLogLevel( int logLevel ) +> RL.SetTraceLogLevel( int logLevel ) -Set the current threshold ( minimum ) log level - -- Failure return false -- Success return true +Set the current threshold (minimum) log level --- -> success = RL.SetLogLevelInvalid( int logLevel ) +> RL.SetLogLevelInvalid( int logLevel ) Set the log level for bad function calls and invalid data formats. -- Failure return false -- Success return true - --- > logLevel = RL.GetLogLevelInvalid() @@ -1807,12 +1753,17 @@ Get the log level for bad function calls and invalid data formats. --- -> success = RL.OpenURL( string url ) +> RL.OpenURL( string url ) -Open URL with default system browser ( If available ) +Open URL with default system browser (If available) -- Failure return false -- Success return true +--- + +> buffer = RL.LoadBuffer( data{} buffer, int type ) + +Creates buffer as userdata. Type should be one of the Buffer types + +- Success return Buffer --- @@ -1864,48 +1815,39 @@ Check if cursor is on the screen --- -> success = RL.ClearBackground( Color color ) - -Set background color ( framebuffer clear color ) +> RL.ClearBackground( Color color ) -- Failure return false -- Success return true +Set background color (framebuffer clear color) --- > RL.BeginDrawing() -Setup canvas ( framebuffer ) to start drawing +Setup canvas (framebuffer) to start drawing --- > RL.EndDrawing() -End canvas drawing and swap buffers ( double buffering ) +End canvas drawing and swap buffers (double buffering) --- -> success = RL.BeginBlendMode( int mode ) +> RL.BeginBlendMode( int mode ) -Begin blending mode ( BLEND_ALPHA, BLEND_ADDITIVE, BLEND_MULTIPLIED... ) - -- Failure return false -- Success return true +Begin blending mode (BLEND_ALPHA, BLEND_ADDITIVE, BLEND_MULTIPLIED...) --- > RL.EndBlendMode() -End blending mode ( reset to default: BLEND_ALPHA ) +End blending mode (reset to default: BLEND_ALPHA) --- -> success = RL.BeginScissorMode( Rectangle rectange ) - -Begin scissor mode ( define screen area for following drawing ) +> RL.BeginScissorMode( Rectangle rectange ) -- Failure return false -- Success return true +Begin scissor mode (define screen area for following drawing) --- @@ -1924,8 +1866,8 @@ End scissor mode Load shader from files and bind default locations. NOTE: Set nil if no shader -- Failure return -1 -- Success return int +- Failure return nil +- Success return Shader --- @@ -1934,23 +1876,20 @@ NOTE: Set nil if no shader Load shader from code strings and bind default locations NOTE: Set nil if no shader -- Failure return -1 -- Success return int +- Failure return nil +- Success return Shader --- -> success = RL.BeginShaderMode( Shader shader ) +> RL.BeginShaderMode( Shader shader ) Begin custom shader drawing -- Failure return false -- Success return true - --- > RL.EndShaderMode() -End custom shader drawing ( use default shader ) +End custom shader drawing (use default shader) --- @@ -1958,7 +1897,6 @@ End custom shader drawing ( use default shader ) Get shader uniform location -- Failure return -1 - Success return int --- @@ -1967,74 +1905,48 @@ Get shader uniform location Get shader attribute location -- Failure return -1 - Success return int --- -> success = RL.SetShaderLocationIndex( Shader shader, int shaderLocationIndex, int location ) +> RL.SetShaderLocationIndex( Shader shader, int shaderLocationIndex, int location ) Set shader location index -- Failure return false -- Success return true - --- > location = RL.GetShaderLocationIndex( Shader shader, int shaderLocationIndex ) Get shader location index -- Failure return false - Success return int --- -> success = RL.SetShaderValueMatrix( Shader shader, int locIndex, Matrix mat ) - -Set shader uniform value ( matrix 4x4 ) +> RL.SetShaderValueMatrix( Shader shader, int locIndex, Matrix mat ) -- Failure return false -- Success return true +Set shader uniform value (matrix 4x4) --- -> success = RL.SetShaderValueTexture( Shader shader, int locIndex, Texture2D texture ) +> RL.SetShaderValueTexture( Shader shader, int locIndex, Texture texture ) -Set shader uniform value for texture ( sampler2d ) - -- Failure return false -- Success return true +Set shader uniform value for texture (sampler2d) --- -> success = RL.SetShaderValue( Shader shader, int locIndex, number{} values, int uniformType ) +> RL.SetShaderValue( Shader shader, int locIndex, number{} values, int uniformType ) Set shader uniform value NOTE: Even one value should be in table -- Failure return false -- Success return true - --- -> success = RL.SetShaderValueV( Shader shader, int locIndex, number{} values, int uniformType, int count ) +> RL.SetShaderValueV( Shader shader, int locIndex, number{} values, int uniformType, int count ) Set shader uniform value vector NOTE: Even one value should be in table -- Failure return false -- Success return true - ---- - -> success = RL.UnloadShader( Shader shader ) - -Unload shader from GPU memory ( VRAM ) - -- Failure return false -- Success return true - --- ## Core - Input-related Keyboard @@ -2045,7 +1957,6 @@ Unload shader from GPU memory ( VRAM ) Detect if a key has been pressed once -- Failure return nil - Success return bool --- @@ -2054,7 +1965,6 @@ Detect if a key has been pressed once Detect if a key is being pressed -- Failure return nil - Success return bool --- @@ -2063,7 +1973,6 @@ Detect if a key is being pressed Detect if a key has been released once -- Failure return nil - Success return bool --- @@ -2072,7 +1981,6 @@ Detect if a key has been released once Check if a key is NOT being pressed -- Failure return nil - Success return bool --- @@ -2095,7 +2003,7 @@ Get char pressed (unicode), call it multiple times for chars queued, returns 0 w > RL.SetExitKey( int key ) -Set a custom key to exit program ( default is ESC ) +Set a custom key to exit program (default is ESC) --- @@ -2114,7 +2022,6 @@ otherwise the scancode is ignored. If you specify a non-printable key, or KEY_UNKNOWN and a scancode that maps to a non-printable key, this function returns nil but does not emit an error. -- Failure return -1 - Success return string or nil --- @@ -2124,7 +2031,6 @@ this function returns nil but does not emit an error. This function returns the platform-specific scancode of the specified key. If the key is KEY_UNKNOWN or does not exist on the keyboard this method will return -1. -- Failure return nil - Success return int --- @@ -2137,7 +2043,6 @@ If the key is KEY_UNKNOWN or does not exist on the keyboard this method will ret Detect if a gamepad is available -- Failure return nil - Success return bool --- @@ -2146,7 +2051,6 @@ Detect if a gamepad is available Detect if a gamepad button has been pressed once -- Failure return nil - Success return bool --- @@ -2155,7 +2059,6 @@ Detect if a gamepad button has been pressed once Detect if a gamepad button is being pressed -- Failure return nil - Success return bool --- @@ -2164,7 +2067,6 @@ Detect if a gamepad button is being pressed Detect if a gamepad button has been released once -- Failure return nil - Success return bool --- @@ -2173,7 +2075,6 @@ Detect if a gamepad button has been released once Return gamepad axis count for a gamepad -- Failure return false - Success return int --- @@ -2182,7 +2083,6 @@ Return gamepad axis count for a gamepad Return axis movement value for a gamepad axis -- Failure return false - Success return float --- @@ -2191,7 +2091,6 @@ Return axis movement value for a gamepad axis Return gamepad internal name id -- Failure return false - Success return string --- @@ -2204,7 +2103,6 @@ Return gamepad internal name id Detect if a mouse button has been pressed once -- Failure return nil - Success return bool --- @@ -2213,7 +2111,6 @@ Detect if a mouse button has been pressed once Detect if a mouse button is being pressed -- Failure return nil - Success return bool --- @@ -2222,7 +2119,6 @@ Detect if a mouse button is being pressed Detect if a mouse button has been released once -- Failure return nil - Success return bool --- @@ -2231,7 +2127,6 @@ Detect if a mouse button has been released once Check if a mouse button is NOT being pressed -- Failure return nil - Success return bool --- @@ -2252,31 +2147,22 @@ Get mouse delta between frames --- -> success = RL.SetMousePosition( Vector2 position ) +> RL.SetMousePosition( Vector2 position ) Set mouse position XY -- Failure return false -- Success return true - --- -> success = RL.SetMouseOffset( Vector2 offset ) +> RL.SetMouseOffset( Vector2 offset ) Set mouse offset -- Failure return false -- Success return true - --- -> success = RL.SetMouseScale( Vector2 scale ) +> RL.SetMouseScale( Vector2 scale ) Set mouse scaling -- Failure return false -- Success return true - --- > movement = RL.GetMouseWheelMove() @@ -2287,13 +2173,10 @@ Returns mouse wheel movement Y --- -> success = RL.SetMouseCursor( int cursor ) +> RL.SetMouseCursor( int cursor ) Set mouse cursor -- Failure return false -- Success return true - --- ## Core - Input-related Touch @@ -2302,9 +2185,8 @@ Set mouse cursor > position = RL.GetTouchPosition( int index ) -Get touch position XY for a touch point index ( relative to screen size ) +Get touch position XY for a touch point index (relative to screen size) -- Failure return false - Success return Vector2 --- @@ -2313,7 +2195,6 @@ Get touch position XY for a touch point index ( relative to screen size ) Get touch point identifier for given index -- Failure return false - Success return int --- @@ -2330,20 +2211,16 @@ Get touch point identifier for given index --- -> success = RL.SetGesturesEnabled( unsigned int flags ) +> RL.SetGesturesEnabled( unsigned int flags ) Enable a set of gestures using flags -- Failure return false -- Success return true - --- > detected = RL.IsGestureDetected( int gesture ) Check if a gesture have been detected -- Failure return nil - Success return bool --- @@ -2402,7 +2279,7 @@ Get gesture pinch angle > path = RL.GetBasePath() -Return game directory ( where main.lua is located ) +Return game directory (where main.lua is located) - Success return string @@ -2412,7 +2289,6 @@ Return game directory ( where main.lua is located ) Check if file exists -- Failure return nil - Success return bool --- @@ -2421,77 +2297,69 @@ Check if file exists Check if a directory path exists -- Failure return nil - Success return bool --- > hasFileExtension = RL.IsFileExtension( string fileName, string ext ) -Check file extension ( Including point: .png, .wav ) +Check file extension (Including point: .png, .wav) -- Failure return nil - Success return bool --- > length = RL.GetFileLength( string fileName ) -Get file length in bytes ( NOTE: GetFileSize() conflicts with windows.h ) +Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) -- Failure return false - Success return int --- > extension = RL.GetFileExtension( string fileName ) -Get pointer to extension for a filename string ( Includes dot: '.png' ) +Get pointer to extension for a filename string (Includes dot: '.png') -- Failure return false - Success return string --- -> filePath = RL.GetFileName( string filePath ) +> fileName = RL.GetFileName( string filePath ) Get pointer to filename for a path string -- Failure return false - Success return string --- -> filePath = RL.GetFileNameWithoutExt( string filePath ) +> fileName = RL.GetFileNameWithoutExt( string filePath ) -Get filename string without extension ( Uses static string ) +Get filename string without extension (Uses static string) -- Failure return false - Success return string --- > filePath = RL.GetDirectoryPath( string filePath ) -Get full path for a given fileName with path ( Uses static string ) +Get full path for a given fileName with path (Uses static string) -- Failure return false - Success return string --- > directory = RL.GetPrevDirectoryPath( string dirPath ) -Get previous directory path for a given path ( Uses static string ) +Get previous directory path for a given path (Uses static string) -- Failure return false - Success return string --- > directory = RL.GetWorkingDirectory() -Get current working directory ( Uses static string ) +Get current working directory (Uses static string) - Success return string @@ -2501,7 +2369,6 @@ Get current working directory ( Uses static string ) Load directory filepaths -- Failure return false - Success return string{} --- @@ -2510,7 +2377,6 @@ Load directory filepaths Load directory filepaths with extension filtering and recursive directory scan -- Failure return false - Success return string{} --- @@ -2519,8 +2385,7 @@ Load directory filepaths with extension filtering and recursive directory scan Change working directory, return true on success -- Failure return false -- Success return true +- Success return bool --- @@ -2528,12 +2393,11 @@ Change working directory, return true on success Check if a given path is a file or a directory -- Failure return nil - Success return bool --- -> fileDropped = RL.IsFileDropped() +> iSFileDropped = RL.IsFileDropped() Check if a file has been dropped into window @@ -2551,9 +2415,8 @@ Load dropped filepaths > time = RL.GetFileModTime( string fileName ) -Get file modification time ( Last write time ) +Get file modification time (Last write time) -- Failure return false - Success return int --- @@ -2564,27 +2427,15 @@ Get file modification time ( Last write time ) > camera2D = RL.CreateCamera2D() -Return camera2D id set to default configuration - -- Success return int - ---- - -> success = RL.UnloadCamera2D( camera2D camera ) +Return camera2D set to default configuration -Unload Camera2D - -- Failure return false -- Success return true +- Success return Camera2D --- -> success = RL.BeginMode2D( camera2D camera ) - -Begin 2D mode with custom camera ( 2D ) +> RL.BeginMode2D( camera2D camera ) -- Failure return false -- Success return true +Begin 2D mode with custom camera (2D) --- @@ -2594,39 +2445,27 @@ Ends 2D mode with custom camera --- -> success = RL.SetCamera2DTarget( camera2D camera, Vector2 target ) +> RL.SetCamera2DTarget( camera2D camera, Vector2 target ) -Set camera target ( rotation and zoom origin ) - -- Failure return false -- Success return true +Set camera target (rotation and zoom origin) --- -> success = RL.SetCamera2DOffset( camera2D camera, Vector2 offset ) - -Set camera offset ( displacement from target ) +> RL.SetCamera2DOffset( camera2D camera, Vector2 offset ) -- Failure return false -- Success return true +Set camera offset (displacement from target) --- -> success = RL.SetCamera2DRotation( camera2D camera, float rotation ) +> RL.SetCamera2DRotation( camera2D camera, float rotation ) Set camera rotation in degrees -- Failure return false -- Success return true - --- -> success = RL.SetCamera2DZoom( camera2D camera, float zoom ) - -Set camera zoom ( scaling ), should be 1.0f by default +> RL.SetCamera2DZoom( camera2D camera, float zoom ) -- Failure return false -- Success return true +Set camera zoom (scaling), should be 1.0f by default --- @@ -2634,7 +2473,6 @@ Set camera zoom ( scaling ), should be 1.0f by default Get camera2D target -- Failure return nil - Success return Vector2 --- @@ -2643,7 +2481,6 @@ Get camera2D target Get camera2D offset -- Failure return nil - Success return Vector2 --- @@ -2652,7 +2489,6 @@ Get camera2D offset Get camera2D rotation -- Failure return nil - Success return float --- @@ -2661,7 +2497,6 @@ Get camera2D rotation Get camera2D zoom -- Failure return nil - Success return float --- @@ -2678,21 +2513,9 @@ Return camera3D id set to default configuration --- -> success = RL.UnloadCamera3D( int Camera3D ) - -Unload Camera3D - -- Failure return false -- Success return true - ---- - -> success = RL.BeginMode3D( camera3D camera ) - -Begin 3D mode with custom camera ( 3D ) +> RL.BeginMode3D( camera3D camera ) -- Failure return false -- Success return true +Begin 3D mode with custom camera (3D) --- @@ -2702,48 +2525,33 @@ Ends 3D mode and returns to default 2D orthographic mode --- -> success = RL.SetCamera3DPosition( camera3D camera, Vector3 position ) +> RL.SetCamera3DPosition( camera3D camera, Vector3 position ) -Set camera position ( Remember to call "RL.UpdateCamera3D()" to apply changes ) - -- Failure return false -- Success return true +Set camera position (Remember to call "RL.UpdateCamera3D()" to apply changes) --- -> success = RL.SetCamera3DTarget( camera3D camera, Vector3 target ) +> RL.SetCamera3DTarget( camera3D camera, Vector3 target ) Set camera target it looks-at -- Failure return false -- Success return true - --- -> success = RL.SetCamera3DUp( camera3D camera, Vector3 up ) +> RL.SetCamera3DUp( camera3D camera, Vector3 up ) -Set camera up vector ( Rotation over it's axis ) - -- Failure return false -- Success return true +Set camera up vector (Rotation over it's axis) --- -> success = RL.SetCamera3DFovy( camera3D camera, float fovy ) - -Set camera field-of-view apperture in Y ( degrees ) in perspective, used as near plane width in orthographic +> RL.SetCamera3DFovy( camera3D camera, float fovy ) -- Failure return false -- Success return true +Set camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic --- -> success = RL.SetCamera3DProjection( camera3D camera, int projection ) +> RL.SetCamera3DProjection( camera3D camera, int projection ) -Set camera projection mode ( CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC ) - -- Failure return false -- Success return true +Set camera projection mode (CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC) --- @@ -2751,7 +2559,6 @@ Set camera projection mode ( CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC ) Get camera position -- Failure return nil - Success return Vector3 --- @@ -2760,25 +2567,22 @@ Get camera position Get camera target it looks-at -- Failure return nil - Success return Vector3 --- > up = RL.GetCamera3DUp( camera3D camera ) -Get camera up vector ( Rotation over it's axis ) +Get camera up vector (Rotation over it's axis) -- Failure return nil - Success return Vector3 --- > fovy = RL.GetCamera3DFovy( camera3D camera ) -Get camera field-of-view apperture in Y ( degrees ) in perspective, used as near plane width in orthographic +Get camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic -- Failure return nil - Success return float --- @@ -2787,88 +2591,69 @@ Get camera field-of-view apperture in Y ( degrees ) in perspective, used as near Get camera projection mode -- Failure return nil - Success return int --- > forward = RL.GetCamera3DForward( camera3D camera ) -Returns the cameras forward vector ( normalized ) +Returns the cameras forward vector (normalized) -- Failure return nil - Success return Vector3 --- > up = RL.GetCamera3DUpNormalized( camera3D camera ) -Returns the cameras up vector ( normalized ) +Returns the cameras up vector (normalized) Note: The up vector might not be perpendicular to the forward vector -- Failure return nil - Success return Vector3 --- > right = RL.GetCamera3DRight( camera3D camera ) -Returns the cameras right vector ( normalized ) +Returns the cameras right vector (normalized) -- Failure return nil - Success return Vector3 --- -> success = RL.Camera3DMoveForward( camera3D camera, float distance, bool moveInWorldPlane ) +> RL.Camera3DMoveForward( camera3D camera, float distance, bool moveInWorldPlane ) Moves the camera in it's forward direction -- Failure return false -- Success return true - --- -> success = RL.Camera3DMoveUp( camera3D camera, float distance ) +> RL.Camera3DMoveUp( camera3D camera, float distance ) Moves the camera in it's up direction -- Failure return false -- Success return true - --- -> success = RL.Camera3DMoveRight( camera3D camera, float distance, bool moveInWorldPlane ) +> RL.Camera3DMoveRight( camera3D camera, float distance, bool moveInWorldPlane ) Moves the camera target in it's current right direction -- Failure return false -- Success return true - --- -> success = RL.Camera3DMoveToTarget( camera3D camera, float delta ) +> RL.Camera3DMoveToTarget( camera3D camera, float delta ) Moves the camera position closer/farther to/from the camera target -- Failure return false -- Success return true - --- -> success = RL.Camera3DYaw( camera3D camera, float angle, bool rotateAroundTarget ) +> RL.Camera3DYaw( camera3D camera, float angle, bool rotateAroundTarget ) Rotates the camera around it's up vector Yaw is "looking left and right" If rotateAroundTarget is false, the camera rotates around it's position Note: angle must be provided in radians -- Failure return false -- Success return true - --- -> success = RL.Camera3DPitch( camera3D camera, float angle, bool lockView, bool rotateAroundTarget, bool rotateUp ) +> RL.Camera3DPitch( camera3D camera, float angle, bool lockView, bool rotateAroundTarget, bool rotateUp ) Rotates the camera around it's right vector, pitch is "looking up and down" - lockView prevents camera overrotation (aka "somersaults") @@ -2876,27 +2661,20 @@ Rotates the camera around it's right vector, pitch is "looking up and down" - rotateUp rotates the up direction as well (typically only usefull in CAMERA_FREE) NOTE: angle must be provided in radians -- Failure return false -- Success return true - --- -> success = RL.Camera3DRoll( camera3D camera, float angle ) +> RL.Camera3DRoll( camera3D camera, float angle ) Rotates the camera around it's forward vector Roll is "turning your head sideways to the left or right" Note: angle must be provided in radians -- Failure return false -- Success return true - --- > view = RL.GetCamera3DViewMatrix( camera3D camera ) Returns the camera view matrix -- Failure return false - Success return Matrix --- @@ -2905,27 +2683,20 @@ Returns the camera view matrix Returns the camera projection matrix -- Failure return false - Success return Matrix --- -> success = RL.UpdateCamera3D( camera3D camera, int mode ) +> RL.UpdateCamera3D( camera3D camera, int mode ) Update camera position for selected mode -- Failure return false -- Success return true - --- -> success = RL.UpdateCamera3DPro( camera3D camera, Vector3 movement, Vector3 rotation, float zoom ) +> RL.UpdateCamera3DPro( camera3D camera, Vector3 movement, Vector3 rotation, float zoom ) Update camera movement, movement/rotation values should be provided by user -- Failure return false -- Success return true - --- ## Core - Screen-space @@ -2936,16 +2707,14 @@ Update camera movement, movement/rotation values should be provided by user Get a ray trace from mouse position -- Failure return false - Success return Ray --- > matrix = RL.GetCameraMatrix( Camera3D camera ) -Get camera transform matrix ( view matrix ) +Get camera transform matrix (view matrix) -- Failure return false - Success return Matrix --- @@ -2954,7 +2723,6 @@ Get camera transform matrix ( view matrix ) Get camera 2d transform matrix -- Failure return false - Success return Matrix --- @@ -2963,7 +2731,6 @@ Get camera 2d transform matrix Get the screen space position for a 3d world space position -- Failure return false - Success return Vector2 --- @@ -2972,7 +2739,6 @@ Get the screen space position for a 3d world space position Get size position for a 3d world space position -- Failure return false - Success return Vector2 --- @@ -2981,7 +2747,6 @@ Get size position for a 3d world space position Get the screen space position for a 2d camera world space position -- Failure return false - Success return Vector2 --- @@ -2990,33 +2755,20 @@ Get the screen space position for a 2d camera world space position Get the world space position for a 2d camera screen space position -- Failure return false - Success return Vector2 --- -> buffer = RL.LoadBuffer( data{} buffer, int type ) - -Creates buffer as userdata. Type should be one of the Buffer types - -- Failure return false -- Success return Buffer - ---- - ## Shapes - Drawing --- -> success = RL.SetShapesTexture( Texture2D texture, Rectangle source ) +> RL.SetShapesTexture( Texture texture, Rectangle source ) Set texture and rectangle to be used on shapes drawing NOTE: It can be useful when using basic shapes and one single font, defining a font char white rectangle would allow drawing everything in a single draw call -- Failure return false -- Success return true - --- > success = RL.DrawPixel( Vector2 pos, Color color ) @@ -3398,10 +3150,9 @@ Get collision rectangle for two rectangles collision > image = RL.LoadImage( string fileName ) -Load image from file into CPU memory ( RAM ) +Load image from file into CPU memory (RAM) -- Failure return -1 -- Success return int +- Success return Image --- @@ -3409,25 +3160,15 @@ Load image from file into CPU memory ( RAM ) Load image from GPU texture data -- Failure return -1 -- Success return int +- Success return Image --- > image = RL.LoadImageFromScreen() -Load image from screen buffer and ( screenshot ) +Load image from screen buffer and (screenshot) -- Success return int - ---- - -> success = RL.UnloadImage( Image image ) - -Unload image from CPU memory ( RAM ) - -- Failure return false -- Success return true +- Success return Image --- @@ -3435,7 +3176,6 @@ Unload image from CPU memory ( RAM ) Export image data to file, returns true on success -- Failure return nil - Success return bool --- @@ -3444,7 +3184,6 @@ Export image data to file, returns true on success Export image as code file defining an array of bytes, returns true on success -- Failure return nil - Success return bool --- @@ -3453,12 +3192,11 @@ Export image as code file defining an array of bytes, returns true on success --- -> image = RL.GenImageColor( int width, int height, Color color ) +> image = RL.GenImageColor( Vector2 size, Color color ) Generate image: plain color -- Failure return -1 -- Success return int +- Success return Image --- @@ -3466,8 +3204,7 @@ Generate image: plain color Generate image: vertical gradient -- Failure return -1 -- Success return int +- Success return Image --- @@ -3475,8 +3212,7 @@ Generate image: vertical gradient Generate image: horizontal gradient -- Failure return -1 -- Success return int +- Success return Image --- @@ -3484,8 +3220,7 @@ Generate image: horizontal gradient Generate image: radial gradient -- Failure return -1 -- Success return int +- Success return Image --- @@ -3493,8 +3228,7 @@ Generate image: radial gradient Generate image: checked -- Failure return -1 -- Success return int +- Success return Image --- @@ -3502,8 +3236,7 @@ Generate image: checked Generate image: white noise -- Failure return -1 -- Success return int +- Success return Image --- @@ -3511,8 +3244,7 @@ Generate image: white noise Generate image: perlin noise -- Failure return -1 -- Success return int +- Success return Image --- @@ -3520,8 +3252,7 @@ Generate image: perlin noise Generate image: cellular algorithm. Bigger tileSize means bigger cells -- Failure return -1 -- Success return int +- Success return Image --- @@ -3529,8 +3260,7 @@ Generate image: cellular algorithm. Bigger tileSize means bigger cells Generate image: grayscale image from text data -- Failure return -1 -- Success return int +- Success return Image --- @@ -3540,10 +3270,9 @@ Generate image: grayscale image from text data > image = RL.ImageCopy( Image image ) -Create an image duplicate ( useful for transformations ) +Create an image duplicate (useful for transformations) -- Failure return -1 -- Success return int +- Success return Image --- @@ -3551,241 +3280,169 @@ Create an image duplicate ( useful for transformations ) Create an image from another image piece -- Failure return -1 -- Success return int +- Success return Image --- > image = RL.ImageText( Font font, string text, float fontSize, float spacing, Color tint ) -Create an image from text ( custom sprite font ) +Create an image from text (custom sprite font) - Failure return -1 - Success return int --- -> success = RL.ImageFormat( Image image, int newFormat ) +> RL.ImageFormat( Image image, int newFormat ) Convert image data to desired format -- Failure return false -- Success return true - --- -> success = RL.ImageToPOT( Image image, Color fill ) - -Convert image to POT ( power-of-two ) +> RL.ImageToPOT( Image image, Color fill ) -- Failure return false -- Success return true +Convert image to POT (power-of-two) --- -> success = RL.ImageCrop( Image image, Rectangle crop ) +> RL.ImageCrop( Image image, Rectangle crop ) Crop an image to a defined rectangle -- Failure return false -- Success return true - --- -> success = RL.ImageAlphaCrop( Image image, float threshold ) +> RL.ImageAlphaCrop( Image image, float threshold ) Crop image depending on alpha value -- Failure return false -- Success return true - --- -> success = RL.ImageAlphaClear( Image image, Color color, float threshold ) +> RL.ImageAlphaClear( Image image, Color color, float threshold ) Clear alpha channel to desired color -- Failure return false -- Success return true - --- -> success = RL.ImageAlphaMask( Image image, Image alphaMask ) +> RL.ImageAlphaMask( Image image, Image alphaMask ) Apply alpha mask to image -- Failure return false -- Success return true - --- -> success = RL.ImageAlphaPremultiply( Image image ) +> RL.ImageAlphaPremultiply( Image image ) Premultiply alpha channel -- Failure return false -- Success return true - --- -> success = RL.ImageBlurGaussian( Image image, int blurSize ) +> RL.ImageBlurGaussian( Image image, int blurSize ) Apply Gaussian blur using a box blur approximation -- Failure return false -- Success return true - --- -> success = RL.ImageResize( Image image, Vector2 size ) +> RL.ImageResize( Image image, Vector2 size ) -Resize image ( Bicubic scaling algorithm ) - -- Failure return false -- Success return true +Resize image (Bicubic scaling algorithm) --- -> success = RL.ImageResizeNN( Image image, Vector2 size ) - -Resize image ( Nearest-Neighbor scaling algorithm ) +> RL.ImageResizeNN( Image image, Vector2 size ) -- Failure return false -- Success return true +Resize image (Nearest-Neighbor scaling algorithm) --- -> success = RL.ImageResizeCanvas( Image image, Vector2 size, Vector2 offset, Color fill ) +> RL.ImageResizeCanvas( Image image, Vector2 size, Vector2 offset, Color fill ) Resize canvas and fill with color -- Failure return false -- Success return true - --- -> success = RL.ImageMipmaps( Image image ) +> RL.ImageMipmaps( Image image ) Generate all mipmap levels for a provided image -- Failure return false -- Success return true - --- -> success = RL.ImageDither( Image image, Color bpp ) +> RL.ImageDither( Image image, Color bpp ) -Dither image data to 16bpp or lower ( Floyd-Steinberg dithering ) - -- Failure return false -- Success return true +Dither image data to 16bpp or lower (Floyd-Steinberg dithering) --- -> success = RL.ImageFlipVertical( Image image ) +> RL.ImageFlipVertical( Image image ) Flip image vertically -- Failure return false -- Success return true - --- -> success = RL.ImageFlipHorizontal( Image image ) +> RL.ImageFlipHorizontal( Image image ) Flip image horizontally -- Failure return false -- Success return true - --- -> success = RL.ImageRotateCW( Image image ) +> RL.ImageRotateCW( Image image ) Rotate image clockwise 90deg -- Failure return false -- Success return true - --- -> success = RL.ImageRotateCCW( Image image ) +> RL.ImageRotateCCW( Image image ) Rotate image counter-clockwise 90deg -- Failure return false -- Success return true - --- -> success = RL.ImageColorTint( Image image, Color color ) +> RL.ImageColorTint( Image image, Color color ) Modify image color: tint -- Failure return false -- Success return true - --- -> success = RL.ImageColorInvert( Image image ) +> RL.ImageColorInvert( Image image ) Modify image color: invert -- Failure return false -- Success return true - --- -> success = RL.ImageColorGrayscale( Image image ) +> RL.ImageColorGrayscale( Image image ) Modify image color: grayscale -- Failure return false -- Success return true - --- -> success = RL.ImageColorContrast( Image image, float contrast ) +> RL.ImageColorContrast( Image image, float contrast ) -Modify image color: contrast ( -100 to 100 ) - -- Failure return false -- Success return true +Modify image color: contrast (-100 to 100) --- -> success = RL.ImageColorBrightness( Image image, int brightness ) - -Modify image color: brightness ( -255 to 255 ) +> RL.ImageColorBrightness( Image image, int brightness ) -- Failure return false -- Success return true +Modify image color: brightness (-255 to 255) --- -> success = RL.ImageColorReplace( Image image, Color color, Color replace ) +> RL.ImageColorReplace( Image image, Color color, Color replace ) Modify image color: replace color -- Failure return false -- Success return true - --- > colors = RL.LoadImageColors( Image image ) -Load color data from image as a Color array ( RGBA - 32bit ) +Load color data from image as a Color array (RGBA - 32bit) -- Failure return false - Success return Color{} --- > colors = RL.LoadImagePalette( Image image, int maxPaletteSize ) -Load colors palette from image as a Color array ( RGBA - 32bit ) +Load colors palette from image as a Color array (RGBA - 32bit) -- Failure return false - Success return Color{} --- @@ -3794,16 +3451,14 @@ Load colors palette from image as a Color array ( RGBA - 32bit ) Get image alpha border rectangle -- Failure return false - Success return Rectangle --- > color = RL.GetImageColor( Image image, Vector2 pixelPos ) -Get image pixel color at ( x, y ) position +Get image pixel color at (x, y) position -- Failure return false - Success return Color --- @@ -3812,75 +3467,51 @@ Get image pixel color at ( x, y ) position --- -> success = RL.ImageClearBackground( Image dst, Color color ) +> RL.ImageClearBackground( Image dst, Color color ) Clear image background with given color -- Failure return false -- Success return true - --- -> success = RL.ImageDrawPixel( Image dst, Vector2 position, Color color ) +> RL.ImageDrawPixel( Image dst, Vector2 position, Color color ) Draw pixel within an image -- Failure return false -- Success return true - --- -> success = RL.ImageDrawLine( Image dst, Vector2 a, Vector2 b, Color color ) +> RL.ImageDrawLine( Image dst, Vector2 a, Vector2 b, Color color ) Draw line within an image -- Failure return false -- Success return true - --- -> success = RL.ImageDrawCircle( Image dst, Vector2 center, int radius, Color color ) +> RL.ImageDrawCircle( Image dst, Vector2 center, int radius, Color color ) Draw circle within an image -- Failure return false -- Success return true - --- -> success = RL.ImageDrawCircleLines( Image dst, Vector2 center, int radius, Color color ) +> RL.ImageDrawCircleLines( Image dst, Vector2 center, int radius, Color color ) Draw circle outline within an image -- Failure return false -- Success return true - --- -> success = RL.ImageDrawRectangle( Image dst, Rectangle rec, Color color ) +> RL.ImageDrawRectangle( Image dst, Rectangle rec, Color color ) Draw rectangle within an image -- Failure return false -- Success return true - --- -> success = RL.ImageDrawRectangleLines( Image dst, Rectangle rec, int thick, Color color ) +> RL.ImageDrawRectangleLines( Image dst, Rectangle rec, int thick, Color color ) Draw rectangle lines within an image -- Failure return false -- Success return true - --- -> success = RL.ImageDraw( Image dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint ) +> RL.ImageDraw( Image dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint ) -Draw a source image within a destination image ( Tint applied to source ) - -- Failure return false -- Success return true +Draw a source image within a destination image (Tint applied to source) --- @@ -3901,7 +3532,6 @@ Draw text ( Custom sprite font ) within an image ( Destination ) Get image size -- Failure return nil - Success return Vector2 --- @@ -3910,16 +3540,14 @@ Get image size Get image mipmaps. Mipmap levels, 1 by default -- Failure return false - Success return int --- > format = RL.GetImageFormat( Image image ) -Get image data format ( PixelFormat type ) +Get image data format (PixelFormat type) -- Failure return false - Success return int --- @@ -3932,8 +3560,8 @@ Get image data format ( PixelFormat type ) Load texture from file into GPU memory ( VRAM ) -- Failure return -1 -- Success return int +- Failure return nil +- Success return Texture --- @@ -3941,8 +3569,7 @@ Load texture from file into GPU memory ( VRAM ) Load texture from image data -- Failure return -1 -- Success return int +- Success return Texture --- @@ -3950,105 +3577,72 @@ Load texture from image data Load cubemap from image, multiple image cubemap layouts supported -- Failure return -1 -- Success return int +- Success return Texture --- > renderTexture = RL.LoadRenderTexture( Vector2 size ) -Load texture for rendering ( framebuffer ) - -- Failure return -1 -- Success return int - ---- - -> success = RL.UnloadTexture( Texture2D texture ) - -Unload texture from GPU memory ( VRAM ). NOTE! Must be texture id. +Load texture for rendering (framebuffer) -- Failure return false -- Success return true +- Success return RenderTexture --- -> isReady = RL.IsTextureReady( Texture2D texture ) +> isReady = RL.IsTextureReady( Texture texture ) Check if a texture is ready -- Failure return nil -- Success return true +- Success return bool --- -> success = RL.UpdateTexture( Texture2D texture, int{} pixels ) +> RL.UpdateTexture( Texture texture, int{} pixels ) Update GPU texture with new data NOTE! Should be TEXTURE_TYPE_TEXTURE. Pixel should be in format { { 255, 255, 255, 255 }... } depending on the pixel format -- Failure return false -- Success return true - --- -> success = RL.UpdateTextureRec( Texture2D texture, Rectangle rec, int{} pixels ) +> RL.UpdateTextureRec( Texture texture, Rectangle rec, int{} pixels ) Update GPU texture rectangle with new data NOTE! Should be TEXTURE_TYPE_TEXTURE. Pixel should be in format { { 255, 255, 255, 255 }... } depending on the pixel format -- Failure return false -- Success return true - --- ## Textures - Texture Drawing --- -> success = RL.DrawTexture( Texture2D texture, Vector2 position, Color tint ) +> RL.DrawTexture( Texture texture, Vector2 position, Color tint ) Draw a Texture2D -- Failure return false -- Success return true - --- -> success = RL.DrawTextureRec( Texture2D texture, Rectangle source, Vector2 position, Color tint ) +> RL.DrawTextureRec( Texture texture, Rectangle source, Vector2 position, Color tint ) Draw a part of a texture defined by a rectangle -- Failure return false -- Success return true - --- -> success = RL.DrawTexturePro( Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint ) +> RL.DrawTexturePro( Texture texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint ) Draw a part of a texture defined by a rectangle with "pro" parameters -- Failure return false -- Success return true - --- -> success = RL.DrawTextureNPatch( Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint ) +> RL.DrawTextureNPatch( Texture texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint ) -Draws a texture ( or part of it ) that stretches or shrinks nicely - -- Failure return false -- Success return true +Draws a texture (or part of it) that stretches or shrinks nicely --- -> success = RL.BeginTextureMode( RenderTexture2D target ) +> RL.BeginTextureMode( RenderTexture target ) Begin drawing to render texture -- Failure return false -- Success return true - --- > RL.EndTextureMode() @@ -4057,79 +3651,85 @@ Ends drawing to render texture --- -> type = RL.GetTextureType( Texture2D texture ) +## Textures - Texture Configuration -Get texture type ( TEXTURE_TYPE_TEXTURE or TEXTURE_TYPE_RENDER_TEXTURE ) +--- -- Failure return false -- Success return int +> RL.GenTextureMipmaps( Texture texture ) + +Generate GPU mipmaps for a texture --- -## Textures - Texture Configuration +> RL.SetTextureFilter( Texture texture, int filter ) ---- +Set texture scaling filter mode (TEXTURE_FILTER_POINT, TEXTURE_FILTER_BILINEAR...) -> success = RL.GenTextureMipmaps( Texture2D texture ) +--- -Generate GPU mipmaps for a texture +> RL.SetTextureWrap( Texture texture, int wrap ) -- Failure return false -- Success return true +Set texture wrapping mode (TEXTURE_WRAP_REPEAT, TEXTURE_WRAP_CLAMP...) --- -> success = RL.SetTextureFilter( Texture2D texture, int filter ) +> id = RL.GetTextureId( Texture texture ) -Set texture scaling filter mode ( TEXTURE_FILTER_POINT, TEXTURE_FILTER_BILINEAR... ) +Get OpenGL texture id -- Failure return false -- Success return true +- Success return int --- -> success = RL.SetTextureWrap( Texture2D texture, int wrap ) +> size = RL.GetTextureSize( Texture texture ) -Set texture wrapping mode ( TEXTURE_WRAP_REPEAT, TEXTURE_WRAP_CLAMP... ) +Get texture size -- Failure return false -- Success return true +- Success return Vector2 --- -> id = RL.GetTextureId( Texture2D texture ) +> mipmaps = RL.GetTextureMipmaps( Texture texture ) -Get texture OpenGL id +Get texture mipmaps. Mipmap levels, 1 by default -- Failure return false - Success return int --- -> size = RL.GetTextureSize( Texture2D texture ) +> format = RL.GetTextureFormat( Texture texture ) -Get texture size +Get texture data format (PixelFormat type) -- Failure return false -- Success return Vector2 +- Success return int --- -> mipmaps = RL.GetTextureMipmaps( Texture2D texture ) +## Textures - RenderTexture Configuration -Get texture mipmaps. Mipmap levels, 1 by default +--- + +> id = RL.GetRenderTextureId( RenderTexture renderTexture ) + +Get OpenGL framebuffer object id -- Failure return false - Success return int --- -> format = RL.GetTextureFormat( Texture2D texture ) +> texture = RL.GetRenderTextureTexture( RenderTexture renderTexture ) -Get texture data format ( PixelFormat type ) +Get color buffer attachment texture -- Failure return false -- Success return int +- Success return Texture + +--- + +> texture = RL.GetRenderTextureDepthTexture( RenderTexture renderTexture ) + +Get depth buffer attachment texture + +- Success return Texture --- @@ -4141,7 +3741,6 @@ Get texture data format ( PixelFormat type ) Returns color with alpha applied, alpha goes from 0.0f to 1.0f -- Failure return false - Success return Color --- @@ -4150,7 +3749,6 @@ Returns color with alpha applied, alpha goes from 0.0f to 1.0f Returns hexadecimal value for a Color -- Failure return false - Success return int --- @@ -4159,7 +3757,6 @@ Returns hexadecimal value for a Color Returns Color normalized as float [0..1] -- Failure return false - Success return Vector4 --- @@ -4168,7 +3765,6 @@ Returns Color normalized as float [0..1] Color from normalized values [0..1] -- Failure return false - Success return Color --- @@ -4177,7 +3773,6 @@ Color from normalized values [0..1] Returns HSV values for a Color, hue [0..360], saturation/value [0..1] -- Failure return false - Success return Vector3 --- @@ -4186,7 +3781,6 @@ Returns HSV values for a Color, hue [0..360], saturation/value [0..1] Returns a Color from HSV values, hue [0..360], saturation/value [0..1] -- Failure return false - Success return Color --- @@ -4195,7 +3789,6 @@ Returns a Color from HSV values, hue [0..360], saturation/value [0..1] Get color multiplied with another color -- Failure return false - Success return Color --- @@ -4204,7 +3797,6 @@ Get color multiplied with another color Get color with brightness correction, brightness factor goes from -1.0f to 1.0f -- Failure return false - Success return Color --- @@ -4213,7 +3805,6 @@ Get color with brightness correction, brightness factor goes from -1.0f to 1.0f Get color with contrast correction, contrast values between -1.0f and 1.0f -- Failure return false - Success return Color --- @@ -4222,7 +3813,6 @@ Get color with contrast correction, contrast values between -1.0f and 1.0f Returns color with alpha applied, alpha goes from 0.0f to 1.0f -- Failure return false - Success return Color --- @@ -4231,25 +3821,22 @@ Returns color with alpha applied, alpha goes from 0.0f to 1.0f Returns src alpha-blended into dst color with tint -- Failure return false - Success return Color --- -> color = RL.GetColor( unsigned int hexValue ) +> color = RL.GetColor( int hexValue ) Get Color structure from hexadecimal value -- Failure return false - Success return Color --- -> color = RL.GetPixelColor( Texture2D texture, Vector2 position ) +> color = RL.GetPixelColor( Texture texture, Vector2 position ) Get pixel color from source texture -- Failure return false - Success return Color --- @@ -4258,7 +3845,6 @@ Get pixel color from source texture Get pixel data size in bytes for certain format -- Failure return false - Success return int --- @@ -4531,13 +4117,10 @@ Draw a plane XZ --- -> success = RL.DrawQuad3DTexture( Texture2D texture, Vector3{} vertices, Vector2{} texCoords, Color{} colors ) +> RL.DrawQuad3DTexture( Texture texture, Vector3{} vertices, Vector2{} texCoords, Color{} colors ) Draw 3D textured quad. ( Texture coordinates opengl style 0.0 - 1.0 ). -- Failure return false -- Success return true - --- > success = RL.DrawRay( Ray ray, Color color ) @@ -4756,13 +4339,10 @@ Unload material from GPU memory ( VRAM ) --- -> success = RL.SetMaterialTexture( Material material, int mapType, Texture2D texture ) +> RL.SetMaterialTexture( Material material, int mapType, Texture2D texture ) Set texture for a material map type ( MATERIAL_MAP_ALBEDO, MATERIAL_MAP_METALNESS... ) -- Failure return false -- Success return true - --- > success = RL.SetMaterialColor( Material material, int mapType, Color color ) @@ -4783,13 +4363,10 @@ Set value for a material map type --- -> success = RL.SetMaterialShader( Material material, Shader shader ) +> RL.SetMaterialShader( Material material, Shader shader ) Set shader for material -- Failure return false -- Success return true - --- > success = RL.SetMaterialParams( Material material, float{} params ) @@ -4833,7 +4410,7 @@ Get color from material map type. Get material shader. Returns -1 if no shader. - Failure return false -- Success return int +- Success return Shader --- @@ -4913,31 +4490,22 @@ Set material for a mesh ( Mesh and material on this model ) --- -> success = RL.DrawBillboard( Camera3D camera, Texture2D texture, Vector3 position, float size, Color tint ) +> RL.DrawBillboard( Camera3D camera, Texture texture, Vector3 position, float size, Color tint ) Draw a billboard texture -- Failure return false -- Success return true - --- -> success = RL.DrawBillboardRec( Camera3D camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint ) +> RL.DrawBillboardRec( Camera3D camera, Texture texture, Rectangle source, Vector3 position, Vector2 size, Color tint ) Draw a billboard texture defined by source -- Failure return false -- Success return true - --- -> success = RL.DrawBillboardPro( Camera3D camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint ) +> RL.DrawBillboardPro( Camera3D camera, Texture texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint ) Draw a billboard texture defined by source and rotation -- Failure return false -- Success return true - --- > success = RL.SetModelTransform( Model model, Matrix transform ) @@ -6924,13 +6492,10 @@ Create a light and get shader locations --- -> success = RL.UpdateLightValues( Shader shader, Light light ) +> RL.UpdateLightValues( Shader shader, Light light ) Send light properties to shader -- Failure return false -- Success return true - --- > success = RL.SetLightType( Light light, int type ) @@ -7905,14 +7470,11 @@ Set eyes view offsets matrices for stereo rendering --- -> success = RL.glBlitFramebuffer( RenderTexture srcTex, RenderTexture dstTex, Rectangle srcRect, Rectangle dstRect, int mask, int filter ) +> RL.glBlitFramebuffer( RenderTexture srcTex, RenderTexture dstTex, Rectangle srcRect, Rectangle dstRect, int mask, int filter ) Copy a block of pixels from one framebuffer object to another. Use -1 RenderTexture for window framebuffer. -- Failure return false -- Success return true - --- ## Easings - Linear Easing functions diff --git a/ReiLua_API.lua b/ReiLua_API.lua index a5d5633..e6edfc7 100644 --- a/ReiLua_API.lua +++ b/ReiLua_API.lua @@ -384,11 +384,6 @@ RL.NPATCH_NINE_PATCH=0 RL.NPATCH_THREE_PATCH_VERTICAL=1 RL.NPATCH_THREE_PATCH_HORIZONTAL=2 --- Globals - TextureTypes - -RL.TEXTURE_TYPE_TEXTURE=0 -RL.TEXTURE_TYPE_RENDER_TEXTURE=1 - -- Globals - Colors RL.LIGHTGRAY={200,200,200,255} @@ -742,63 +737,53 @@ function RL.IsWindowReady() end ---@return any state function RL.IsWindowFullscreen() end ----Check if window is currently hidden ( only PLATFORM_DESKTOP ) +---Check if window is currently hidden (only PLATFORM_DESKTOP) ---- Success return bool ---@return any state function RL.IsWindowHidden() end ----Check if window is currently minimized ( only PLATFORM_DESKTOP ) +---Check if window is currently minimized (only PLATFORM_DESKTOP) ---- Success return bool ---@return any state function RL.IsWindowMinimized() end ----Check if window is currently maximized ( only PLATFORM_DESKTOP ) +---Check if window is currently maximized (only PLATFORM_DESKTOP) ---- Success return bool ---@return any state function RL.IsWindowMaximized() end ----Check if window is currently focused ( only PLATFORM_DESKTOP ) +---Check if window is currently focused (only PLATFORM_DESKTOP) ---- Success return bool ---@return any state function RL.IsWindowFocused() end ---Set monitor for the current window (fullscreen mode) ----- Failure return false ----- Success return true ---@param monitor integer ----@return any success -function RL.SetWindowMonitor( monitor ) end +---@return any RL.SetWindowMonitor +function RL.SetWindowMonitor( monitor ) end ---Set window position on screen ----- Failure return false ----- Success return true ---@param pos table ----@return any success -function RL.SetWindowPosition( pos ) end +---@return any RL.SetWindowPosition +function RL.SetWindowPosition( pos ) end ---Set window dimensions ----- Failure return false ----- Success return true ---@param size table ----@return any success -function RL.SetWindowSize( size ) end +---@return any RL.SetWindowSize +function RL.SetWindowSize( size ) end ----Set window minimum dimensions ( for FLAG_WINDOW_RESIZABLE ) ----- Failure return false ----- Success return true +---Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) ---@param size table ----@return any success -function RL.SetWindowMinSize( size ) end +---@return any RL.SetWindowMinSize +function RL.SetWindowMinSize( size ) end ---Get specified monitor position ----- Failure return nil ---- Success return Vector2 ---@param monitor integer ---@return any position function RL.GetMonitorPosition( monitor ) end ---Get specified monitor size ----- Failure return nil ---- Success return Vector2 ---@param monitor integer ---@return any size @@ -814,21 +799,18 @@ function RL.GetWindowPosition() end ---@return any size function RL.GetScreenSize() end ----Set window configuration state using flags ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... ) ----- Failure return false ----- Success return true +---Set window configuration state using flags (FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE...) ---@param flag integer ----@return any success -function RL.SetWindowState( flag ) end +---@return any RL.SetWindowState +function RL.SetWindowState( flag ) end ----Check if one specific window flag is enabled ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... ) ----- Failure return nil +---Check if one specific window flag is enabled (FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE...) ---- Success return bool ---@param flag integer ---@return any state function RL.IsWindowState( flag ) end ----Clear window configuration state flags ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... ) +---Clear window configuration state flags (FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE...) ---- Success return bool ---@param flag integer ---@return any resized @@ -839,19 +821,15 @@ function RL.ClearWindowState( flag ) end ---@return any resized function RL.IsWindowResized() end ----Set icon for window ( Only PLATFORM_DESKTOP ) ----- Failure return false ----- Success return true +---Set icon for window (Only PLATFORM_DESKTOP) ---@param image any ----@return any success -function RL.SetWindowIcon( image ) end +---@return any RL.SetWindowIcon +function RL.SetWindowIcon( image ) end ----Set title for window ( Only PLATFORM_DESKTOP ) ----- Failure return false ----- Success return true +---Set title for window (Only PLATFORM_DESKTOP) ---@param title string ----@return any success -function RL.SetWindowTitle( title ) end +---@return any RL.SetWindowTitle +function RL.SetWindowTitle( title ) end ---Get number of connected monitors ---- Success return int @@ -864,26 +842,23 @@ function RL.GetMonitorCount() end function RL.GetCurrentMonitor() end ---Get specified monitor physical size in millimetres ----- Failure return false ---- Success return Vector2 ---@param monitor integer ---@return any size function RL.GetMonitorPhysicalSize( monitor ) end ---Get specified monitor refresh rate ----- Failure return false ---- Success return int ---@param monitor integer ----@return any size +---@return any refreshRate function RL.GetMonitorRefreshRate( monitor ) end ---Get window scale DPI factor ---- Success return Vector2 ----@return any scale +---@return any dpi function RL.GetWindowScaleDPI() end ---Get the human-readable, UTF-8 encoded name of the monitor ----- Failure return false ---- Success return string ---@param monitor integer ---@return any name @@ -894,11 +869,9 @@ function RL.GetMonitorName( monitor ) end function RL.CloseWindow() end ---Set clipboard text content ----- Failure return false ----- Success return true ---@param text string ----@return any success -function RL.SetClipboardText( text ) end +---@return any RL.SetClipboardText +function RL.SetClipboardText( text ) end ---Get clipboard text content ---- Success return string @@ -907,19 +880,17 @@ function RL.GetClipboardText() end -- Core - Timing ----Set target FPS ( maximum ) ----- Failure return false ----- Success return true +---Set target FPS (maximum) ---@param fps integer ----@return any success -function RL.SetTargetFPS( fps ) end +---@return any RL.SetTargetFPS +function RL.SetTargetFPS( fps ) end ---Get current FPS ---- Success return int ---@return any FPS function RL.GetFPS() end ----Get time in seconds for last frame drawn ( Delta time ) +---Get time in seconds for last frame drawn (Delta time) ---- Success return float ---@return any delta function RL.GetFrameTime() end @@ -931,53 +902,48 @@ function RL.GetTime() end -- Core - Misc ----Takes a screenshot of current screen ( filename extension defines format ) ----- Failure return false ----- Success return true +---Takes a screenshot of current screen (filename extension defines format) ---@param fileName string ----@return any success -function RL.TakeScreenshot( fileName ) end +---@return any RL.TakeScreenshot +function RL.TakeScreenshot( fileName ) end ----Setup init configuration flags ( view FLAGS ) ----- Failure return false ----- Success return true +---Setup init configuration flags (view FLAGS) ---@param flags integer ----@return any success -function RL.SetConfigFlags( flags ) end +---@return any RL.SetConfigFlags +function RL.SetConfigFlags( flags ) end ----Show trace log messages ( LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR... ) ----- Failure return false ----- Success return true +---Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) ---@param logLevel integer ---@param text string ----@return any success -function RL.TraceLog( logLevel, text ) end +---@return any RL.TraceLog +function RL.TraceLog( logLevel, text ) end ----Set the current threshold ( minimum ) log level ----- Failure return false ----- Success return true +---Set the current threshold (minimum) log level ---@param logLevel integer ----@return any success -function RL.SetTraceLogLevel( logLevel ) end +---@return any RL.SetTraceLogLevel +function RL.SetTraceLogLevel( logLevel ) end ---Set the log level for bad function calls and invalid data formats. ----- Failure return false ----- Success return true ---@param logLevel integer ----@return any success -function RL.SetLogLevelInvalid( logLevel ) end +---@return any RL.SetLogLevelInvalid +function RL.SetLogLevelInvalid( logLevel ) end ---Get the log level for bad function calls and invalid data formats. ---- Success return int ---@return any logLevel function RL.GetLogLevelInvalid() end ----Open URL with default system browser ( If available ) ----- Failure return false ----- Success return true +---Open URL with default system browser (If available) ---@param url string ----@return any success -function RL.OpenURL( url ) end +---@return any RL.OpenURL +function RL.OpenURL( url ) end + +---Creates buffer as userdata. Type should be one of the Buffer types +---- Success return Buffer +---@param buffer any +---@param type integer +---@return any buffer +function RL.LoadBuffer( buffer, type ) end -- Core - Cursor @@ -1009,38 +975,32 @@ function RL.IsCursorOnScreen() end -- Core - Drawing ----Set background color ( framebuffer clear color ) ----- Failure return false ----- Success return true +---Set background color (framebuffer clear color) ---@param color table ----@return any success -function RL.ClearBackground( color ) end +---@return any RL.ClearBackground +function RL.ClearBackground( color ) end ----Setup canvas ( framebuffer ) to start drawing +---Setup canvas (framebuffer) to start drawing ---@return any RL.BeginDrawing function RL.BeginDrawing() end ----End canvas drawing and swap buffers ( double buffering ) +---End canvas drawing and swap buffers (double buffering) ---@return any RL.EndDrawing function RL.EndDrawing() end ----Begin blending mode ( BLEND_ALPHA, BLEND_ADDITIVE, BLEND_MULTIPLIED... ) ----- Failure return false ----- Success return true +---Begin blending mode (BLEND_ALPHA, BLEND_ADDITIVE, BLEND_MULTIPLIED...) ---@param mode integer ----@return any success -function RL.BeginBlendMode( mode ) end +---@return any RL.BeginBlendMode +function RL.BeginBlendMode( mode ) end ----End blending mode ( reset to default: BLEND_ALPHA ) +---End blending mode (reset to default: BLEND_ALPHA) ---@return any RL.EndBlendMode function RL.EndBlendMode() end ----Begin scissor mode ( define screen area for following drawing ) ----- Failure return false ----- Success return true +---Begin scissor mode (define screen area for following drawing) ---@param rectange table ----@return any success -function RL.BeginScissorMode( rectange ) end +---@return any RL.BeginScissorMode +function RL.BeginScissorMode( rectange ) end ---End scissor mode ---@return any RL.EndScissorMode @@ -1050,8 +1010,8 @@ function RL.EndScissorMode() end ---Load shader from files and bind default locations. ---NOTE: Set nil if no shader ----- Failure return -1 ----- Success return int +---- Failure return nil +---- Success return Shader ---@param vsFileName string ---@param fsFileName string ---@return any shader @@ -1059,26 +1019,23 @@ function RL.LoadShader( vsFileName, fsFileName ) end ---Load shader from code strings and bind default locations ---NOTE: Set nil if no shader ----- Failure return -1 ----- Success return int +---- Failure return nil +---- Success return Shader ---@param vsCode string ---@param fsCode string ---@return any shader function RL.LoadShaderFromMemory( vsCode, fsCode ) end ---Begin custom shader drawing ----- Failure return false ----- Success return true ---@param shader any ----@return any success -function RL.BeginShaderMode( shader ) end +---@return any RL.BeginShaderMode +function RL.BeginShaderMode( shader ) end ----End custom shader drawing ( use default shader ) +---End custom shader drawing (use default shader) ---@return any RL.EndShaderMode function RL.EndShaderMode() end ---Get shader uniform location ----- Failure return -1 ---- Success return int ---@param shader any ---@param uniformName string @@ -1086,7 +1043,6 @@ function RL.EndShaderMode() end function RL.GetShaderLocation( shader, uniformName ) end ---Get shader attribute location ----- Failure return -1 ---- Success return int ---@param shader any ---@param attribName string @@ -1094,95 +1050,73 @@ function RL.GetShaderLocation( shader, uniformName ) end function RL.GetShaderLocationAttrib( shader, attribName ) end ---Set shader location index ----- Failure return false ----- Success return true ---@param shader any ---@param shaderLocationIndex integer ---@param location integer ----@return any success -function RL.SetShaderLocationIndex( shader, shaderLocationIndex, location ) end +---@return any RL.SetShaderLocationIndex +function RL.SetShaderLocationIndex( shader, shaderLocationIndex, location ) end ---Get shader location index ----- Failure return false ---- Success return int ---@param shader any ---@param shaderLocationIndex integer ---@return any location function RL.GetShaderLocationIndex( shader, shaderLocationIndex ) end ----Set shader uniform value ( matrix 4x4 ) ----- Failure return false ----- Success return true +---Set shader uniform value (matrix 4x4) ---@param shader any ---@param locIndex integer ---@param mat table ----@return any success -function RL.SetShaderValueMatrix( shader, locIndex, mat ) end +---@return any RL.SetShaderValueMatrix +function RL.SetShaderValueMatrix( shader, locIndex, mat ) end ----Set shader uniform value for texture ( sampler2d ) ----- Failure return false ----- Success return true +---Set shader uniform value for texture (sampler2d) ---@param shader any ---@param locIndex integer ---@param texture any ----@return any success -function RL.SetShaderValueTexture( shader, locIndex, texture ) end +---@return any RL.SetShaderValueTexture +function RL.SetShaderValueTexture( shader, locIndex, texture ) end ---Set shader uniform value ---NOTE: Even one value should be in table ----- Failure return false ----- Success return true ---@param shader any ---@param locIndex integer ---@param values any ---@param uniformType integer ----@return any success -function RL.SetShaderValue( shader, locIndex, values, uniformType ) end +---@return any RL.SetShaderValue +function RL.SetShaderValue( shader, locIndex, values, uniformType ) end ---Set shader uniform value vector ---NOTE: Even one value should be in table ----- Failure return false ----- Success return true ---@param shader any ---@param locIndex integer ---@param values any ---@param uniformType integer ---@param count integer ----@return any success -function RL.SetShaderValueV( shader, locIndex, values, uniformType, count ) end - ----Unload shader from GPU memory ( VRAM ) ----- Failure return false ----- Success return true ----@param shader any ----@return any success -function RL.UnloadShader( shader ) end +---@return any RL.SetShaderValueV +function RL.SetShaderValueV( shader, locIndex, values, uniformType, count ) end -- Core - Input-related Keyboard ---Detect if a key has been pressed once ----- Failure return nil ---- Success return bool ---@param key integer ---@return any pressed function RL.IsKeyPressed( key ) end ---Detect if a key is being pressed ----- Failure return nil ---- Success return bool ---@param key integer ---@return any pressed function RL.IsKeyDown( key ) end ---Detect if a key has been released once ----- Failure return nil ---- Success return bool ---@param key integer ---@return any released function RL.IsKeyReleased( key ) end ---Check if a key is NOT being pressed ----- Failure return nil ---- Success return bool ---@param key integer ---@return any released @@ -1198,7 +1132,7 @@ function RL.GetKeyPressed() end ---@return any unicode function RL.GetCharPressed() end ----Set a custom key to exit program ( default is ESC ) +---Set a custom key to exit program (default is ESC) ---@param key integer ---@return any RL.SetExitKey function RL.SetExitKey( key ) end @@ -1213,7 +1147,6 @@ function RL.SetExitKey( key ) end ---otherwise the scancode is ignored. If you specify a non-printable key, ---or KEY_UNKNOWN and a scancode that maps to a non-printable key, ---this function returns nil but does not emit an error. ----- Failure return -1 ---- Success return string or nil ---@param key integer ---@param scancode integer @@ -1222,7 +1155,6 @@ function RL.GetKeyName( key, scancode ) end ---This function returns the platform-specific scancode of the specified key. ---If the key is KEY_UNKNOWN or does not exist on the keyboard this method will return -1. ----- Failure return nil ---- Success return int ---@param key integer ---@return any scancode @@ -1231,14 +1163,12 @@ function RL.GetKeyScancode( key ) end -- Core - Input-related Gamepad ---Detect if a gamepad is available ----- Failure return nil ---- Success return bool ---@param gamepad integer ---@return any available function RL.IsGamepadAvailable( gamepad ) end ---Detect if a gamepad button has been pressed once ----- Failure return nil ---- Success return bool ---@param gamepad integer ---@param button integer @@ -1246,7 +1176,6 @@ function RL.IsGamepadAvailable( gamepad ) end function RL.IsGamepadButtonPressed( gamepad, button ) end ---Detect if a gamepad button is being pressed ----- Failure return nil ---- Success return bool ---@param gamepad integer ---@param button integer @@ -1254,7 +1183,6 @@ function RL.IsGamepadButtonPressed( gamepad, button ) end function RL.IsGamepadButtonDown( gamepad, button ) end ---Detect if a gamepad button has been released once ----- Failure return nil ---- Success return bool ---@param gamepad integer ---@param button integer @@ -1262,14 +1190,12 @@ function RL.IsGamepadButtonDown( gamepad, button ) end function RL.IsGamepadButtonReleased( gamepad, button ) end ---Return gamepad axis count for a gamepad ----- Failure return false ---- Success return int ---@param gamepad integer ---@return any count function RL.GetGamepadAxisCount( gamepad ) end ---Return axis movement value for a gamepad axis ----- Failure return false ---- Success return float ---@param gamepad integer ---@param axis integer @@ -1277,7 +1203,6 @@ function RL.GetGamepadAxisCount( gamepad ) end function RL.GetGamepadAxisMovement( gamepad, axis ) end ---Return gamepad internal name id ----- Failure return false ---- Success return string ---@param gamepad integer ---@return any name @@ -1286,28 +1211,24 @@ function RL.GetGamepadName( gamepad ) end -- Core - Input-related Mouse ---Detect if a mouse button has been pressed once ----- Failure return nil ---- Success return bool ---@param button integer ---@return any pressed function RL.IsMouseButtonPressed( button ) end ---Detect if a mouse button is being pressed ----- Failure return nil ---- Success return bool ---@param button integer ---@return any pressed function RL.IsMouseButtonDown( button ) end ---Detect if a mouse button has been released once ----- Failure return nil ---- Success return bool ---@param button integer ---@return any released function RL.IsMouseButtonReleased( button ) end ---Check if a mouse button is NOT being pressed ----- Failure return nil ---- Success return bool ---@param button integer ---@return any released @@ -1324,25 +1245,19 @@ function RL.GetMousePosition() end function RL.GetMouseDelta() end ---Set mouse position XY ----- Failure return false ----- Success return true ---@param position table ----@return any success -function RL.SetMousePosition( position ) end +---@return any RL.SetMousePosition +function RL.SetMousePosition( position ) end ---Set mouse offset ----- Failure return false ----- Success return true ---@param offset table ----@return any success -function RL.SetMouseOffset( offset ) end +---@return any RL.SetMouseOffset +function RL.SetMouseOffset( offset ) end ---Set mouse scaling ----- Failure return false ----- Success return true ---@param scale table ----@return any success -function RL.SetMouseScale( scale ) end +---@return any RL.SetMouseScale +function RL.SetMouseScale( scale ) end ---Returns mouse wheel movement Y ---- Success return float @@ -1350,23 +1265,19 @@ function RL.SetMouseScale( scale ) end function RL.GetMouseWheelMove() end ---Set mouse cursor ----- Failure return false ----- Success return true ---@param cursor integer ----@return any success -function RL.SetMouseCursor( cursor ) end +---@return any RL.SetMouseCursor +function RL.SetMouseCursor( cursor ) end -- Core - Input-related Touch ----Get touch position XY for a touch point index ( relative to screen size ) ----- Failure return false +---Get touch position XY for a touch point index (relative to screen size) ---- Success return Vector2 ---@param index integer ---@return any position function RL.GetTouchPosition( index ) end ---Get touch point identifier for given index ----- Failure return false ---- Success return int ---@param index integer ---@return any id @@ -1380,14 +1291,11 @@ function RL.GetTouchPointCount() end -- Core - Input-related Gestures ---Enable a set of gestures using flags ----- Failure return false ----- Success return true ---@param int any ----@return any success -function RL.SetGesturesEnabled( int ) end +---@return any RL.SetGesturesEnabled +function RL.SetGesturesEnabled( int ) end ---Check if a gesture have been detected ----- Failure return nil ---- Success return bool ---@param gesture integer ---@return any detected @@ -1425,89 +1333,78 @@ function RL.GetGesturePinchAngle() end -- Core - File ----Return game directory ( where main.lua is located ) +---Return game directory (where main.lua is located) ---- Success return string ---@return any path function RL.GetBasePath() end ---Check if file exists ----- Failure return nil ---- Success return bool ---@param fileName string ---@return any fileExists function RL.FileExists( fileName ) end ---Check if a directory path exists ----- Failure return nil ---- Success return bool ---@param dirPath string ---@return any dirExists function RL.DirectoryExists( dirPath ) end ----Check file extension ( Including point: .png, .wav ) ----- Failure return nil +---Check file extension (Including point: .png, .wav) ---- Success return bool ---@param fileName string ---@param ext string ---@return any hasFileExtension function RL.IsFileExtension( fileName, ext ) end ----Get file length in bytes ( NOTE: GetFileSize() conflicts with windows.h ) ----- Failure return false +---Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) ---- Success return int ---@param fileName string ---@return any length function RL.GetFileLength( fileName ) end ----Get pointer to extension for a filename string ( Includes dot: '.png' ) ----- Failure return false +---Get pointer to extension for a filename string (Includes dot: '.png') ---- Success return string ---@param fileName string ---@return any extension function RL.GetFileExtension( fileName ) end ---Get pointer to filename for a path string ----- Failure return false ---- Success return string ---@param filePath string ----@return any filePath +---@return any fileName function RL.GetFileName( filePath ) end ----Get filename string without extension ( Uses static string ) ----- Failure return false +---Get filename string without extension (Uses static string) ---- Success return string ---@param filePath string ----@return any filePath +---@return any fileName function RL.GetFileNameWithoutExt( filePath ) end ----Get full path for a given fileName with path ( Uses static string ) ----- Failure return false +---Get full path for a given fileName with path (Uses static string) ---- Success return string ---@param filePath string ---@return any filePath function RL.GetDirectoryPath( filePath ) end ----Get previous directory path for a given path ( Uses static string ) ----- Failure return false +---Get previous directory path for a given path (Uses static string) ---- Success return string ---@param dirPath string ---@return any directory function RL.GetPrevDirectoryPath( dirPath ) end ----Get current working directory ( Uses static string ) +---Get current working directory (Uses static string) ---- Success return string ---@return any directory function RL.GetWorkingDirectory() end ---Load directory filepaths ----- Failure return false ---- Success return string{} ---@param dirPath string ---@return any fileNames function RL.LoadDirectoryFiles( dirPath ) end ---Load directory filepaths with extension filtering and recursive directory scan ----- Failure return false ---- Success return string{} ---@param basePath string ---@param filter string @@ -1516,14 +1413,12 @@ function RL.LoadDirectoryFiles( dirPath ) end function RL.LoadDirectoryFilesEx( basePath, filter, scanSubdirs ) end ---Change working directory, return true on success ----- Failure return false ----- Success return true +---- 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 ----- Failure return nil ---- Success return bool ---@param path string ---@return any isFile @@ -1531,7 +1426,7 @@ function RL.IsPathFile( path ) end ---Check if a file has been dropped into window ---- Success return bool ----@return any fileDropped +---@return any iSFileDropped function RL.IsFileDropped() end ---Load dropped filepaths @@ -1539,8 +1434,7 @@ function RL.IsFileDropped() end ---@return any files function RL.LoadDroppedFiles() end ----Get file modification time ( Last write time ) ----- Failure return false +---Get file modification time (Last write time) ---- Success return int ---@param fileName string ---@return any time @@ -1548,84 +1442,63 @@ function RL.GetFileModTime( fileName ) end -- Core - Camera2D ----Return camera2D id set to default configuration ----- Success return int +---Return camera2D set to default configuration +---- Success return Camera2D ---@return any camera2D function RL.CreateCamera2D() end ----Unload Camera2D ----- Failure return false ----- Success return true ----@param camera any ----@return any success -function RL.UnloadCamera2D( camera ) end - ----Begin 2D mode with custom camera ( 2D ) ----- Failure return false ----- Success return true +---Begin 2D mode with custom camera (2D) ---@param camera any ----@return any success -function RL.BeginMode2D( camera ) end +---@return any RL.BeginMode2D +function RL.BeginMode2D( camera ) end ---Ends 2D mode with custom camera ---@return any RL.EndMode2D function RL.EndMode2D() end ----Set camera target ( rotation and zoom origin ) ----- Failure return false ----- Success return true +---Set camera target (rotation and zoom origin) ---@param camera any ---@param target table ----@return any success -function RL.SetCamera2DTarget( camera, target ) end +---@return any RL.SetCamera2DTarget +function RL.SetCamera2DTarget( camera, target ) end ----Set camera offset ( displacement from target ) ----- Failure return false ----- Success return true +---Set camera offset (displacement from target) ---@param camera any ---@param offset table ----@return any success -function RL.SetCamera2DOffset( camera, offset ) end +---@return any RL.SetCamera2DOffset +function RL.SetCamera2DOffset( camera, offset ) end ---Set camera rotation in degrees ----- Failure return false ----- Success return true ---@param camera any ---@param rotation number ----@return any success -function RL.SetCamera2DRotation( camera, rotation ) end +---@return any RL.SetCamera2DRotation +function RL.SetCamera2DRotation( camera, rotation ) end ----Set camera zoom ( scaling ), should be 1.0f by default ----- Failure return false ----- Success return true +---Set camera zoom (scaling), should be 1.0f by default ---@param camera any ---@param zoom number ----@return any success -function RL.SetCamera2DZoom( camera, zoom ) end +---@return any RL.SetCamera2DZoom +function RL.SetCamera2DZoom( camera, zoom ) end ---Get camera2D target ----- Failure return nil ---- Success return Vector2 ---@param camera any ---@return any target function RL.GetCamera2DTarget( camera ) end ---Get camera2D offset ----- Failure return nil ---- Success return Vector2 ---@param camera any ---@return any offset function RL.GetCamera2DOffset( camera ) end ---Get camera2D rotation ----- Failure return nil ---- Success return float ---@param camera any ---@return any rotation function RL.GetCamera2DRotation( camera ) end ---Get camera2D zoom ----- Failure return nil ---- Success return float ---@param camera any ---@return any zoom @@ -1638,201 +1511,158 @@ function RL.GetCamera2DZoom( camera ) end ---@return any camera function RL.CreateCamera3D() end ----Unload Camera3D ----- Failure return false ----- Success return true ----@param Camera3D integer ----@return any success -function RL.UnloadCamera3D( Camera3D ) end - ----Begin 3D mode with custom camera ( 3D ) ----- Failure return false ----- Success return true +---Begin 3D mode with custom camera (3D) ---@param camera any ----@return any success -function RL.BeginMode3D( camera ) end +---@return any RL.BeginMode3D +function RL.BeginMode3D( camera ) end ---Ends 3D mode and returns to default 2D orthographic mode ---@return any RL.EndMode3D function RL.EndMode3D() end ----Set camera position ( Remember to call "RL.UpdateCamera3D()" to apply changes ) ----- Failure return false ----- Success return true +---Set camera position (Remember to call "RL.UpdateCamera3D()" to apply changes) ---@param camera any ---@param position table ----@return any success -function RL.SetCamera3DPosition( camera, position ) end +---@return any RL.SetCamera3DPosition +function RL.SetCamera3DPosition( camera, position ) end ---Set camera target it looks-at ----- Failure return false ----- Success return true ---@param camera any ---@param target table ----@return any success -function RL.SetCamera3DTarget( camera, target ) end +---@return any RL.SetCamera3DTarget +function RL.SetCamera3DTarget( camera, target ) end ----Set camera up vector ( Rotation over it's axis ) ----- Failure return false ----- Success return true +---Set camera up vector (Rotation over it's axis) ---@param camera any ---@param up table ----@return any success -function RL.SetCamera3DUp( camera, up ) end +---@return any RL.SetCamera3DUp +function RL.SetCamera3DUp( camera, up ) end ----Set camera field-of-view apperture in Y ( degrees ) in perspective, used as near plane width in orthographic ----- Failure return false ----- Success return true +---Set camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic ---@param camera any ---@param fovy number ----@return any success -function RL.SetCamera3DFovy( camera, fovy ) end +---@return any RL.SetCamera3DFovy +function RL.SetCamera3DFovy( camera, fovy ) end ----Set camera projection mode ( CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC ) ----- Failure return false ----- Success return true +---Set camera projection mode (CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC) ---@param camera any ---@param projection integer ----@return any success -function RL.SetCamera3DProjection( camera, projection ) end +---@return any RL.SetCamera3DProjection +function RL.SetCamera3DProjection( camera, projection ) end ---Get camera position ----- Failure return nil ---- Success return Vector3 ---@param camera any ---@return any position function RL.GetCamera3DPosition( camera ) end ---Get camera target it looks-at ----- Failure return nil ---- Success return Vector3 ---@param camera any ---@return any target function RL.GetCamera3DTarget( camera ) end ----Get camera up vector ( Rotation over it's axis ) ----- Failure return nil +---Get camera up vector (Rotation over it's axis) ---- Success return Vector3 ---@param camera any ---@return any up function RL.GetCamera3DUp( camera ) end ----Get camera field-of-view apperture in Y ( degrees ) in perspective, used as near plane width in orthographic ----- Failure return nil +---Get camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic ---- Success return float ---@param camera any ---@return any fovy function RL.GetCamera3DFovy( camera ) end ---Get camera projection mode ----- Failure return nil ---- Success return int ---@param camera any ---@return any projection function RL.GetCamera3DProjection( camera ) end ----Returns the cameras forward vector ( normalized ) ----- Failure return nil +---Returns the cameras forward vector (normalized) ---- Success return Vector3 ---@param camera any ---@return any forward function RL.GetCamera3DForward( camera ) end ----Returns the cameras up vector ( normalized ) +---Returns the cameras up vector (normalized) ---Note: The up vector might not be perpendicular to the forward vector ----- Failure return nil ---- Success return Vector3 ---@param camera any ---@return any up function RL.GetCamera3DUpNormalized( camera ) end ----Returns the cameras right vector ( normalized ) ----- Failure return nil +---Returns the cameras right vector (normalized) ---- Success return Vector3 ---@param camera any ---@return any right function RL.GetCamera3DRight( camera ) end ---Moves the camera in it's forward direction ----- Failure return false ----- Success return true ---@param camera any ---@param distance number ---@param moveInWorldPlane boolean ----@return any success -function RL.Camera3DMoveForward( camera, distance, moveInWorldPlane ) end +---@return any RL.Camera3DMoveForward +function RL.Camera3DMoveForward( camera, distance, moveInWorldPlane ) end ---Moves the camera in it's up direction ----- Failure return false ----- Success return true ---@param camera any ---@param distance number ----@return any success -function RL.Camera3DMoveUp( camera, distance ) end +---@return any RL.Camera3DMoveUp +function RL.Camera3DMoveUp( camera, distance ) end ---Moves the camera target in it's current right direction ----- Failure return false ----- Success return true ---@param camera any ---@param distance number ---@param moveInWorldPlane boolean ----@return any success -function RL.Camera3DMoveRight( camera, distance, moveInWorldPlane ) end +---@return any RL.Camera3DMoveRight +function RL.Camera3DMoveRight( camera, distance, moveInWorldPlane ) end ---Moves the camera position closer/farther to/from the camera target ----- Failure return false ----- Success return true ---@param camera any ---@param delta number ----@return any success -function RL.Camera3DMoveToTarget( camera, delta ) end +---@return any RL.Camera3DMoveToTarget +function RL.Camera3DMoveToTarget( camera, delta ) end ---Rotates the camera around it's up vector ---Yaw is "looking left and right" ---If rotateAroundTarget is false, the camera rotates around it's position ---Note: angle must be provided in radians ----- Failure return false ----- Success return true ---@param camera any ---@param angle number ---@param rotateAroundTarget boolean ----@return any success -function RL.Camera3DYaw( camera, angle, rotateAroundTarget ) end +---@return any RL.Camera3DYaw +function RL.Camera3DYaw( camera, angle, rotateAroundTarget ) end ---Rotates the camera around it's right vector, pitch is "looking up and down" --- - lockView prevents camera overrotation (aka "somersaults") --- - rotateAroundTarget defines if rotation is around target or around it's position --- - rotateUp rotates the up direction as well (typically only usefull in CAMERA_FREE) ---NOTE: angle must be provided in radians ----- Failure return false ----- Success return true ---@param camera any ---@param angle number ---@param lockView boolean ---@param rotateAroundTarget boolean ---@param rotateUp boolean ----@return any success -function RL.Camera3DPitch( camera, angle, lockView, rotateAroundTarget, rotateUp ) end +---@return any RL.Camera3DPitch +function RL.Camera3DPitch( camera, angle, lockView, rotateAroundTarget, rotateUp ) end ---Rotates the camera around it's forward vector ---Roll is "turning your head sideways to the left or right" ---Note: angle must be provided in radians ----- Failure return false ----- Success return true ---@param camera any ---@param angle number ----@return any success -function RL.Camera3DRoll( camera, angle ) end +---@return any RL.Camera3DRoll +function RL.Camera3DRoll( camera, angle ) end ---Returns the camera view matrix ----- Failure return false ---- Success return Matrix ---@param camera any ---@return any view function RL.GetCamera3DViewMatrix( camera ) end ---Returns the camera projection matrix ----- Failure return false ---- Success return Matrix ---@param camera any ---@param aspect number @@ -1840,49 +1670,41 @@ function RL.GetCamera3DViewMatrix( camera ) end function RL.GetCamera3DProjectionMatrix( camera, aspect ) end ---Update camera position for selected mode ----- Failure return false ----- Success return true ---@param camera any ---@param mode integer ----@return any success -function RL.UpdateCamera3D( camera, mode ) end +---@return any RL.UpdateCamera3D +function RL.UpdateCamera3D( camera, mode ) end ---Update camera movement, movement/rotation values should be provided by user ----- Failure return false ----- Success return true ---@param camera any ---@param movement table ---@param rotation table ---@param zoom number ----@return any success -function RL.UpdateCamera3DPro( camera, movement, rotation, zoom ) end +---@return any RL.UpdateCamera3DPro +function RL.UpdateCamera3DPro( camera, movement, rotation, zoom ) end -- Core - Screen-space ---Get a ray trace from mouse position ----- Failure return false ---- Success return Ray ---@param mousePosition table ---@param camera any ---@return any ray function RL.GetMouseRay( mousePosition, camera ) end ----Get camera transform matrix ( view matrix ) ----- Failure return false +---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 ----- Failure return false ---- Success return Matrix ---@param camera any ---@return any matrix function RL.GetCameraMatrix2D( camera ) end ---Get the screen space position for a 3d world space position ----- Failure return false ---- Success return Vector2 ---@param position table ---@param camera any @@ -1890,7 +1712,6 @@ function RL.GetCameraMatrix2D( camera ) end function RL.GetWorldToScreen( position, camera ) end ---Get size position for a 3d world space position ----- Failure return false ---- Success return Vector2 ---@param position table ---@param camera any @@ -1899,7 +1720,6 @@ function RL.GetWorldToScreen( position, camera ) end function RL.GetWorldToScreenEx( position, camera, size ) end ---Get the screen space position for a 2d camera world space position ----- Failure return false ---- Success return Vector2 ---@param position table ---@param camera any @@ -1907,32 +1727,21 @@ function RL.GetWorldToScreenEx( position, camera, size ) end function RL.GetWorldToScreen2D( position, camera ) end ---Get the world space position for a 2d camera screen space position ----- Failure return false ---- Success return Vector2 ---@param position table ---@param camera any ---@return any position function RL.GetScreenToWorld2D( position, camera ) end ----Creates buffer as userdata. Type should be one of the Buffer types ----- Failure return false ----- Success return Buffer ----@param buffer any ----@param type integer ----@return any buffer -function RL.LoadBuffer( buffer, type ) end - -- Shapes - Drawing ---Set texture and rectangle to be used on shapes drawing ---NOTE: It can be useful when using basic shapes and one single font, ---defining a font char white rectangle would allow drawing everything in a single draw call ----- Failure return false ----- Success return true ---@param texture any ---@param source table ----@return any success -function RL.SetShapesTexture( texture, source ) end +---@return any RL.SetShapesTexture +function RL.SetShapesTexture( texture, source ) end ---Draw a pixel ---- Failure return false @@ -2341,34 +2150,24 @@ function RL.GetCollisionRec( rec1, rec2 ) end -- Textures - Image Loading ----Load image from file into CPU memory ( RAM ) ----- Failure return -1 ----- Success return int +---Load image from file into CPU memory (RAM) +---- Success return Image ---@param fileName string ---@return any image function RL.LoadImage( fileName ) end ---Load image from GPU texture data ----- Failure return -1 ----- Success return int +---- Success return Image ---@param texture any ---@return any image function RL.LoadImageFromTexture( texture ) end ----Load image from screen buffer and ( screenshot ) ----- Success return int +---Load image from screen buffer and (screenshot) +---- Success return Image ---@return any image function RL.LoadImageFromScreen() end ----Unload image from CPU memory ( RAM ) ----- Failure return false ----- Success return true ----@param image any ----@return any success -function RL.UnloadImage( image ) end - ---Export image data to file, returns true on success ----- Failure return nil ---- Success return bool ---@param image any ---@param fileName string @@ -2376,7 +2175,6 @@ function RL.UnloadImage( image ) end function RL.ExportImage( image, fileName ) end ---Export image as code file defining an array of bytes, returns true on success ----- Failure return nil ---- Success return bool ---@param image any ---@param fileName string @@ -2386,17 +2184,14 @@ function RL.ExportImageAsCode( image, fileName ) end -- Textures - Image Generation ---Generate image: plain color ----- Failure return -1 ----- Success return int ----@param width integer ----@param height integer +---- Success return Image +---@param size table ---@param color table ---@return any image -function RL.GenImageColor( width, height, color ) end +function RL.GenImageColor( size, color ) end ---Generate image: vertical gradient ----- Failure return -1 ----- Success return int +---- Success return Image ---@param size table ---@param top table ---@param bottom table @@ -2404,8 +2199,7 @@ function RL.GenImageColor( width, height, color ) end function RL.GenImageGradientV( size, top, bottom ) end ---Generate image: horizontal gradient ----- Failure return -1 ----- Success return int +---- Success return Image ---@param size table ---@param left table ---@param right table @@ -2413,8 +2207,7 @@ function RL.GenImageGradientV( size, top, bottom ) end function RL.GenImageGradientH( size, left, right ) end ---Generate image: radial gradient ----- Failure return -1 ----- Success return int +---- Success return Image ---@param size table ---@param density number ---@param inner table @@ -2423,8 +2216,7 @@ function RL.GenImageGradientH( size, left, right ) end function RL.GenImageGradientRadial( size, density, inner, outer ) end ---Generate image: checked ----- Failure return -1 ----- Success return int +---- Success return Image ---@param size table ---@param checks table ---@param col1 table @@ -2433,16 +2225,14 @@ function RL.GenImageGradientRadial( size, density, inner, outer ) end function RL.GenImageChecked( size, checks, col1, col2 ) end ---Generate image: white noise ----- Failure return -1 ----- Success return int +---- Success return Image ---@param size table ---@param factor number ---@return any image function RL.GenImageWhiteNoise( size, factor ) end ---Generate image: perlin noise ----- Failure return -1 ----- Success return int +---- Success return Image ---@param size table ---@param offset table ---@param factor number @@ -2450,16 +2240,14 @@ function RL.GenImageWhiteNoise( size, factor ) end function RL.GenImagePerlinNoise( size, offset, factor ) end ---Generate image: cellular algorithm. Bigger tileSize means bigger cells ----- Failure return -1 ----- Success return int +---- Success return Image ---@param size table ---@param tileSize integer ---@return any image function RL.GenImageCellular( size, tileSize ) end ---Generate image: grayscale image from text data ----- Failure return -1 ----- Success return int +---- Success return Image ---@param size table ---@param text string ---@return any image @@ -2467,22 +2255,20 @@ function RL.GenImageText( size, text ) end -- Textures - Image Manipulation Functions ----Create an image duplicate ( useful for transformations ) ----- Failure return -1 ----- Success return int +---Create an image duplicate (useful for transformations) +---- Success return Image ---@param image any ---@return any image function RL.ImageCopy( image ) end ---Create an image from another image piece ----- Failure return -1 ----- Success return int +---- Success return Image ---@param image any ---@param rec table ---@return any image function RL.ImageFromImage( image, rec ) end ----Create an image from text ( custom sprite font ) +---Create an image from text (custom sprite font) ---- Failure return -1 ---- Success return int ---@param font any @@ -2494,194 +2280,146 @@ function RL.ImageFromImage( image, rec ) end function RL.ImageText( font, text, fontSize, spacing, tint ) end ---Convert image data to desired format ----- Failure return false ----- Success return true ---@param image any ---@param newFormat integer ----@return any success -function RL.ImageFormat( image, newFormat ) end +---@return any RL.ImageFormat +function RL.ImageFormat( image, newFormat ) end ----Convert image to POT ( power-of-two ) ----- Failure return false ----- Success return true +---Convert image to POT (power-of-two) ---@param image any ---@param fill table ----@return any success -function RL.ImageToPOT( image, fill ) end +---@return any RL.ImageToPOT +function RL.ImageToPOT( image, fill ) end ---Crop an image to a defined rectangle ----- Failure return false ----- Success return true ---@param image any ---@param crop table ----@return any success -function RL.ImageCrop( image, crop ) end +---@return any RL.ImageCrop +function RL.ImageCrop( image, crop ) end ---Crop image depending on alpha value ----- Failure return false ----- Success return true ---@param image any ---@param threshold number ----@return any success -function RL.ImageAlphaCrop( image, threshold ) end +---@return any RL.ImageAlphaCrop +function RL.ImageAlphaCrop( image, threshold ) end ---Clear alpha channel to desired color ----- Failure return false ----- Success return true ---@param image any ---@param color table ---@param threshold number ----@return any success -function RL.ImageAlphaClear( image, color, threshold ) end +---@return any RL.ImageAlphaClear +function RL.ImageAlphaClear( image, color, threshold ) end ---Apply alpha mask to image ----- Failure return false ----- Success return true ---@param image any ---@param alphaMask any ----@return any success -function RL.ImageAlphaMask( image, alphaMask ) end +---@return any RL.ImageAlphaMask +function RL.ImageAlphaMask( image, alphaMask ) end ---Premultiply alpha channel ----- Failure return false ----- Success return true ---@param image any ----@return any success -function RL.ImageAlphaPremultiply( image ) end +---@return any RL.ImageAlphaPremultiply +function RL.ImageAlphaPremultiply( image ) end ---Apply Gaussian blur using a box blur approximation ----- Failure return false ----- Success return true ---@param image any ---@param blurSize integer ----@return any success -function RL.ImageBlurGaussian( image, blurSize ) end +---@return any RL.ImageBlurGaussian +function RL.ImageBlurGaussian( image, blurSize ) end ----Resize image ( Bicubic scaling algorithm ) ----- Failure return false ----- Success return true +---Resize image (Bicubic scaling algorithm) ---@param image any ---@param size table ----@return any success -function RL.ImageResize( image, size ) end +---@return any RL.ImageResize +function RL.ImageResize( image, size ) end ----Resize image ( Nearest-Neighbor scaling algorithm ) ----- Failure return false ----- Success return true +---Resize image (Nearest-Neighbor scaling algorithm) ---@param image any ---@param size table ----@return any success -function RL.ImageResizeNN( image, size ) end +---@return any RL.ImageResizeNN +function RL.ImageResizeNN( image, size ) end ---Resize canvas and fill with color ----- Failure return false ----- Success return true ---@param image any ---@param size table ---@param offset table ---@param fill table ----@return any success -function RL.ImageResizeCanvas( image, size, offset, fill ) end +---@return any RL.ImageResizeCanvas +function RL.ImageResizeCanvas( image, size, offset, fill ) end ---Generate all mipmap levels for a provided image ----- Failure return false ----- Success return true ---@param image any ----@return any success -function RL.ImageMipmaps( image ) end +---@return any RL.ImageMipmaps +function RL.ImageMipmaps( image ) end ----Dither image data to 16bpp or lower ( Floyd-Steinberg dithering ) ----- Failure return false ----- Success return true +---Dither image data to 16bpp or lower (Floyd-Steinberg dithering) ---@param image any ---@param bpp table ----@return any success -function RL.ImageDither( image, bpp ) end +---@return any RL.ImageDither +function RL.ImageDither( image, bpp ) end ---Flip image vertically ----- Failure return false ----- Success return true ---@param image any ----@return any success -function RL.ImageFlipVertical( image ) end +---@return any RL.ImageFlipVertical +function RL.ImageFlipVertical( image ) end ---Flip image horizontally ----- Failure return false ----- Success return true ---@param image any ----@return any success -function RL.ImageFlipHorizontal( image ) end +---@return any RL.ImageFlipHorizontal +function RL.ImageFlipHorizontal( image ) end ---Rotate image clockwise 90deg ----- Failure return false ----- Success return true ---@param image any ----@return any success -function RL.ImageRotateCW( image ) end +---@return any RL.ImageRotateCW +function RL.ImageRotateCW( image ) end ---Rotate image counter-clockwise 90deg ----- Failure return false ----- Success return true ---@param image any ----@return any success -function RL.ImageRotateCCW( image ) end +---@return any RL.ImageRotateCCW +function RL.ImageRotateCCW( image ) end ---Modify image color: tint ----- Failure return false ----- Success return true ---@param image any ---@param color table ----@return any success -function RL.ImageColorTint( image, color ) end +---@return any RL.ImageColorTint +function RL.ImageColorTint( image, color ) end ---Modify image color: invert ----- Failure return false ----- Success return true ---@param image any ----@return any success -function RL.ImageColorInvert( image ) end +---@return any RL.ImageColorInvert +function RL.ImageColorInvert( image ) end ---Modify image color: grayscale ----- Failure return false ----- Success return true ---@param image any ----@return any success -function RL.ImageColorGrayscale( image ) end +---@return any RL.ImageColorGrayscale +function RL.ImageColorGrayscale( image ) end ----Modify image color: contrast ( -100 to 100 ) ----- Failure return false ----- Success return true +---Modify image color: contrast (-100 to 100) ---@param image any ---@param contrast number ----@return any success -function RL.ImageColorContrast( image, contrast ) end +---@return any RL.ImageColorContrast +function RL.ImageColorContrast( image, contrast ) end ----Modify image color: brightness ( -255 to 255 ) ----- Failure return false ----- Success return true +---Modify image color: brightness (-255 to 255) ---@param image any ---@param brightness integer ----@return any success -function RL.ImageColorBrightness( image, brightness ) end +---@return any RL.ImageColorBrightness +function RL.ImageColorBrightness( image, brightness ) end ---Modify image color: replace color ----- Failure return false ----- Success return true ---@param image any ---@param color table ---@param replace table ----@return any success -function RL.ImageColorReplace( image, color, replace ) end +---@return any RL.ImageColorReplace +function RL.ImageColorReplace( image, color, replace ) end ----Load color data from image as a Color array ( RGBA - 32bit ) ----- Failure return false +---Load color data from image as a Color array (RGBA - 32bit) ---- Success return Color{} ---@param image any ---@return any colors function RL.LoadImageColors( image ) end ----Load colors palette from image as a Color array ( RGBA - 32bit ) ----- Failure return false +---Load colors palette from image as a Color array (RGBA - 32bit) ---- Success return Color{} ---@param image any ---@param maxPaletteSize integer @@ -2689,15 +2427,13 @@ function RL.LoadImageColors( image ) end function RL.LoadImagePalette( image, maxPaletteSize ) end ---Get image alpha border rectangle ----- Failure return false ---- Success return Rectangle ---@param image any ---@param threshold number ---@return any rectangle function RL.GetImageAlphaBorder( image, threshold ) end ----Get image pixel color at ( x, y ) position ----- Failure return false +---Get image pixel color at (x, y) position ---- Success return Color ---@param image any ---@param pixelPos table @@ -2707,81 +2443,65 @@ function RL.GetImageColor( image, pixelPos ) end -- Textures - Image Drawing ---Clear image background with given color ----- Failure return false ----- Success return true ---@param dst any ---@param color table ----@return any success -function RL.ImageClearBackground( dst, color ) end +---@return any RL.ImageClearBackground +function RL.ImageClearBackground( dst, color ) end ---Draw pixel within an image ----- Failure return false ----- Success return true ---@param dst any ---@param position table ---@param color table ----@return any success -function RL.ImageDrawPixel( dst, position, color ) end +---@return any RL.ImageDrawPixel +function RL.ImageDrawPixel( dst, position, color ) end ---Draw line within an image ----- Failure return false ----- Success return true ---@param dst any ---@param a table ---@param b table ---@param color table ----@return any success -function RL.ImageDrawLine( dst, a, b, color ) end +---@return any RL.ImageDrawLine +function RL.ImageDrawLine( dst, a, b, color ) end ---Draw circle within an image ----- Failure return false ----- Success return true ---@param dst any ---@param center table ---@param radius integer ---@param color table ----@return any success -function RL.ImageDrawCircle( dst, center, radius, color ) end +---@return any RL.ImageDrawCircle +function RL.ImageDrawCircle( dst, center, radius, color ) end ---Draw circle outline within an image ----- Failure return false ----- Success return true ---@param dst any ---@param center table ---@param radius integer ---@param color table ----@return any success -function RL.ImageDrawCircleLines( dst, center, radius, color ) end +---@return any RL.ImageDrawCircleLines +function RL.ImageDrawCircleLines( dst, center, radius, color ) end ---Draw rectangle within an image ----- Failure return false ----- Success return true ---@param dst any ---@param rec table ---@param color table ----@return any success -function RL.ImageDrawRectangle( dst, rec, color ) end +---@return any RL.ImageDrawRectangle +function RL.ImageDrawRectangle( dst, rec, color ) end ---Draw rectangle lines within an image ----- Failure return false ----- Success return true ---@param dst any ---@param rec table ---@param thick integer ---@param color table ----@return any success -function RL.ImageDrawRectangleLines( dst, rec, thick, color ) end +---@return any RL.ImageDrawRectangleLines +function RL.ImageDrawRectangleLines( dst, rec, thick, color ) end ----Draw a source image within a destination image ( Tint applied to source ) ----- Failure return false ----- Success return true +---Draw a source image within a destination image (Tint applied to source) ---@param dst any ---@param src any ---@param srcRec table ---@param dstRec table ---@param tint table ----@return any success -function RL.ImageDraw( dst, src, srcRec, dstRec, tint ) end +---@return any RL.ImageDraw +function RL.ImageDraw( dst, src, srcRec, dstRec, tint ) end ---Draw text ( Custom sprite font ) within an image ( Destination ) ---- Failure return false @@ -2799,21 +2519,18 @@ function RL.ImageDrawTextEx( dst, font, text, position, fontSize, spacing, tint -- Textures - Image Configuration ---Get image size ----- Failure return nil ---- Success return Vector2 ---@param image any ---@return any size function RL.GetImageSize( image ) end ---Get image mipmaps. Mipmap levels, 1 by default ----- Failure return false ---- Success return int ---@param image any ---@return any mipmaps function RL.GetImageMipmaps( image ) end ----Get image data format ( PixelFormat type ) ----- Failure return false +---Get image data format (PixelFormat type) ---- Success return int ---@param image any ---@return any format @@ -2822,187 +2539,164 @@ function RL.GetImageFormat( image ) end -- Textures - Texture Loading ---Load texture from file into GPU memory ( VRAM ) ----- Failure return -1 ----- Success return int +---- Failure return nil +---- Success return Texture ---@param fileName string ---@return any texture function RL.LoadTexture( fileName ) end ---Load texture from image data ----- Failure return -1 ----- Success return int +---- Success return Texture ---@param image any ---@return any texture function RL.LoadTextureFromImage( image ) end ---Load cubemap from image, multiple image cubemap layouts supported ----- Failure return -1 ----- Success return int +---- Success return Texture ---@param image any ---@param layout integer ---@return any texture function RL.LoadTextureCubemap( image, layout ) end ----Load texture for rendering ( framebuffer ) ----- Failure return -1 ----- Success return int +---Load texture for rendering (framebuffer) +---- Success return RenderTexture ---@param size table ---@return any renderTexture function RL.LoadRenderTexture( size ) end ----Unload texture from GPU memory ( VRAM ). NOTE! Must be texture id. ----- Failure return false ----- Success return true ----@param texture any ----@return any success -function RL.UnloadTexture( texture ) end - ---Check if a texture is ready ----- Failure return nil ----- Success return true +---- Success return bool ---@param texture any ---@return any isReady function RL.IsTextureReady( texture ) end ---Update GPU texture with new data ---NOTE! Should be TEXTURE_TYPE_TEXTURE. Pixel should be in format { { 255, 255, 255, 255 }... } depending on the pixel format ----- Failure return false ----- Success return true ---@param texture any ---@param pixels any ----@return any success -function RL.UpdateTexture( texture, pixels ) end +---@return any RL.UpdateTexture +function RL.UpdateTexture( texture, pixels ) end ---Update GPU texture rectangle with new data ---NOTE! Should be TEXTURE_TYPE_TEXTURE. Pixel should be in format { { 255, 255, 255, 255 }... } depending on the pixel format ----- Failure return false ----- Success return true ---@param texture any ---@param rec table ---@param pixels any ----@return any success -function RL.UpdateTextureRec( texture, rec, pixels ) end +---@return any RL.UpdateTextureRec +function RL.UpdateTextureRec( texture, rec, pixels ) end -- Textures - Texture Drawing ---Draw a Texture2D ----- Failure return false ----- Success return true ---@param texture any ---@param position table ---@param tint table ----@return any success -function RL.DrawTexture( texture, position, tint ) end +---@return any RL.DrawTexture +function RL.DrawTexture( texture, position, tint ) end ---Draw a part of a texture defined by a rectangle ----- Failure return false ----- Success return true ---@param texture any ---@param source table ---@param position table ---@param tint table ----@return any success -function RL.DrawTextureRec( texture, source, position, tint ) end +---@return any RL.DrawTextureRec +function RL.DrawTextureRec( texture, source, position, tint ) end ---Draw a part of a texture defined by a rectangle with "pro" parameters ----- Failure return false ----- Success return true ---@param texture any ---@param source table ---@param dest table ---@param origin table ---@param rotation number ---@param tint table ----@return any success -function RL.DrawTexturePro( texture, source, dest, origin, rotation, tint ) end +---@return any RL.DrawTexturePro +function RL.DrawTexturePro( texture, source, dest, origin, rotation, tint ) end ----Draws a texture ( or part of it ) that stretches or shrinks nicely ----- Failure return false ----- Success return true +---Draws a texture (or part of it) that stretches or shrinks nicely ---@param texture any ---@param nPatchInfo any ---@param dest table ---@param origin table ---@param rotation number ---@param tint table ----@return any success -function RL.DrawTextureNPatch( texture, nPatchInfo, dest, origin, rotation, tint ) end +---@return any RL.DrawTextureNPatch +function RL.DrawTextureNPatch( texture, nPatchInfo, dest, origin, rotation, tint ) end ---Begin drawing to render texture ----- Failure return false ----- Success return true ---@param target any ----@return any success -function RL.BeginTextureMode( target ) end +---@return any RL.BeginTextureMode +function RL.BeginTextureMode( target ) end ---Ends drawing to render texture ---@return any RL.EndTextureMode function RL.EndTextureMode() end ----Get texture type ( TEXTURE_TYPE_TEXTURE or TEXTURE_TYPE_RENDER_TEXTURE ) ----- Failure return false ----- Success return int ----@param texture any ----@return any type -function RL.GetTextureType( texture ) end - -- Textures - Texture Configuration ---Generate GPU mipmaps for a texture ----- Failure return false ----- Success return true ---@param texture any ----@return any success -function RL.GenTextureMipmaps( texture ) end +---@return any RL.GenTextureMipmaps +function RL.GenTextureMipmaps( texture ) end ----Set texture scaling filter mode ( TEXTURE_FILTER_POINT, TEXTURE_FILTER_BILINEAR... ) ----- Failure return false ----- Success return true +---Set texture scaling filter mode (TEXTURE_FILTER_POINT, TEXTURE_FILTER_BILINEAR...) ---@param texture any ---@param filter integer ----@return any success -function RL.SetTextureFilter( texture, filter ) end +---@return any RL.SetTextureFilter +function RL.SetTextureFilter( texture, filter ) end ----Set texture wrapping mode ( TEXTURE_WRAP_REPEAT, TEXTURE_WRAP_CLAMP... ) ----- Failure return false ----- Success return true +---Set texture wrapping mode (TEXTURE_WRAP_REPEAT, TEXTURE_WRAP_CLAMP...) ---@param texture any ---@param wrap integer ----@return any success -function RL.SetTextureWrap( texture, wrap ) end +---@return any RL.SetTextureWrap +function RL.SetTextureWrap( texture, wrap ) end ----Get texture OpenGL id ----- Failure return false +---Get OpenGL texture id ---- Success return int ---@param texture any ---@return any id function RL.GetTextureId( texture ) end ---Get texture size ----- Failure return false ---- Success return Vector2 ---@param texture any ---@return any size function RL.GetTextureSize( texture ) end ---Get texture mipmaps. Mipmap levels, 1 by default ----- Failure return false ---- Success return int ---@param texture any ---@return any mipmaps function RL.GetTextureMipmaps( texture ) end ----Get texture data format ( PixelFormat type ) ----- Failure return false +---Get texture data format (PixelFormat type) ---- Success return int ---@param texture any ---@return any format function RL.GetTextureFormat( texture ) end +-- Textures - RenderTexture Configuration + +---Get OpenGL framebuffer object id +---- Success return int +---@param renderTexture any +---@return any id +function RL.GetRenderTextureId( renderTexture ) end + +---Get color buffer attachment texture +---- Success return Texture +---@param renderTexture any +---@return any texture +function RL.GetRenderTextureTexture( renderTexture ) end + +---Get depth buffer attachment texture +---- Success return Texture +---@param renderTexture any +---@return any texture +function RL.GetRenderTextureDepthTexture( renderTexture ) end + -- Textures - Color/pixel ---Returns color with alpha applied, alpha goes from 0.0f to 1.0f ----- Failure return false ---- Success return Color ---@param color table ---@param alpha number @@ -3010,35 +2704,30 @@ function RL.GetTextureFormat( texture ) end function RL.Fade( color, alpha ) end ---Returns hexadecimal value for a Color ----- Failure return false ---- Success return int ---@param color table ---@return any value function RL.ColorToInt( color ) end ---Returns Color normalized as float [0..1] ----- Failure return false ---- Success return Vector4 ---@param color table ---@return any color function RL.ColorNormalize( color ) end ---Color from normalized values [0..1] ----- Failure return false ---- Success return Color ---@param normalized table ---@return any color function RL.ColorFromNormalized( normalized ) end ---Returns HSV values for a Color, hue [0..360], saturation/value [0..1] ----- Failure return false ---- Success return Vector3 ---@param color table ---@return any HSV function RL.ColorToHSV( color ) end ---Returns a Color from HSV values, hue [0..360], saturation/value [0..1] ----- Failure return false ---- Success return Color ---@param hue number ---@param saturation number @@ -3047,7 +2736,6 @@ function RL.ColorToHSV( color ) end function RL.ColorFromHSV( hue, saturation, value ) end ---Get color multiplied with another color ----- Failure return false ---- Success return Color ---@param color table ---@param tint table @@ -3055,7 +2743,6 @@ function RL.ColorFromHSV( hue, saturation, value ) end function RL.ColorTint( color, tint ) end ---Get color with brightness correction, brightness factor goes from -1.0f to 1.0f ----- Failure return false ---- Success return Color ---@param color table ---@param factor number @@ -3063,7 +2750,6 @@ function RL.ColorTint( color, tint ) end function RL.ColorBrightness( color, factor ) end ---Get color with contrast correction, contrast values between -1.0f and 1.0f ----- Failure return false ---- Success return Color ---@param color table ---@param contrast number @@ -3071,7 +2757,6 @@ function RL.ColorBrightness( color, factor ) end function RL.ColorContrast( color, contrast ) end ---Returns color with alpha applied, alpha goes from 0.0f to 1.0f ----- Failure return false ---- Success return Color ---@param color table ---@param alpha number @@ -3079,7 +2764,6 @@ function RL.ColorContrast( color, contrast ) end function RL.ColorAlpha( color, alpha ) end ---Returns src alpha-blended into dst color with tint ----- Failure return false ---- Success return Color ---@param dst table ---@param src table @@ -3088,14 +2772,12 @@ function RL.ColorAlpha( color, alpha ) end function RL.ColorAlphaBlend( dst, src, tint ) end ---Get Color structure from hexadecimal value ----- Failure return false ---- Success return Color ----@param int any +---@param hexValue integer ---@return any color -function RL.GetColor( int ) end +function RL.GetColor( hexValue ) end ---Get pixel color from source texture ----- Failure return false ---- Success return Color ---@param texture any ---@param position table @@ -3103,7 +2785,6 @@ function RL.GetColor( int ) end function RL.GetPixelColor( texture, position ) end ---Get pixel data size in bytes for certain format ----- Failure return false ---- Success return int ---@param width integer ---@param height integer @@ -3390,14 +3071,12 @@ function RL.DrawCapsuleWires( startPos, endPos, radius, slices, rings, color ) e function RL.DrawPlane( centerPos, size, color ) end ---Draw 3D textured quad. ( Texture coordinates opengl style 0.0 - 1.0 ). ----- Failure return false ----- Success return true ---@param texture any ---@param vertices any ---@param texCoords any ---@param colors any ----@return any success -function RL.DrawQuad3DTexture( texture, vertices, texCoords, colors ) end +---@return any RL.DrawQuad3DTexture +function RL.DrawQuad3DTexture( texture, vertices, texCoords, colors ) end ---Draw a ray line ---- Failure return false @@ -3593,13 +3272,11 @@ function RL.CreateMaterial( material ) end function RL.UnloadMaterial( material ) end ---Set texture for a material map type ( MATERIAL_MAP_ALBEDO, MATERIAL_MAP_METALNESS... ) ----- Failure return false ----- Success return true ---@param material any ---@param mapType integer ---@param texture any ----@return any success -function RL.SetMaterialTexture( material, mapType, texture ) end +---@return any RL.SetMaterialTexture +function RL.SetMaterialTexture( material, mapType, texture ) end ---Set color for a material map type ---- Failure return false @@ -3620,12 +3297,10 @@ function RL.SetMaterialColor( material, mapType, color ) end function RL.SetMaterialValue( material, mapType, value ) end ---Set shader for material ----- Failure return false ----- Success return true ---@param material any ---@param shader any ----@return any success -function RL.SetMaterialShader( material, shader ) end +---@return any RL.SetMaterialShader +function RL.SetMaterialShader( material, shader ) end ---Set material generic parameters ( if required ) ---- Failure return false @@ -3661,7 +3336,7 @@ function RL.GetMaterialValue( material, mapType ) end ---Get material shader. Returns -1 if no shader. ---- Failure return false ----- Success return int +---- Success return Shader ---@param material any ---@return any shader function RL.GetMaterialShader( material ) end @@ -3737,31 +3412,25 @@ function RL.SetModelMaterial( model, modelMaterial, material ) end function RL.SetModelMeshMaterial( model, meshId, materialId ) end ---Draw a billboard texture ----- Failure return false ----- Success return true ---@param camera any ---@param texture any ---@param position table ---@param size number ---@param tint table ----@return any success -function RL.DrawBillboard( camera, texture, position, size, tint ) end +---@return any RL.DrawBillboard +function RL.DrawBillboard( camera, texture, position, size, tint ) end ---Draw a billboard texture defined by source ----- Failure return false ----- Success return true ---@param camera any ---@param texture any ---@param source table ---@param position table ---@param size table ---@param tint table ----@return any success -function RL.DrawBillboardRec( camera, texture, source, position, size, tint ) end +---@return any RL.DrawBillboardRec +function RL.DrawBillboardRec( camera, texture, source, position, size, tint ) end ---Draw a billboard texture defined by source and rotation ----- Failure return false ----- Success return true ---@param camera any ---@param texture any ---@param source table @@ -3771,8 +3440,8 @@ function RL.DrawBillboardRec( camera, texture, source, position, size, tint ) en ---@param origin table ---@param rotation number ---@param tint table ----@return any success -function RL.DrawBillboardPro( camera, texture, source, position, up, size, origin, rotation, tint ) end +---@return any RL.DrawBillboardPro +function RL.DrawBillboardPro( camera, texture, source, position, up, size, origin, rotation, tint ) end ---Set model transform matrix ---- Failure return false @@ -5547,12 +5216,10 @@ function RL.GuiCheckIconPixel( iconId, pos ) end function RL.CreateLight( type, position, target, color, shader ) end ---Send light properties to shader ----- Failure return false ----- Success return true ---@param shader any ---@param light any ----@return any success -function RL.UpdateLightValues( shader, light ) end +---@return any RL.UpdateLightValues +function RL.UpdateLightValues( shader, light ) end ---Set light type ---- Failure return false @@ -6326,16 +5993,14 @@ function RL.rlSetMatrixViewOffsetStereo( right, left ) end ---Copy a block of pixels from one framebuffer object to another. ---Use -1 RenderTexture for window framebuffer. ----- Failure return false ----- Success return true ---@param srcTex any ---@param dstTex any ---@param srcRect table ---@param dstRect table ---@param mask integer ---@param filter integer ----@return any success -function RL.glBlitFramebuffer( srcTex, dstTex, srcRect, dstRect, mask, filter ) end +---@return any RL.glBlitFramebuffer +function RL.glBlitFramebuffer( srcTex, dstTex, srcRect, dstRect, mask, filter ) end -- Easings - Linear Easing functions @@ -1,10 +1,11 @@ Current { - * rlgl - * Shaders management - * Compute shader management + * Converting to new style. } Backlog { + * rlgl + * Shaders management + * Compute shader management * New type validators. * Platformer example physics process for true framerate independence. * Extend color lib functionality. @@ -16,6 +17,7 @@ Backlog { * Audio * AudioStream. * Core. + * Load shader function arg check to new style. * Compression/Encoding functionality. * SetWindowIcons. * Models @@ -37,7 +37,7 @@ int lcoreIsWindowFullscreen( lua_State *L ) { /* > state = RL.IsWindowHidden() -Check if window is currently hidden ( only PLATFORM_DESKTOP ) +Check if window is currently hidden (only PLATFORM_DESKTOP) - Success return bool */ @@ -50,7 +50,7 @@ int lcoreIsWindowHidden( lua_State *L ) { /* > state = RL.IsWindowMinimized() -Check if window is currently minimized ( only PLATFORM_DESKTOP ) +Check if window is currently minimized (only PLATFORM_DESKTOP) - Success return bool */ @@ -63,7 +63,7 @@ int lcoreIsWindowMinimized( lua_State *L ) { /* > state = RL.IsWindowMaximized() -Check if window is currently maximized ( only PLATFORM_DESKTOP ) +Check if window is currently maximized (only PLATFORM_DESKTOP) - Success return bool */ @@ -76,7 +76,7 @@ int lcoreIsWindowMaximized( lua_State *L ) { /* > state = RL.IsWindowFocused() -Check if window is currently focused ( only PLATFORM_DESKTOP ) +Check if window is currently focused (only PLATFORM_DESKTOP) - Success return bool */ @@ -87,89 +87,55 @@ int lcoreIsWindowFocused( lua_State *L ) { } /* -> success = RL.SetWindowMonitor( int monitor ) +> RL.SetWindowMonitor( int monitor ) Set monitor for the current window (fullscreen mode) - -- Failure return false -- Success return true */ int lcoreSetWindowMonitor( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetWindowMonitor( int monitor )" ); - lua_pushboolean( L, false ); - return 1; - } - SetWindowMonitor( lua_tointeger( L, 1 ) ); - lua_pushboolean( L, true ); + int monitor = luaL_checkinteger( L, 1 ); - return 1; + SetWindowMonitor( monitor ); + + return 0; } /* -> success = RL.SetWindowPosition( Vector2 pos ) +> RL.SetWindowPosition( Vector2 pos ) Set window position on screen - -- Failure return false -- Success return true */ int lcoreSetWindowPosition( lua_State *L ) { - if ( !lua_istable( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetWindowPosition( Vector2 pos )" ); - lua_pushboolean( L, false ); - return 1; - } Vector2 pos = uluaGetVector2Index( L, 1 ); SetWindowPosition( pos.x, pos.y ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* -> success = RL.SetWindowSize( Vector2 size ) +> RL.SetWindowSize( Vector2 size ) Set window dimensions - -- Failure return false -- Success return true */ int lcoreSetWindowSize( lua_State *L ) { - if ( !lua_istable( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetWindowSize( Vector2 size )" ); - lua_pushboolean( L, false ); - return 1; - } Vector2 size = uluaGetVector2Index( L, 1 ); SetWindowSize( (int)size.x, (int)size.y ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* -> success = RL.SetWindowMinSize( Vector2 size ) +> RL.SetWindowMinSize( Vector2 size ) -Set window minimum dimensions ( for FLAG_WINDOW_RESIZABLE ) - -- Failure return false -- Success return true +Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) */ int lcoreSetWindowMinSize( lua_State *L ) { - if ( !lua_istable( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetWindowMinSize( Vector2 size )" ); - lua_pushboolean( L, false ); - return 1; - } Vector2 size = uluaGetVector2Index( L, 1 ); SetWindowMinSize( (int)size.x, (int)size.y ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* @@ -177,16 +143,10 @@ int lcoreSetWindowMinSize( lua_State *L ) { Get specified monitor position -- Failure return nil - Success return Vector2 */ int lcoreGetMonitorPosition( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetMonitorPosition( int monitor )" ); - lua_pushnil( L ); - return 1; - } - int monitor = lua_tointeger( L, 1 ); + int monitor = luaL_checkinteger( L, 1 ); uluaPushVector2( L, GetMonitorPosition( monitor ) ); @@ -198,16 +158,10 @@ int lcoreGetMonitorPosition( lua_State *L ) { Get specified monitor size -- Failure return nil - Success return Vector2 */ int lcoreGetMonitorSize( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetMonitorSize( int monitor )" ); - lua_pushnil( L ); - return 1; - } - int monitor = lua_tointeger( L, 1 ); + int monitor = luaL_checkinteger( L, 1 ); Vector2 size = (Vector2){ GetMonitorWidth( monitor ), GetMonitorHeight( monitor ) }; uluaPushVector2( L, size ); @@ -223,8 +177,7 @@ Get window position on monitor - Success return Vector2 */ int lcoreGetWindowPosition( lua_State *L ) { - Vector2 pos = GetWindowPosition(); - uluaPushVector2( L, pos ); + uluaPushVector2( L, GetWindowPosition() ); return 1; } @@ -244,42 +197,27 @@ int lcoreGetScreenSize( lua_State *L ) { } /* -> success = RL.SetWindowState( int flag ) +> RL.SetWindowState( int flag ) -Set window configuration state using flags ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... ) - -- Failure return false -- Success return true +Set window configuration state using flags (FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE...) */ int lcoreSetWindowState( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetWindowState( int flags )" ); - lua_pushboolean( L, false ); - return 1; - } - unsigned int flag = (unsigned int)lua_tointeger( L, 1 ); + unsigned int flag = (unsigned int)luaL_checkinteger( L, 1 ); SetWindowState( flag ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* > state = RL.IsWindowState( int flag ) -Check if one specific window flag is enabled ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... ) +Check if one specific window flag is enabled (FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE...) -- Failure return nil - Success return bool */ int lcoreIsWindowState( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsWindowState( int flags )" ); - lua_pushnil( L ); - return 1; - } - unsigned int flag = (unsigned int)lua_tointeger( L, 1 ); + unsigned int flag = (unsigned int)luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsWindowState( flag ) ); @@ -289,17 +227,12 @@ int lcoreIsWindowState( lua_State *L ) { /* > resized = RL.ClearWindowState( int flag ) -Clear window configuration state flags ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... ) +Clear window configuration state flags (FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE...) - Success return bool */ int lcoreClearWindowState( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.ClearWindowState( int flag )" ); - lua_pushnil( L ); - return 1; - } - unsigned int flag = (unsigned int)lua_tointeger( L, 1 ); + unsigned int flag = (unsigned int)luaL_checkinteger( L, 1 ); ClearWindowState( flag ); @@ -322,7 +255,7 @@ int lcoreIsWindowResized( lua_State *L ) { /* > RL.SetWindowIcon( Image image ) -Set icon for window ( Only PLATFORM_DESKTOP ) +Set icon for window (Only PLATFORM_DESKTOP) */ int lcoreSetWindowIcon( lua_State *L ) { Image *image = luaL_checkudata( L, 1, "Image" ); @@ -333,23 +266,14 @@ int lcoreSetWindowIcon( lua_State *L ) { } /* -> success = RL.SetWindowTitle( string title ) +> RL.SetWindowTitle( string title ) -Set title for window ( Only PLATFORM_DESKTOP ) - -- Failure return false -- Success return true +Set title for window (Only PLATFORM_DESKTOP) */ int lcoreSetWindowTitle( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetWindowTitle( string title )" ); - lua_pushboolean( L, false ); - return 1; - } - SetWindowTitle( lua_tostring( L, 1 ) ); - lua_pushboolean( L, true ); + SetWindowTitle( luaL_checkstring( L, 1 ) ); - return 1; + return 0; } /* @@ -361,6 +285,7 @@ Get number of connected monitors */ int lcoreGetMonitorCount( lua_State *L ) { lua_pushinteger( L, GetMonitorCount() ); + return 1; } @@ -373,6 +298,7 @@ Get current connected monitor */ int lcoreGetCurrentMonitor( lua_State *L ) { lua_pushinteger( L, GetCurrentMonitor() ); + return 1; } @@ -381,16 +307,10 @@ int lcoreGetCurrentMonitor( lua_State *L ) { Get specified monitor physical size in millimetres -- Failure return false - Success return Vector2 */ int lcoreGetMonitorPhysicalSize( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetMonitorPhysicalSize( int monitor )" ); - lua_pushboolean( L, false ); - return 1; - } - int monitor = lua_tointeger( L, 1 ); + int monitor = luaL_checkinteger( L, 1 ); Vector2 size = { GetMonitorPhysicalWidth( monitor ), GetMonitorPhysicalHeight( monitor ) }; uluaPushVector2( L, size ); @@ -399,20 +319,14 @@ int lcoreGetMonitorPhysicalSize( lua_State *L ) { } /* -> size = RL.GetMonitorRefreshRate( int monitor ) +> refreshRate = RL.GetMonitorRefreshRate( int monitor ) Get specified monitor refresh rate -- Failure return false - Success return int */ int lcoreGetMonitorRefreshRate( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetMonitorRefreshRate( int monitor )" ); - lua_pushboolean( L, false ); - return 1; - } - int monitor = lua_tointeger( L, 1 ); + int monitor = luaL_checkinteger( L, 1 ); lua_pushinteger( L, GetMonitorRefreshRate( monitor ) ); @@ -420,7 +334,7 @@ int lcoreGetMonitorRefreshRate( lua_State *L ) { } /* -> scale = RL.GetWindowScaleDPI() +> dpi = RL.GetWindowScaleDPI() Get window scale DPI factor @@ -437,16 +351,10 @@ int lcoreGetWindowScaleDPI( lua_State *L ) { Get the human-readable, UTF-8 encoded name of the monitor -- Failure return false - Success return string */ int lcoreGetMonitorName( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetMonitorName( int monitor )" ); - lua_pushboolean( L, false ); - return 1; - } - int monitor = lua_tointeger( L, 1 ); + int monitor = luaL_checkinteger( L, 1 ); lua_pushstring( L, GetMonitorName( monitor ) ); @@ -465,23 +373,14 @@ int lcoreCloseWindow( lua_State *L ) { } /* -> success = RL.SetClipboardText( string text ) +> RL.SetClipboardText( string text ) Set clipboard text content - -- Failure return false -- Success return true */ int lcoreSetClipboardText( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetClipboardText( string text )" ); - lua_pushboolean( L, false ); - return 1; - } - SetClipboardText( lua_tostring( L, 1 ) ); - lua_pushboolean( L, true ); + SetClipboardText( luaL_checkstring( L, 1 ) ); - return 1; + return 0; } /* @@ -493,6 +392,7 @@ Get clipboard text content */ int lcoreGetClipboardText( lua_State *L ) { lua_pushstring( L, GetClipboardText() ); + return 1; } @@ -501,25 +401,16 @@ int lcoreGetClipboardText( lua_State *L ) { */ /* -> success = RL.SetTargetFPS( int fps ) +> RL.SetTargetFPS( int fps ) -Set target FPS ( maximum ) - -- Failure return false -- Success return true +Set target FPS (maximum) */ int lcoreSetTargetFPS( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetTargetFPS( int fps )" ); - lua_pushboolean( L, false ); - return 1; - } - int fps = lua_tointeger( L, 1 ); + int fps = luaL_checkinteger( L, 1 ); SetTargetFPS( fps ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* @@ -538,7 +429,7 @@ int lcoreGetFPS( lua_State *L ) { /* > delta = RL.GetFrameTime() -Get time in seconds for last frame drawn ( Delta time ) +Get time in seconds for last frame drawn (Delta time) - Success return float */ @@ -566,110 +457,64 @@ int lcoreGetTime( lua_State *L ) { */ /* -> success = RL.TakeScreenshot( string fileName ) - -Takes a screenshot of current screen ( filename extension defines format ) +> RL.TakeScreenshot( string fileName ) -- Failure return false -- Success return true +Takes a screenshot of current screen (filename extension defines format) */ int lcoreTakeScreenshot( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.TakeScreenshot( string fileName )" ); - lua_pushboolean( L, false ); - return 1; - } - TakeScreenshot( lua_tostring( L, 1 ) ); - lua_pushboolean( L, true ); + TakeScreenshot( luaL_checkstring( L, 1 ) ); - return 1; + return 0; } /* -> success = RL.SetConfigFlags( int flags ) - -Setup init configuration flags ( view FLAGS ) +> RL.SetConfigFlags( int flags ) -- Failure return false -- Success return true +Setup init configuration flags (view FLAGS) */ int lcoreSetConfigFlags( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetConfigFlags( int flags )" ); - lua_pushboolean( L, false ); - return 1; - } - unsigned int flag = (unsigned int)lua_tointeger( L, 1 ); + unsigned int flag = (unsigned int)luaL_checkinteger( L, 1 ); SetConfigFlags( flag ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* -> success = RL.TraceLog( int logLevel, string text ) +> RL.TraceLog( int logLevel, string text ) -Show trace log messages ( LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR... ) - -- Failure return false -- Success return true +Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) */ int lcoreTraceLog( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) || !lua_isstring( L, 2 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.TraceLog( int logLevel, string text )" ); - lua_pushboolean( L, false ); - return 1; - } - int logLevel = lua_tointeger( L, 1 ); + int logLevel = luaL_checkinteger( L, 1 ); - TraceLog( logLevel, "%s", lua_tostring( L, 2 ) ); - lua_pushboolean( L, true ); + TraceLog( logLevel, "%s", luaL_checkstring( L, 2 ) ); - return 1; + return 0; } /* -> success = RL.SetTraceLogLevel( int logLevel ) - -Set the current threshold ( minimum ) log level +> RL.SetTraceLogLevel( int logLevel ) -- Failure return false -- Success return true +Set the current threshold (minimum) log level */ int lcoreSetTraceLogLevel( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetTraceLogLevel( int logLevel )" ); - lua_pushboolean( L, false ); - return 1; - } - int logLevel = lua_tointeger( L, 1 ); + int logLevel = luaL_checkinteger( L, 1 ); SetTraceLogLevel( logLevel ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* -> success = RL.SetLogLevelInvalid( int logLevel ) +> RL.SetLogLevelInvalid( int logLevel ) Set the log level for bad function calls and invalid data formats. - -- Failure return false -- Success return true */ int lcoreSetLogLevelInvalid( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetLogLevelInvalid( int logLevel )" ); - lua_pushboolean( L, false ); - return 1; - } - state->logLevelInvalid = lua_tointeger( L, 1 ); - - lua_pushboolean( L, true ); + state->logLevelInvalid = luaL_checkinteger( L, 1 ); - return 1; + return 0; } /* @@ -686,21 +531,82 @@ int lcoreGetLogLevelInvalid( lua_State *L ) { } /* -> success = RL.OpenURL( string url ) - -Open URL with default system browser ( If available ) +> RL.OpenURL( string url ) -- Failure return false -- Success return true +Open URL with default system browser (If available) */ int lcoreOpenURL( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.OpenURL( string url )" ); - lua_pushboolean( L, false ); - return 1; + OpenURL( luaL_checkstring( L, 1 ) ); + + return 0; +} + +/* +> buffer = RL.LoadBuffer( data{} buffer, int type ) + +Creates buffer as userdata. Type should be one of the Buffer types + +- Success return Buffer +*/ +int lcoreLoadBuffer( lua_State *L ) { + luaL_checktype( L, 1, LUA_TTABLE ); + int type = luaL_checkinteger( L, 2 ); + + Buffer *buffer = lua_newuserdata( L, sizeof( Buffer ) ); + int len = uluaGetTableLenIndex( L, 1 ); + + switch ( type ) { + case BUFFER_UNSIGNED_CHAR: + buffer->size = len * sizeof( unsigned char ); + break; + case BUFFER_UNSIGNED_SHORT: + buffer->size = len * sizeof( unsigned short ); + break; + case BUFFER_UNSIGNED_INT: + buffer->size = len * sizeof( unsigned int ); + break; + case BUFFER_FLOAT: + buffer->size = len * sizeof( float ); + break; + default: + break; } - OpenURL( lua_tostring( L, 1 ) ); - lua_pushboolean( L, true ); + buffer->data = malloc( buffer->size ); + + int t = 1; + int i = 0; + unsigned char *up = buffer->data; + unsigned short *sp = buffer->data; + unsigned int *ip = buffer->data; + float *fp = buffer->data; + + lua_pushnil( L ); + + while ( lua_next( L, t ) != 0 ) { + switch ( type ) { + case BUFFER_UNSIGNED_CHAR: + *up = (unsigned char)lua_tointeger( L, -1 ); + up++; + break; + case BUFFER_UNSIGNED_SHORT: + *sp = (unsigned short)lua_tointeger( L, -1 ); + up++; + break; + case BUFFER_UNSIGNED_INT: + *ip = (unsigned int)lua_tointeger( L, -1 ); + up++; + break; + case BUFFER_FLOAT: + *fp = (float)lua_tonumber( L, -1 ); + fp++; + break; + default: + break; + } + lua_pop( L, 1 ); + i++; + } + luaL_setmetatable( L, "Buffer" ); return 1; } @@ -784,102 +690,75 @@ int lcoreIsCursorOnScreen( lua_State *L ) { */ /* -> success = RL.ClearBackground( Color color ) +> RL.ClearBackground( Color color ) Set background color (framebuffer clear color) - -- Failure return false -- Success return true */ int lcoreClearBackground( lua_State *L ) { - if ( !lua_istable( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.ClearBackground( Color color )" ); - lua_pushboolean( L, false ); - return 1; - } Color color = uluaGetColorIndex( L, 1 ); ClearBackground( color ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* > RL.BeginDrawing() -Setup canvas ( framebuffer ) to start drawing +Setup canvas (framebuffer) to start drawing */ int lcoreBeginDrawing( lua_State *L ) { BeginDrawing(); - return 1; + return 0; } /* > RL.EndDrawing() -End canvas drawing and swap buffers ( double buffering ) +End canvas drawing and swap buffers (double buffering) */ int lcoreEndDrawing( lua_State *L ) { EndDrawing(); - return 1; + return 0; } /* -> success = RL.BeginBlendMode( int mode ) +> RL.BeginBlendMode( int mode ) -Begin blending mode ( BLEND_ALPHA, BLEND_ADDITIVE, BLEND_MULTIPLIED... ) - -- Failure return false -- Success return true +Begin blending mode (BLEND_ALPHA, BLEND_ADDITIVE, BLEND_MULTIPLIED...) */ int lcoreBeginBlendMode( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.BeginBlendMode( int mode )" ); - lua_pushboolean( L, false ); - return 1; - } - int mode = lua_tointeger( L, 1 ); + int mode = luaL_checkinteger( L, 1 ); BeginBlendMode( mode ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* > RL.EndBlendMode() -End blending mode ( reset to default: BLEND_ALPHA ) +End blending mode (reset to default: BLEND_ALPHA) */ int lcoreEndBlendMode( lua_State *L ) { EndBlendMode(); - return 1; + return 0; } /* -> success = RL.BeginScissorMode( Rectangle rectange ) - -Begin scissor mode ( define screen area for following drawing ) +> RL.BeginScissorMode( Rectangle rectange ) -- Failure return false -- Success return true +Begin scissor mode (define screen area for following drawing) */ int lcoreBeginScissorMode( lua_State *L ) { - if ( !lua_istable( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.BeginScissorMode( Rectangle rectange )" ); - lua_pushboolean( L, false ); - return 1; - } Rectangle rect = uluaGetRectangleIndex( L, 1 ); BeginScissorMode( rect.x, rect.y, rect.width, rect.height ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* @@ -890,7 +769,7 @@ End scissor mode int lcoreEndScissorMode( lua_State *L ) { EndScissorMode(); - return 1; + return 0; } /* @@ -1191,16 +1070,10 @@ int lcoreSetShaderValueV( lua_State *L ) { Detect if a key has been pressed once -- Failure return nil - Success return bool */ int lcoreIsKeyPressed( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsKeyPressed( int key )" ); - lua_pushnil( L ); - return 1; - } - int key = lua_tointeger( L, 1 ); + int key = luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsKeyPressed( key ) ); @@ -1212,16 +1085,10 @@ int lcoreIsKeyPressed( lua_State *L ) { Detect if a key is being pressed -- Failure return nil - Success return bool */ int lcoreIsKeyDown( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsKeyDown( int key )" ); - lua_pushnil( L ); - return 1; - } - int key = lua_tointeger( L, 1 ); + int key = luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsKeyDown( key ) ); @@ -1233,16 +1100,10 @@ int lcoreIsKeyDown( lua_State *L ) { Detect if a key has been released once -- Failure return nil - Success return bool */ int lcoreIsKeyReleased( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsKeyReleased( int key )" ); - lua_pushnil( L ); - return 1; - } - int key = lua_tointeger( L, 1 ); + int key = luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsKeyReleased( key ) ); @@ -1254,16 +1115,10 @@ int lcoreIsKeyReleased( lua_State *L ) { Check if a key is NOT being pressed -- Failure return nil - Success return bool */ int lcoreIsKeyUp( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsKeyUp( int key )" ); - lua_pushnil( L ); - return 1; - } - int key = lua_tointeger( L, 1 ); + int key = luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsKeyUp( key ) ); @@ -1299,19 +1154,14 @@ int lcoreGetCharPressed( lua_State *L ) { /* > RL.SetExitKey( int key ) -Set a custom key to exit program ( default is ESC ) +Set a custom key to exit program (default is ESC) */ int lcoreSetExitKey( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetExitKey( int key )" ); - lua_pushnil( L ); - return 1; - } - int key = lua_tointeger( L, 1 ); + int key = luaL_checkinteger( L, 1 ); SetExitKey( key ); - return 1; + return 0; } /* @@ -1330,17 +1180,11 @@ otherwise the scancode is ignored. If you specify a non-printable key, or KEY_UNKNOWN and a scancode that maps to a non-printable key, this function returns nil but does not emit an error. -- Failure return -1 - Success return string or nil */ int lcoreGetKeyName( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetKeyName( int key, int scancode )" ); - lua_pushinteger( L, -1 ); - return 1; - } - int key = lua_tointeger( L, 1 ); - int scancode = lua_tointeger( L, 2 ); + int key = luaL_checkinteger( L, 1 ); + int scancode = luaL_checkinteger( L, 2 ); const char *keyName = glfwGetKeyName( key, scancode ); @@ -1360,16 +1204,10 @@ int lcoreGetKeyName( lua_State *L ) { This function returns the platform-specific scancode of the specified key. If the key is KEY_UNKNOWN or does not exist on the keyboard this method will return -1. -- Failure return nil - Success return int */ int lcoreGetKeyScancode( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetKeyScancode( int key )" ); - lua_pushnil( L ); - return 1; - } - int key = lua_tointeger( L, 1 ); + int key = luaL_checkinteger( L, 1 ); lua_pushinteger( L, glfwGetKeyScancode( key ) ); @@ -1385,16 +1223,10 @@ int lcoreGetKeyScancode( lua_State *L ) { Detect if a gamepad is available -- Failure return nil - Success return bool */ int lcoreIsGamepadAvailable( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsGamepadAvailable( int gamepad )" ); - lua_pushnil( L ); - return 1; - } - int gamepad = lua_tointeger( L, 1 ); + int gamepad = luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsGamepadAvailable( gamepad ) ); @@ -1406,17 +1238,11 @@ int lcoreIsGamepadAvailable( lua_State *L ) { Detect if a gamepad button has been pressed once -- Failure return nil - Success return bool */ int lcoreIsGamepadButtonPressed( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsGamepadButtonPressed( int gamepad, int button )" ); - lua_pushnil( L ); - return 1; - } - int gamepad = lua_tointeger( L, 1 ); - int button = lua_tointeger( L, 2 ); + int gamepad = luaL_checkinteger( L, 1 ); + int button = luaL_checkinteger( L, 2 ); lua_pushboolean( L, IsGamepadButtonPressed( gamepad, button ) ); @@ -1428,17 +1254,11 @@ int lcoreIsGamepadButtonPressed( lua_State *L ) { Detect if a gamepad button is being pressed -- Failure return nil - Success return bool */ int lcoreIsGamepadButtonDown( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsGamepadButtonDown( int gamepad, int button )" ); - lua_pushnil( L ); - return 1; - } - int gamepad = lua_tointeger( L, 1 ); - int button = lua_tointeger( L, 2 ); + int gamepad = luaL_checkinteger( L, 1 ); + int button = luaL_checkinteger( L, 2 ); lua_pushboolean( L, IsGamepadButtonDown( gamepad, button ) ); @@ -1450,17 +1270,11 @@ int lcoreIsGamepadButtonDown( lua_State *L ) { Detect if a gamepad button has been released once -- Failure return nil - Success return bool */ int lcoreIsGamepadButtonReleased( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsGamepadButtonReleased( int gamepad, int button )" ); - lua_pushnil( L ); - return 1; - } - int gamepad = lua_tointeger( L, 1 ); - int button = lua_tointeger( L, 2 ); + int gamepad = luaL_checkinteger( L, 1 ); + int button = luaL_checkinteger( L, 2 ); lua_pushboolean( L, IsGamepadButtonReleased( gamepad, button ) ); @@ -1472,16 +1286,10 @@ int lcoreIsGamepadButtonReleased( lua_State *L ) { Return gamepad axis count for a gamepad -- Failure return false - Success return int */ int lcoreGetGamepadAxisCount( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetGamepadAxisCount( int gamepad )" ); - lua_pushboolean( L, false ); - return 1; - } - int gamepad = lua_tointeger( L, 1 ); + int gamepad = luaL_checkinteger( L, 1 ); lua_pushinteger( L, GetGamepadAxisCount( gamepad ) ); @@ -1493,17 +1301,11 @@ int lcoreGetGamepadAxisCount( lua_State *L ) { Return axis movement value for a gamepad axis -- Failure return false - Success return float */ int lcoreGetGamepadAxisMovement( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetGamepadAxisMovement( int gamepad, int axis )" ); - lua_pushboolean( L, false ); - return 1; - } - int gamepad = lua_tointeger( L, 1 ); - int axis = lua_tointeger( L, 2 ); + int gamepad = luaL_checkinteger( L, 1 ); + int axis = luaL_checkinteger( L, 2 ); lua_pushnumber( L, GetGamepadAxisMovement( gamepad, axis ) ); @@ -1515,16 +1317,10 @@ int lcoreGetGamepadAxisMovement( lua_State *L ) { Return gamepad internal name id -- Failure return false - Success return string */ int lcoreGetGamepadName( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetGamepadName( int gamepad )" ); - lua_pushboolean( L, false ); - return 1; - } - int gamepad = lua_tointeger( L, 1 ); + int gamepad = luaL_checkinteger( L, 1 ); lua_pushstring( L, GetGamepadName( gamepad ) ); @@ -1540,16 +1336,10 @@ int lcoreGetGamepadName( lua_State *L ) { Detect if a mouse button has been pressed once -- Failure return nil - Success return bool */ int lcoreIsMouseButtonPressed( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsMouseButtonPressed( int button )" ); - lua_pushnil( L ); - return 1; - } - int button = lua_tointeger( L, 1 ); + int button = luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsMouseButtonPressed( button ) ); @@ -1561,16 +1351,10 @@ int lcoreIsMouseButtonPressed( lua_State *L ) { Detect if a mouse button is being pressed -- Failure return nil - Success return bool */ int lcoreIsMouseButtonDown( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsMouseButtonDown( int button )" ); - lua_pushnil( L ); - return 1; - } - int button = lua_tointeger( L, 1 ); + int button = luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsMouseButtonDown( button ) ); @@ -1582,16 +1366,10 @@ int lcoreIsMouseButtonDown( lua_State *L ) { Detect if a mouse button has been released once -- Failure return nil - Success return bool */ int lcoreIsMouseButtonReleased( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsMouseButtonReleased( int button )" ); - lua_pushnil( L ); - return 1; - } - int button = lua_tointeger( L, 1 ); + int button = luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsMouseButtonReleased( button ) ); @@ -1603,16 +1381,10 @@ int lcoreIsMouseButtonReleased( lua_State *L ) { Check if a mouse button is NOT being pressed -- Failure return nil - Success return bool */ int lcoreIsMouseButtonUp( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsMouseButtonUp( int button )" ); - lua_pushnil( L ); - return 1; - } - int button = lua_tointeger( L, 1 ); + int button = luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsMouseButtonUp( button ) ); @@ -1628,6 +1400,7 @@ Returns mouse position */ int lcoreGetMousePosition( lua_State *L ) { uluaPushVector2( L, GetMousePosition() ); + return 1; } @@ -1640,73 +1413,47 @@ Get mouse delta between frames */ int lcoreGetMouseDelta( lua_State *L ) { uluaPushVector2( L, GetMouseDelta() ); + return 1; } /* -> success = RL.SetMousePosition( Vector2 position ) +> RL.SetMousePosition( Vector2 position ) Set mouse position XY - -- Failure return false -- Success return true */ int lcoreSetMousePosition( lua_State *L ) { - if ( !lua_istable( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetMousePosition( Vector2 position )" ); - lua_pushboolean( L, false ); - return 1; - } Vector2 pos = uluaGetVector2Index( L, 1 ); SetMousePosition( pos.x, pos.y ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* -> success = RL.SetMouseOffset( Vector2 offset ) +> RL.SetMouseOffset( Vector2 offset ) Set mouse offset - -- Failure return false -- Success return true */ int lcoreSetMouseOffset( lua_State *L ) { - if ( !lua_istable( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetMouseOffset( Vector2 offset )" ); - lua_pushboolean( L, false ); - return 1; - } Vector2 offset = uluaGetVector2Index( L, 1 ); SetMouseOffset( offset.x, offset.y ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* -> success = RL.SetMouseScale( Vector2 scale ) +> RL.SetMouseScale( Vector2 scale ) Set mouse scaling - -- Failure return false -- Success return true */ int lcoreSetMouseScale( lua_State *L ) { - if ( !lua_istable( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetMouseScale( Vector2 scale )" ); - lua_pushboolean( L, false ); - return 1; - } Vector2 scale = uluaGetVector2Index( L, 1 ); SetMouseScale( scale.x, scale.y ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* @@ -1718,29 +1465,21 @@ Returns mouse wheel movement Y */ int lcoreGetMouseWheelMove( lua_State *L ) { lua_pushnumber( L, GetMouseWheelMove() ); + return 1; } /* -> success = RL.SetMouseCursor( int cursor ) +> RL.SetMouseCursor( int cursor ) Set mouse cursor - -- Failure return false -- Success return true */ int lcoreSetMouseCursor( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetMouseCursor( int cursor )" ); - lua_pushboolean( L, false ); - return 1; - } - int cursor = lua_tointeger( L, 1 ); + int cursor = luaL_checkinteger( L, 1 ); SetMouseCursor( cursor ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* @@ -1750,18 +1489,12 @@ int lcoreSetMouseCursor( lua_State *L ) { /* > position = RL.GetTouchPosition( int index ) -Get touch position XY for a touch point index ( relative to screen size ) +Get touch position XY for a touch point index (relative to screen size) -- Failure return false - Success return Vector2 */ int lcoreGetTouchPosition( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetTouchPosition( int index )" ); - lua_pushboolean( L, false ); - return 1; - } - int index = lua_tointeger( L, 1 ); + int index = luaL_checkinteger( L, 1 ); uluaPushVector2( L, GetTouchPosition( index ) ); @@ -1773,16 +1506,10 @@ int lcoreGetTouchPosition( lua_State *L ) { Get touch point identifier for given index -- Failure return false - Success return int */ int lcoreGetTouchPointId( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetTouchPointId( int index )" ); - lua_pushboolean( L, false ); - return 1; - } - int index = lua_tointeger( L, 1 ); + int index = luaL_checkinteger( L, 1 ); lua_pushinteger( L, GetTouchPointId( index ) ); @@ -1807,25 +1534,16 @@ int lcoreGetTouchPointCount( lua_State *L ) { */ /* -> success = RL.SetGesturesEnabled( unsigned int flags ) +> RL.SetGesturesEnabled( unsigned int flags ) Enable a set of gestures using flags - -- Failure return false -- Success return true */ int lcoreSetGesturesEnabled( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.SetGesturesEnabled( unsigned int flags )" ); - lua_pushboolean( L, false ); - return 1; - } - unsigned int flags = (unsigned int)lua_tointeger( L, 1 ); + unsigned int flags = (unsigned int)luaL_checkinteger( L, 1 ); SetGesturesEnabled( flags ); - lua_pushboolean( L, true ); - return 1; + return 0; } /* @@ -1833,16 +1551,10 @@ int lcoreSetGesturesEnabled( lua_State *L ) { Check if a gesture have been detected -- Failure return nil - Success return bool */ int lcoreIsGestureDetected( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsGestureDetected( int gesture )" ); - lua_pushnil( L ); - return 1; - } - int gesture = lua_tointeger( L, 1 ); + int gesture = luaL_checkinteger( L, 1 ); lua_pushboolean( L, IsGestureDetected( gesture ) ); @@ -1934,7 +1646,7 @@ int lcoreGetGesturePinchAngle( lua_State *L ) { /* > path = RL.GetBasePath() -Return game directory ( where main.lua is located ) +Return game directory (where main.lua is located) - Success return string */ @@ -1949,16 +1661,10 @@ int lcoreGetBasePath( lua_State *L ) { Check if file exists -- Failure return nil - Success return bool */ int lcoreFileExists( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.FileExists( string fileName )" ); - lua_pushnil( L ); - return 1; - } - lua_pushboolean( L, FileExists( lua_tostring( L, 1 ) ) ); + lua_pushboolean( L, FileExists( luaL_checkstring( L, 1 ) ) ); return 1; } @@ -1968,16 +1674,10 @@ int lcoreFileExists( lua_State *L ) { Check if a directory path exists -- Failure return nil - Success return bool */ int lcoreDirectoryExists( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.DirectoryExists( string dirPath )" ); - lua_pushnil( L ); - return 1; - } - lua_pushboolean( L, DirectoryExists( lua_tostring( L, 1 ) ) ); + lua_pushboolean( L, DirectoryExists( luaL_checkstring( L, 1 ) ) ); return 1; } @@ -1985,18 +1685,12 @@ int lcoreDirectoryExists( lua_State *L ) { /* > hasFileExtension = RL.IsFileExtension( string fileName, string ext ) -Check file extension ( Including point: .png, .wav ) +Check file extension (Including point: .png, .wav) -- Failure return nil - Success return bool */ int lcoreIsFileExtension( lua_State *L ) { - if ( !lua_isstring( L, 1 ) || !lua_isstring( L, 2 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsFileExtension( string fileName, string ext )" ); - lua_pushnil( L ); - return 1; - } - lua_pushboolean( L, IsFileExtension( lua_tostring( L, 1 ), lua_tostring( L, 2 ) ) ); + lua_pushboolean( L, IsFileExtension( luaL_checkstring( L, 1 ), luaL_checkstring( L, 2 ) ) ); return 1; } @@ -2004,18 +1698,12 @@ int lcoreIsFileExtension( lua_State *L ) { /* > length = RL.GetFileLength( string fileName ) -Get file length in bytes ( NOTE: GetFileSize() conflicts with windows.h ) +Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) -- Failure return false - Success return int */ int lcoreGetFileLength( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetFileLength( string fileName )" ); - lua_pushboolean( L, false ); - return 1; - } - lua_pushinteger( L, GetFileLength( lua_tostring( L, 1 ) ) ); + lua_pushinteger( L, GetFileLength( luaL_checkstring( L, 1 ) ) ); return 1; } @@ -2023,56 +1711,38 @@ int lcoreGetFileLength( lua_State *L ) { /* > extension = RL.GetFileExtension( string fileName ) -Get pointer to extension for a filename string ( Includes dot: '.png' ) +Get pointer to extension for a filename string (Includes dot: '.png') -- Failure return false - Success return string */ int lcoreGetFileExtension( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetFileExtension( string fileName )" ); - lua_pushboolean( L, false ); - return 1; - } - lua_pushstring( L, GetFileExtension( lua_tostring( L, 1 ) ) ); + lua_pushstring( L, GetFileExtension( luaL_checkstring( L, 1 ) ) ); return 1; } /* -> filePath = RL.GetFileName( string filePath ) +> fileName = RL.GetFileName( string filePath ) Get pointer to filename for a path string -- Failure return false - Success return string */ int lcoreGetFileName( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetFileName( string filePath )" ); - lua_pushboolean( L, false ); - return 1; - } - lua_pushstring( L, GetFileName( lua_tostring( L, 1 ) ) ); + lua_pushstring( L, GetFileName( luaL_checkstring( L, 1 ) ) ); return 1; } /* -> filePath = RL.GetFileNameWithoutExt( string filePath ) +> fileName = RL.GetFileNameWithoutExt( string filePath ) -Get filename string without extension ( Uses static string ) +Get filename string without extension (Uses static string) -- Failure return false - Success return string */ int lcoreGetFileNameWithoutExt( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetFileNameWithoutExt( string filePath )" ); - lua_pushboolean( L, false ); - return 1; - } - lua_pushstring( L, GetFileNameWithoutExt( lua_tostring( L, 1 ) ) ); + lua_pushstring( L, GetFileNameWithoutExt( luaL_checkstring( L, 1 ) ) ); return 1; } @@ -2080,18 +1750,12 @@ int lcoreGetFileNameWithoutExt( lua_State *L ) { /* > filePath = RL.GetDirectoryPath( string filePath ) -Get full path for a given fileName with path ( Uses static string ) +Get full path for a given fileName with path (Uses static string) -- Failure return false - Success return string */ int lcoreGetDirectoryPath( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetDirectoryPath( string filePath )" ); - lua_pushboolean( L, false ); - return 1; - } - lua_pushstring( L, GetDirectoryPath( lua_tostring( L, 1 ) ) ); + lua_pushstring( L, GetDirectoryPath( luaL_checkstring( L, 1 ) ) ); return 1; } @@ -2099,18 +1763,12 @@ int lcoreGetDirectoryPath( lua_State *L ) { /* > directory = RL.GetPrevDirectoryPath( string dirPath ) -Get previous directory path for a given path ( Uses static string ) +Get previous directory path for a given path (Uses static string) -- Failure return false - Success return string */ int lcoreGetPrevDirectoryPath( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetPrevDirectoryPath( string dirPath )" ); - lua_pushboolean( L, false ); - return 1; - } - lua_pushstring( L, GetPrevDirectoryPath( lua_tostring( L, 1 ) ) ); + lua_pushstring( L, GetPrevDirectoryPath( luaL_checkstring( L, 1 ) ) ); return 1; } @@ -2118,12 +1776,13 @@ int lcoreGetPrevDirectoryPath( lua_State *L ) { /* > directory = RL.GetWorkingDirectory() -Get current working directory ( Uses static string ) +Get current working directory (Uses static string) - Success return string */ int lcoreGetWorkingDirectory( lua_State *L ) { lua_pushstring( L, GetWorkingDirectory() ); + return 1; } @@ -2132,16 +1791,10 @@ int lcoreGetWorkingDirectory( lua_State *L ) { Load directory filepaths -- Failure return false - Success return string{} */ int lcoreLoadDirectoryFiles( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.LoadDirectoryFiles( string dirPath )" ); - lua_pushboolean( L, false ); - return 1; - } - FilePathList files = LoadDirectoryFiles( lua_tostring( L, 1 ) ); + FilePathList files = LoadDirectoryFiles( luaL_checkstring( L, 1 ) ); lua_createtable( L, files.count, 0 ); @@ -2159,18 +1812,12 @@ int lcoreLoadDirectoryFiles( lua_State *L ) { Load directory filepaths with extension filtering and recursive directory scan -- Failure return false - Success return string{} */ int lcoreLoadDirectoryFilesEx( lua_State *L ) { - if ( !lua_isstring( L, 1 ) || !lua_isstring( L, 2 ) || !lua_isboolean( L, 3 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.LoadDirectoryFilesEx( string dirPath )" ); - lua_pushboolean( L, false ); - return 1; - } - bool scanSubdirs = lua_toboolean( L, 3 ); + bool scanSubdirs = uluaGetBoolean( L, 3 ); - FilePathList files = LoadDirectoryFilesEx( lua_tostring( L, 1 ), lua_tostring( L, 2 ), scanSubdirs ); + FilePathList files = LoadDirectoryFilesEx( luaL_checkstring( L, 1 ), luaL_checkstring( L, 2 ), scanSubdirs ); lua_createtable( L, files.count, 0 ); @@ -2188,16 +1835,10 @@ int lcoreLoadDirectoryFilesEx( lua_State *L ) { Change working directory, return true on success -- Failure return false -- Success return true +- Success return bool */ int lcoreChangeDirectory( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.ChangeDirectory( string directory )" ); - lua_pushboolean( L, false ); - return 1; - } - lua_pushboolean( L, ChangeDirectory( lua_tostring( L, 1 ) ) ); + lua_pushboolean( L, ChangeDirectory( luaL_checkstring( L, 1 ) ) ); return 1; } @@ -2207,22 +1848,16 @@ int lcoreChangeDirectory( lua_State *L ) { Check if a given path is a file or a directory -- Failure return nil - Success return bool */ int lcoreIsPathFile( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.IsPathFile( string path )" ); - lua_pushnil( L ); - return 1; - } - lua_pushboolean( L, IsPathFile( lua_tostring( L, 1 ) ) ); + lua_pushboolean( L, IsPathFile( luaL_checkstring( L, 1 ) ) ); return 1; } /* -> fileDropped = RL.IsFileDropped() +> iSFileDropped = RL.IsFileDropped() Check if a file has been dropped into window @@ -2230,6 +1865,7 @@ Check if a file has been dropped into window */ int lcoreIsFileDropped( lua_State *L ) { lua_pushboolean( L, IsFileDropped() ); + return 1; } @@ -2257,18 +1893,12 @@ int lcoreLoadDroppedFiles( lua_State *L ) { /* > time = RL.GetFileModTime( string fileName ) -Get file modification time ( Last write time ) +Get file modification time (Last write time) -- Failure return false - Success return int */ int lcoreGetFileModTime( lua_State *L ) { - if ( !lua_isstring( L, 1 ) ) { - TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.GetFileModTime( string fileName )" ); - lua_pushboolean( L, false ); - return 1; - } - lua_pushinteger( L, GetFileModTime( lua_tostring( L, 1 ) ) ); + lua_pushinteger( L, GetFileModTime( luaL_checkstring( L, 1 ) ) ); return 1; } @@ -2962,73 +2592,3 @@ int lcoreGetScreenToWorld2D( lua_State *L ) { return 1; } - -/* -> buffer = RL.LoadBuffer( data{} buffer, int type ) - -Creates buffer as userdata. Type should be one of the Buffer types - -- Success return Buffer -*/ -int lcoreLoadBuffer( lua_State *L ) { - luaL_checktype( L, 1, LUA_TTABLE ); - int type = luaL_checkinteger( L, 2 ); - - Buffer *buffer = lua_newuserdata( L, sizeof( Buffer ) ); - int len = uluaGetTableLenIndex( L, 1 ); - - switch ( type ) { - case BUFFER_UNSIGNED_CHAR: - buffer->size = len * sizeof( unsigned char ); - break; - case BUFFER_UNSIGNED_SHORT: - buffer->size = len * sizeof( unsigned short ); - break; - case BUFFER_UNSIGNED_INT: - buffer->size = len * sizeof( unsigned int ); - break; - case BUFFER_FLOAT: - buffer->size = len * sizeof( float ); - break; - default: - break; - } - buffer->data = malloc( buffer->size ); - - int t = 1; - int i = 0; - unsigned char *up = buffer->data; - unsigned short *sp = buffer->data; - unsigned int *ip = buffer->data; - float *fp = buffer->data; - - lua_pushnil( L ); - - while ( lua_next( L, t ) != 0 ) { - switch ( type ) { - case BUFFER_UNSIGNED_CHAR: - *up = (unsigned char)lua_tointeger( L, -1 ); - up++; - break; - case BUFFER_UNSIGNED_SHORT: - *sp = (unsigned short)lua_tointeger( L, -1 ); - up++; - break; - case BUFFER_UNSIGNED_INT: - *ip = (unsigned int)lua_tointeger( L, -1 ); - up++; - break; - case BUFFER_FLOAT: - *fp = (float)lua_tonumber( L, -1 ); - fp++; - break; - default: - break; - } - lua_pop( L, 1 ); - i++; - } - luaL_setmetatable( L, "Buffer" ); - - return 1; -} |
