diff options
| author | jussi | 2023-11-09 21:24:58 +0200 |
|---|---|---|
| committer | jussi | 2023-11-09 21:24:58 +0200 |
| commit | e056446750bff6db15842aea662f18a322052d8c (patch) | |
| tree | e63e0c19f45408c9366d617509f7208102e94884 | |
| parent | ef75e2530dd92c55ba6b2462fe71fa888e1883df (diff) | |
| download | reilua-enhanced-e056446750bff6db15842aea662f18a322052d8c.tar.gz reilua-enhanced-e056446750bff6db15842aea662f18a322052d8c.tar.bz2 reilua-enhanced-e056446750bff6db15842aea662f18a322052d8c.zip | |
Organized core functions.
| -rw-r--r-- | API.md | 730 | ||||
| -rw-r--r-- | ReiLua_API.lua | 600 | ||||
| -rw-r--r-- | changelog | 1 | ||||
| -rw-r--r-- | include/core.h | 152 | ||||
| -rw-r--r-- | include/textures.h | 2 | ||||
| -rw-r--r-- | src/core.c | 1424 | ||||
| -rw-r--r-- | src/lua_core.c | 154 | ||||
| -rw-r--r-- | src/textures.c | 24 |
8 files changed, 1544 insertions, 1543 deletions
@@ -3508,7 +3508,7 @@ GLFW event cursor enter/leave --- -## Core - Window +## Core - Window-related functions --- @@ -3746,159 +3746,117 @@ Get clipboard text content --- -## Core - Timing +## Core - Cursor-related functions --- -> RL.SetTargetFPS( int fps ) - -Set target FPS (maximum) - ---- - -> FPS = RL.GetFPS() - -Get current FPS - -- Success return int - ---- - -> delta = RL.GetFrameTime() - -Get time in seconds for last frame drawn (Delta time) +> RL.ShowCursor() -- Success return float +Shows cursor --- -> time = RL.GetTime() - -Get elapsed time in seconds since InitWindow() +> RL.HideCursor() -- Success return float +Hides cursor --- -## Core - Misc - ---- +> hidden = RL.IsCursorHidden() -> RL.TakeScreenshot( string fileName ) +Check if cursor is not visible -Takes a screenshot of current screen (filename extension defines format) +- Success return bool --- -> RL.SetConfigFlags( int flags ) +> RL.EnableCursor() -Setup init configuration flags (view FLAGS) +Enables cursor (unlock cursor) --- -> RL.TraceLog( int logLevel, string text ) +> RL.DisableCursor() -Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) +Disables cursor (lock cursor) --- -> RL.SetTraceLogLevel( int logLevel ) - -Set the current threshold (minimum) log level - ---- +> onSreen = RL.IsCursorOnScreen() -> RL.SetLogLevelInvalid( int logLevel ) +Check if cursor is on the screen -Set the log level for bad function calls and invalid data formats. +- Success return bool --- -> logLevel = RL.GetLogLevelInvalid() - -Get the log level for bad function calls and invalid data formats. - -- Success return int +## Core - Drawing-related functions --- -> RL.OpenURL( string url ) +> RL.ClearBackground( Color color ) -Open URL with default system browser (If available) +Set background color (framebuffer clear color) --- -> enabled = RL.IsGCUnloadEnabled() - -Check if Lua garbage collection is set to unload object data - -- Success return bool - ---- +> RL.BeginDrawing() -## Core - Cursor +Setup canvas (framebuffer) to start drawing --- -> RL.ShowCursor() +> RL.EndDrawing() -Shows cursor +End canvas drawing and swap buffers (double buffering) --- -> RL.HideCursor() +> RL.BeginMode2D( camera2D camera ) -Hides cursor +Begin 2D mode with custom camera (2D) --- -> hidden = RL.IsCursorHidden() - -Check if cursor is not visible +> RL.EndMode2D() -- Success return bool +Ends 2D mode with custom camera --- -> RL.EnableCursor() +> RL.BeginMode3D( camera3D camera ) -Enables cursor (unlock cursor) +Begin 3D mode with custom camera (3D) --- -> RL.DisableCursor() +> RL.EndMode3D() -Disables cursor (lock cursor) +Ends 3D mode and returns to default 2D orthographic mode --- -> onSreen = RL.IsCursorOnScreen() - -Check if cursor is on the screen - -- Success return bool - ---- +> RL.BeginTextureMode( RenderTexture target ) -## Core - Drawing +Begin drawing to render texture --- -> RL.ClearBackground( Color color ) +> RL.EndTextureMode() -Set background color (framebuffer clear color) +Ends drawing to render texture --- -> RL.BeginDrawing() +> RL.BeginShaderMode( Shader shader ) -Setup canvas (framebuffer) to start drawing +Begin custom shader drawing --- -> RL.EndDrawing() +> RL.EndShaderMode() -End canvas drawing and swap buffers (double buffering) +End custom shader drawing (use default shader) --- @@ -3926,7 +3884,7 @@ End scissor mode --- -## Core - Shader +## Core - Shader management functions --- @@ -3958,18 +3916,6 @@ Check if a shader is ready --- -> RL.BeginShaderMode( Shader shader ) - -Begin custom shader drawing - ---- - -> RL.EndShaderMode() - -End custom shader drawing (use default shader) - ---- - > location = RL.GetShaderLocation( Shader shader, string uniformName ) Get shader uniform location @@ -4032,535 +3978,673 @@ Unload shader from GPU memory (VRAM) --- -## Core - Input-related Keyboard +## Core - Screen-space-related functions --- -> pressed = RL.IsKeyPressed( int key ) +> ray = RL.GetMouseRay( Vector2 mousePosition, Camera3D camera ) -Detect if a key has been pressed once +Get a ray trace from mouse position -- Success return bool +- Success return Ray --- -> pressed = RL.IsKeyDown( int key ) +> matrix = RL.GetCameraMatrix( Camera3D camera ) -Detect if a key is being pressed +Get camera transform matrix (view matrix) -- Success return bool +- Success return Matrix --- -> released = RL.IsKeyReleased( int key ) +> matrix = RL.GetCameraMatrix2D( Camera2D camera ) -Detect if a key has been released once +Get camera 2d transform matrix -- Success return bool +- Success return Matrix --- -> released = RL.IsKeyUp( int key ) +> position = RL.GetWorldToScreen( Vector3 position, Camera3D camera ) -Check if a key is NOT being pressed +Get the screen space position for a 3d world space position -- Success return bool +- Success return Vector2 --- -> keycode = RL.GetKeyPressed() +> position = RL.GetWorldToScreenEx( Vector3 position, Camera3D camera, Vector2 size ) -Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty +Get size position for a 3d world space position -- Success return int +- Success return Vector2 --- -> unicode = RL.GetCharPressed() +> position = RL.GetWorldToScreen2D( Vector2 position, Camera2D camera ) -Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty +Get the screen space position for a 2d camera world space position + +- Success return Vector2 + +--- + +> position = RL.GetScreenToWorld2D( Vector2 position, Camera2D camera ) + +Get the world space position for a 2d camera screen space position + +- Success return Vector2 + +--- + +## Core - Timing-related functions + +--- + +> RL.SetTargetFPS( int fps ) + +Set target FPS (maximum) + +--- + +> FPS = RL.GetFPS() + +Get current FPS - Success return int --- -> RL.SetExitKey( int key ) +> delta = RL.GetFrameTime() -Set a custom key to exit program (default is ESC) +Get time in seconds for last frame drawn (Delta time) + +- Success return float --- -> keyName = RL.GetKeyName( int key, int scancode ) +> time = RL.GetTime() -This function returns the name of the specified printable key, encoded as UTF-8. -This is typically the character that key would produce without any modifier keys, -intended for displaying key bindings to the user. For dead keys, it is typically -the diacritic it would add to a character. +Get elapsed time in seconds since InitWindow() -Do not use this function for text input. You will break text input for many -languages even if it happens to work for yours. +- Success return float -If the key is KEY_UNKNOWN, the scancode is used to identify the key, -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. +--- -- Success return string or nil +## Core - Misc --- -> scancode = RL.GetKeyScancode( int key ) +> RL.TakeScreenshot( string fileName ) -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. +Takes a screenshot of current screen (filename extension defines format) + +--- + +> RL.SetConfigFlags( int flags ) + +Setup init configuration flags (view FLAGS) + +--- + +> RL.TraceLog( int logLevel, string text ) + +Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) + +--- + +> RL.SetTraceLogLevel( int logLevel ) + +Set the current threshold (minimum) log level + +--- + +> RL.SetLogLevelInvalid( int logLevel ) + +Set the log level for bad function calls and invalid data formats. + +--- + +> logLevel = RL.GetLogLevelInvalid() + +Get the log level for bad function calls and invalid data formats. - Success return int --- -## Core - Input-related Gamepad +> RL.OpenURL( string url ) + +Open URL with default system browser (If available) --- -> available = RL.IsGamepadAvailable( int gamepad ) +> enabled = RL.IsGCUnloadEnabled() -Detect if a gamepad is available +Check if Lua garbage collection is set to unload object data - Success return bool --- -> pressed = RL.IsGamepadButtonPressed( int gamepad, int button ) +## Core - Files management functions -Detect if a gamepad button has been pressed once +--- + +> path = RL.GetBasePath() + +Return game directory (where main.lua is located) + +- Success return string + +--- + +> fileExists = RL.FileExists( string fileName ) + +Check if file exists - Success return bool --- -> pressed = RL.IsGamepadButtonDown( int gamepad, int button ) +> dirExists = RL.DirectoryExists( string dirPath ) -Detect if a gamepad button is being pressed +Check if a directory path exists - Success return bool --- -> released = RL.IsGamepadButtonReleased( int gamepad, int button ) +> hasFileExtension = RL.IsFileExtension( string fileName, string ext ) -Detect if a gamepad button has been released once +Check file extension (Including point: .png, .wav) - Success return bool --- -> count = RL.GetGamepadAxisCount( int gamepad ) +> length = RL.GetFileLength( string fileName ) -Return gamepad axis count for a gamepad +Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) - Success return int --- -> value = RL.GetGamepadAxisMovement( int gamepad, int axis ) +> extension = RL.GetFileExtension( string fileName ) -Return axis movement value for a gamepad axis +Get pointer to extension for a filename string (Includes dot: '.png') -- Success return float +- Success return string --- -> name = RL.GetGamepadName( int gamepad ) +> fileName = RL.GetFileName( string filePath ) -Return gamepad internal name id +Get pointer to filename for a path string - Success return string --- -## Core - Input-related Mouse +> fileName = RL.GetFileNameWithoutExt( string filePath ) + +Get filename string without extension (Uses static string) + +- Success return string --- -> pressed = RL.IsMouseButtonPressed( int button ) +> filePath = RL.GetDirectoryPath( string filePath ) -Detect if a mouse button has been pressed once +Get full path for a given fileName with path (Uses static string) -- Success return bool +- Success return string --- -> pressed = RL.IsMouseButtonDown( int button ) +> directory = RL.GetPrevDirectoryPath( string dirPath ) -Detect if a mouse button is being pressed +Get previous directory path for a given path (Uses static string) -- Success return bool +- Success return string --- -> released = RL.IsMouseButtonReleased( int button ) +> directory = RL.GetWorkingDirectory() -Detect if a mouse button has been released once +Get current working directory (Uses static string) -- Success return bool +- Success return string --- -> released = RL.IsMouseButtonUp( int button ) +> fileNames = RL.LoadDirectoryFiles( string dirPath ) -Check if a mouse button is NOT being pressed +Load directory filepaths -- Success return bool +- Success return string{} --- -> position = RL.GetMousePosition() +> fileNames = RL.LoadDirectoryFilesEx( string basePath, string filter, bool scanSubdirs ) -Returns mouse position +Load directory filepaths with extension filtering and recursive directory scan -- Success return Vector2 +- Success return string{} --- -> position = RL.GetMouseDelta() +> success = RL.ChangeDirectory( string directory ) -Get mouse delta between frames +Change working directory, return true on success -- Success return Vector2 +- Success return bool --- -> RL.SetMousePosition( Vector2 position ) +> isFile = RL.IsPathFile( string path ) -Set mouse position XY +Check if a given path is a file or a directory + +- Success return bool --- -> RL.SetMouseOffset( Vector2 offset ) +> iSFileDropped = RL.IsFileDropped() -Set mouse offset +Check if a file has been dropped into window + +- Success return bool --- -> RL.SetMouseScale( Vector2 scale ) +> files = RL.LoadDroppedFiles() -Set mouse scaling +Load dropped filepaths + +- Success return string{} --- -> movement = RL.GetMouseWheelMove() +> time = RL.GetFileModTime( string fileName ) -Returns mouse wheel movement Y +Get file modification time (Last write time) -- Success return float +- Success return int --- -> RL.SetMouseCursor( int cursor ) - -Set mouse cursor +## Core - Compression/Encoding functionality --- -## Core - Input-related Touch +> compData = RL.CompressData( Buffer buffer ) + +Compress data (DEFLATE algorithm) + +- Success return Buffer --- -> position = RL.GetTouchPosition( int index ) +> decompData = RL.DecompressData( Buffer compData ) -Get touch position XY for a touch point index (relative to screen size) +Decompress data (DEFLATE algorithm). -- Success return Vector2 +- Success Buffer --- -> id = RL.GetTouchPointId( int index ) +> encodedData, outputSize = RL.EncodeDataBase64( string data ) -Get touch point identifier for given index +Encode data to Base64 string -- Success return int +- Success return string, int --- -> count = RL.GetTouchPointCount() +> decodedData, outputSize = RL.DecodeDataBase64( string data ) -Get touch point identifier for given index +Decode Base64 string data -- Success return int +- Success return string, int --- -## Core - Input-related Gestures +## Core - Input-related functions: keyboard --- -> RL.SetGesturesEnabled( unsigned int flags ) +> pressed = RL.IsKeyPressed( int key ) -Enable a set of gestures using flags +Detect if a key has been pressed once + +- Success return bool --- -> detected = RL.IsGestureDetected( int gesture ) +> pressed = RL.IsKeyDown( int key ) -Check if a gesture have been detected +Detect if a key is being pressed - Success return bool --- -> gesture = RL.GetGestureDetected() +> released = RL.IsKeyReleased( int key ) -Get latest detected gesture +Detect if a key has been released once -- Success return int +- Success return bool --- -> time = RL.GetGestureHoldDuration() +> released = RL.IsKeyUp( int key ) -Get gesture hold time in milliseconds +Check if a key is NOT being pressed -- Success return float +- Success return bool --- -> vector = RL.GetGestureDragVector() +> keycode = RL.GetKeyPressed() -Get gesture drag vector +Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty -- Success return Vector2 +- Success return int --- -> angle = RL.GetGestureDragAngle() +> unicode = RL.GetCharPressed() -Get gesture drag angle +Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty -- Success return float +- Success return int --- -> vector = RL.GetGesturePinchVector() +> RL.SetExitKey( int key ) -Get gesture pinch delta +Set a custom key to exit program (default is ESC) -- Success return Vector2 +--- + +> keyName = RL.GetKeyName( int key, int scancode ) + +This function returns the name of the specified printable key, encoded as UTF-8. +This is typically the character that key would produce without any modifier keys, +intended for displaying key bindings to the user. For dead keys, it is typically +the diacritic it would add to a character. + +Do not use this function for text input. You will break text input for many +languages even if it happens to work for yours. + +If the key is KEY_UNKNOWN, the scancode is used to identify the key, +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. + +- Success return string or nil --- -> angle = RL.GetGesturePinchAngle() +> scancode = RL.GetKeyScancode( int key ) -Get gesture pinch angle +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. -- Success return float +- Success return int --- -## Core - File +## Core - Input-related functions: gamepads --- -> path = RL.GetBasePath() +> available = RL.IsGamepadAvailable( int gamepad ) -Return game directory (where main.lua is located) +Detect if a gamepad is available -- Success return string +- Success return bool --- -> fileExists = RL.FileExists( string fileName ) +> pressed = RL.IsGamepadButtonPressed( int gamepad, int button ) -Check if file exists +Detect if a gamepad button has been pressed once - Success return bool --- -> dirExists = RL.DirectoryExists( string dirPath ) +> pressed = RL.IsGamepadButtonDown( int gamepad, int button ) -Check if a directory path exists +Detect if a gamepad button is being pressed - Success return bool --- -> hasFileExtension = RL.IsFileExtension( string fileName, string ext ) +> released = RL.IsGamepadButtonReleased( int gamepad, int button ) -Check file extension (Including point: .png, .wav) +Detect if a gamepad button has been released once - Success return bool --- -> length = RL.GetFileLength( string fileName ) +> count = RL.GetGamepadAxisCount( int gamepad ) -Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) +Return gamepad axis count for a gamepad - Success return int --- -> extension = RL.GetFileExtension( string fileName ) +> value = RL.GetGamepadAxisMovement( int gamepad, int axis ) -Get pointer to extension for a filename string (Includes dot: '.png') +Return axis movement value for a gamepad axis -- Success return string +- Success return float --- -> fileName = RL.GetFileName( string filePath ) +> name = RL.GetGamepadName( int gamepad ) -Get pointer to filename for a path string +Return gamepad internal name id - Success return string --- -> fileName = RL.GetFileNameWithoutExt( string filePath ) +## Core - Input-related functions: mouse -Get filename string without extension (Uses static string) +--- -- Success return string +> pressed = RL.IsMouseButtonPressed( int button ) + +Detect if a mouse button has been pressed once + +- Success return bool --- -> filePath = RL.GetDirectoryPath( string filePath ) +> pressed = RL.IsMouseButtonDown( int button ) -Get full path for a given fileName with path (Uses static string) +Detect if a mouse button is being pressed -- Success return string +- Success return bool --- -> directory = RL.GetPrevDirectoryPath( string dirPath ) +> released = RL.IsMouseButtonReleased( int button ) -Get previous directory path for a given path (Uses static string) +Detect if a mouse button has been released once -- Success return string +- Success return bool --- -> directory = RL.GetWorkingDirectory() +> released = RL.IsMouseButtonUp( int button ) -Get current working directory (Uses static string) +Check if a mouse button is NOT being pressed -- Success return string +- Success return bool --- -> fileNames = RL.LoadDirectoryFiles( string dirPath ) +> position = RL.GetMousePosition() -Load directory filepaths +Returns mouse position -- Success return string{} +- Success return Vector2 --- -> fileNames = RL.LoadDirectoryFilesEx( string basePath, string filter, bool scanSubdirs ) +> position = RL.GetMouseDelta() -Load directory filepaths with extension filtering and recursive directory scan +Get mouse delta between frames -- Success return string{} +- Success return Vector2 --- -> success = RL.ChangeDirectory( string directory ) +> RL.SetMousePosition( Vector2 position ) -Change working directory, return true on success +Set mouse position XY -- Success return bool +--- + +> RL.SetMouseOffset( Vector2 offset ) + +Set mouse offset --- -> isFile = RL.IsPathFile( string path ) +> RL.SetMouseScale( Vector2 scale ) -Check if a given path is a file or a directory +Set mouse scaling -- Success return bool +--- + +> movement = RL.GetMouseWheelMove() + +Returns mouse wheel movement Y + +- Success return float --- -> iSFileDropped = RL.IsFileDropped() +> RL.SetMouseCursor( int cursor ) -Check if a file has been dropped into window +Set mouse cursor -- Success return bool +--- + +## Core - Input-related functions: touch --- -> files = RL.LoadDroppedFiles() +> position = RL.GetTouchPosition( int index ) -Load dropped filepaths +Get touch position XY for a touch point index (relative to screen size) -- Success return string{} +- Success return Vector2 --- -> time = RL.GetFileModTime( string fileName ) +> id = RL.GetTouchPointId( int index ) -Get file modification time (Last write time) +Get touch point identifier for given index - Success return int --- -## Core - Compression/Encoding functionality +> count = RL.GetTouchPointCount() + +Get touch point identifier for given index + +- Success return int --- -> compData = RL.CompressData( Buffer buffer ) +## Core - Input-related functions: gestures -Compress data (DEFLATE algorithm) +--- -- Success return Buffer +> RL.SetGesturesEnabled( unsigned int flags ) + +Enable a set of gestures using flags --- -> decompData = RL.DecompressData( Buffer compData ) +> detected = RL.IsGestureDetected( int gesture ) -Decompress data (DEFLATE algorithm). +Check if a gesture have been detected -- Success Buffer +- Success return bool --- -> encodedData, outputSize = RL.EncodeDataBase64( string data ) +> gesture = RL.GetGestureDetected() -Encode data to Base64 string +Get latest detected gesture -- Success return string, int +- Success return int --- -> decodedData, outputSize = RL.DecodeDataBase64( string data ) +> time = RL.GetGestureHoldDuration() -Decode Base64 string data +Get gesture hold time in milliseconds -- Success return string, int +- Success return float --- -## Core - Camera2D +> vector = RL.GetGestureDragVector() + +Get gesture drag vector + +- Success return Vector2 --- -> camera2D = RL.CreateCamera2D() +> angle = RL.GetGestureDragAngle() -Return camera2D set to default configuration +Get gesture drag angle -- Success return Camera2D +- Success return float --- -> RL.BeginMode2D( camera2D camera ) +> vector = RL.GetGesturePinchVector() -Begin 2D mode with custom camera (2D) +Get gesture pinch delta + +- Success return Vector2 --- -> RL.EndMode2D() +> angle = RL.GetGesturePinchAngle() -Ends 2D mode with custom camera +Get gesture pinch angle + +- Success return float + +--- + +## Core - Camera2D System functions + +--- + +> camera2D = RL.CreateCamera2D() + +Return camera2D set to default configuration + +- Success return Camera2D --- @@ -4620,7 +4704,7 @@ Get camera2D zoom --- -## Core - Camera3D +## Core - Camera3D System functions --- @@ -4632,18 +4716,6 @@ Return camera3D id set to default configuration --- -> RL.BeginMode3D( camera3D camera ) - -Begin 3D mode with custom camera (3D) - ---- - -> RL.EndMode3D() - -Ends 3D mode and returns to default 2D orthographic mode - ---- - > RL.SetCamera3DPosition( camera3D camera, Vector3 position ) Set camera position (Remember to call "RL.UpdateCamera3D()" to apply changes) @@ -4818,67 +4890,7 @@ Update camera movement, movement/rotation values should be provided by user --- -## Core - Screen-space - ---- - -> ray = RL.GetMouseRay( Vector2 mousePosition, Camera3D camera ) - -Get a ray trace from mouse position - -- Success return Ray - ---- - -> matrix = RL.GetCameraMatrix( Camera3D camera ) - -Get camera transform matrix (view matrix) - -- Success return Matrix - ---- - -> matrix = RL.GetCameraMatrix2D( Camera2D camera ) - -Get camera 2d transform matrix - -- Success return Matrix - ---- - -> position = RL.GetWorldToScreen( Vector3 position, Camera3D camera ) - -Get the screen space position for a 3d world space position - -- Success return Vector2 - ---- - -> position = RL.GetWorldToScreenEx( Vector3 position, Camera3D camera, Vector2 size ) - -Get size position for a 3d world space position - -- Success return Vector2 - ---- - -> position = RL.GetWorldToScreen2D( Vector2 position, Camera2D camera ) - -Get the screen space position for a 2d camera world space position - -- Success return Vector2 - ---- - -> position = RL.GetScreenToWorld2D( Vector2 position, Camera2D camera ) - -Get the world space position for a 2d camera screen space position - -- Success return Vector2 - ---- - -## Core - Buffer +## Core - Buffer management functions --- @@ -5758,18 +5770,6 @@ Draws a texture (or part of it) that stretches or shrinks nicely --- -> RL.BeginTextureMode( RenderTexture target ) - -Begin drawing to render texture - ---- - -> RL.EndTextureMode() - -Ends drawing to render texture - ---- - ## Textures - Texture Configuration --- diff --git a/ReiLua_API.lua b/ReiLua_API.lua index 98df0a4..5ca1c59 100644 --- a/ReiLua_API.lua +++ b/ReiLua_API.lua @@ -1208,7 +1208,7 @@ RL.EVENT_MOUSE_CURSOR_POS=8 RL.EVENT_MOUSE_SCROLL=9 ---GLFW event cursor enter/leave RL.EVENT_CURSOR_ENTER=10 --- Core - Window +-- Core - Window-related functions ---Check if window has been initialized successfully ---- Success return bool @@ -1376,72 +1376,7 @@ function RL.SetClipboardText( text ) end ---@return any text function RL.GetClipboardText() end --- Core - Timing - ----Set target FPS (maximum) ----@param fps integer ----@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) ----- Success return float ----@return any delta -function RL.GetFrameTime() end - ----Get elapsed time in seconds since InitWindow() ----- Success return float ----@return any time -function RL.GetTime() end - --- Core - Misc - ----Takes a screenshot of current screen (filename extension defines format) ----@param fileName string ----@return any RL.TakeScreenshot -function RL.TakeScreenshot( fileName ) end - ----Setup init configuration flags (view FLAGS) ----@param flags integer ----@return any RL.SetConfigFlags -function RL.SetConfigFlags( flags ) end - ----Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) ----@param logLevel integer ----@param text string ----@return any RL.TraceLog -function RL.TraceLog( logLevel, text ) end - ----Set the current threshold (minimum) log level ----@param logLevel integer ----@return any RL.SetTraceLogLevel -function RL.SetTraceLogLevel( logLevel ) end - ----Set the log level for bad function calls and invalid data formats. ----@param logLevel integer ----@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) ----@param url string ----@return any RL.OpenURL -function RL.OpenURL( url ) end - ----Check if Lua garbage collection is set to unload object data ----- Success return bool ----@return any enabled -function RL.IsGCUnloadEnabled() end - --- Core - Cursor +-- Core - Cursor-related functions ---Shows cursor ---@return any RL.ShowCursor @@ -1469,7 +1404,7 @@ function RL.DisableCursor() end ---@return any onSreen function RL.IsCursorOnScreen() end --- Core - Drawing +-- Core - Drawing-related functions ---Set background color (framebuffer clear color) ---@param color table @@ -1484,6 +1419,42 @@ function RL.BeginDrawing() end ---@return any RL.EndDrawing function RL.EndDrawing() end +---Begin 2D mode with custom camera (2D) +---@param camera any +---@return any RL.BeginMode2D +function RL.BeginMode2D( camera ) end + +---Ends 2D mode with custom camera +---@return any RL.EndMode2D +function RL.EndMode2D() end + +---Begin 3D mode with custom camera (3D) +---@param camera any +---@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 + +---Begin drawing to render texture +---@param target any +---@return any RL.BeginTextureMode +function RL.BeginTextureMode( target ) end + +---Ends drawing to render texture +---@return any RL.EndTextureMode +function RL.EndTextureMode() end + +---Begin custom shader drawing +---@param shader any +---@return any RL.BeginShaderMode +function RL.BeginShaderMode( shader ) end + +---End custom shader drawing (use default shader) +---@return any RL.EndShaderMode +function RL.EndShaderMode() end + ---Begin blending mode (BLEND_ALPHA, BLEND_ADDITIVE, BLEND_MULTIPLIED...) ---@param mode integer ---@return any RL.BeginBlendMode @@ -1502,7 +1473,7 @@ function RL.BeginScissorMode( rectange ) end ---@return any RL.EndScissorMode function RL.EndScissorMode() end --- Core - Shader +-- Core - Shader management functions ---Load shader from files and bind default locations. ---NOTE: Set nil if no shader @@ -1528,15 +1499,6 @@ function RL.LoadShaderFromMemory( vsCode, fsCode ) end ---@return any isReady function RL.IsShaderReady( shader ) end ----Begin custom shader drawing ----@param shader any ----@return any RL.BeginShaderMode -function RL.BeginShaderMode( shader ) end - ----End custom shader drawing (use default shader) ----@return any RL.EndShaderMode -function RL.EndShaderMode() end - ---Get shader uniform location ---- Success return int ---@param shader any @@ -1603,7 +1565,259 @@ function RL.SetShaderValueV( shader, locIndex, values, uniformType, count ) end ---@return any RL.UnloadShader function RL.UnloadShader( shader ) end --- Core - Input-related Keyboard +-- Core - Screen-space-related functions + +---Get a ray trace from mouse position +---- Success return Ray +---@param mousePosition table +---@param camera any +---@return any ray +function RL.GetMouseRay( mousePosition, camera ) end + +---Get camera transform matrix (view matrix) +---- Success return Matrix +---@param camera any +---@return any matrix +function RL.GetCameraMatrix( camera ) end + +---Get camera 2d transform matrix +---- 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 +---- Success return Vector2 +---@param position table +---@param camera any +---@return any position +function RL.GetWorldToScreen( position, camera ) end + +---Get size position for a 3d world space position +---- Success return Vector2 +---@param position table +---@param camera any +---@param size table +---@return any position +function RL.GetWorldToScreenEx( position, camera, size ) end + +---Get the screen space position for a 2d camera world space position +---- Success return Vector2 +---@param position table +---@param camera any +---@return any position +function RL.GetWorldToScreen2D( position, camera ) end + +---Get the world space position for a 2d camera screen space position +---- Success return Vector2 +---@param position table +---@param camera any +---@return any position +function RL.GetScreenToWorld2D( position, camera ) end + +-- Core - Timing-related functions + +---Set target FPS (maximum) +---@param fps integer +---@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) +---- Success return float +---@return any delta +function RL.GetFrameTime() end + +---Get elapsed time in seconds since InitWindow() +---- Success return float +---@return any time +function RL.GetTime() end + +-- Core - Misc + +---Takes a screenshot of current screen (filename extension defines format) +---@param fileName string +---@return any RL.TakeScreenshot +function RL.TakeScreenshot( fileName ) end + +---Setup init configuration flags (view FLAGS) +---@param flags integer +---@return any RL.SetConfigFlags +function RL.SetConfigFlags( flags ) end + +---Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) +---@param logLevel integer +---@param text string +---@return any RL.TraceLog +function RL.TraceLog( logLevel, text ) end + +---Set the current threshold (minimum) log level +---@param logLevel integer +---@return any RL.SetTraceLogLevel +function RL.SetTraceLogLevel( logLevel ) end + +---Set the log level for bad function calls and invalid data formats. +---@param logLevel integer +---@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) +---@param url string +---@return any RL.OpenURL +function RL.OpenURL( url ) end + +---Check if Lua garbage collection is set to unload object data +---- Success return bool +---@return any enabled +function RL.IsGCUnloadEnabled() end + +-- Core - Files management functions + +---Return game directory (where main.lua is located) +---- Success return string +---@return any path +function RL.GetBasePath() end + +---Check if file exists +---- Success return bool +---@param fileName string +---@return any fileExists +function RL.FileExists( fileName ) end + +---Check if a directory path exists +---- Success return bool +---@param dirPath string +---@return any dirExists +function RL.DirectoryExists( dirPath ) end + +---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) +---- 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') +---- Success return string +---@param fileName string +---@return any extension +function RL.GetFileExtension( fileName ) end + +---Get pointer to filename for a path string +---- Success return string +---@param filePath string +---@return any fileName +function RL.GetFileName( filePath ) end + +---Get filename string without extension (Uses static string) +---- Success return string +---@param filePath string +---@return any fileName +function RL.GetFileNameWithoutExt( filePath ) end + +---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) +---- Success return string +---@param dirPath string +---@return any directory +function RL.GetPrevDirectoryPath( dirPath ) end + +---Get current working directory (Uses static string) +---- Success return string +---@return any directory +function RL.GetWorkingDirectory() end + +---Load directory filepaths +---- Success return string{} +---@param dirPath string +---@return any fileNames +function RL.LoadDirectoryFiles( dirPath ) end + +---Load directory filepaths with extension filtering and recursive directory scan +---- Success return string{} +---@param basePath string +---@param filter string +---@param scanSubdirs boolean +---@return any fileNames +function RL.LoadDirectoryFilesEx( basePath, filter, scanSubdirs ) end + +---Change working directory, return true on success +---- Success return bool +---@param directory string +---@return any success +function RL.ChangeDirectory( directory ) end + +---Check if a given path is a file or a directory +---- Success return bool +---@param path string +---@return any isFile +function RL.IsPathFile( path ) end + +---Check if a file has been dropped into window +---- Success return bool +---@return any iSFileDropped +function RL.IsFileDropped() end + +---Load dropped filepaths +---- Success return string{} +---@return any files +function RL.LoadDroppedFiles() end + +---Get file modification time (Last write time) +---- Success return int +---@param fileName string +---@return any time +function RL.GetFileModTime( fileName ) end + +-- Core - Compression/Encoding functionality + +---Compress data (DEFLATE algorithm) +---- Success return Buffer +---@param buffer any +---@return any compData +function RL.CompressData( buffer ) end + +---Decompress data (DEFLATE algorithm). +---- Success Buffer +---@param compData any +---@return any decompData +function RL.DecompressData( compData ) end + +---Encode data to Base64 string +---- Success return string, int +---@param data string +---@return any encodedData +---@return any outputSize +function RL.EncodeDataBase64( data ) end + +---Decode Base64 string data +---- Success return string, int +---@param data string +---@return any decodedData +---@return any outputSize +function RL.DecodeDataBase64( data ) end + +-- Core - Input-related functions: keyboard ---Detect if a key has been pressed once ---- Success return bool @@ -1667,7 +1881,7 @@ function RL.GetKeyName( key, scancode ) end ---@return any scancode function RL.GetKeyScancode( key ) end --- Core - Input-related Gamepad +-- Core - Input-related functions: gamepads ---Detect if a gamepad is available ---- Success return bool @@ -1715,7 +1929,7 @@ function RL.GetGamepadAxisMovement( gamepad, axis ) end ---@return any name function RL.GetGamepadName( gamepad ) end --- Core - Input-related Mouse +-- Core - Input-related functions: mouse ---Detect if a mouse button has been pressed once ---- Success return bool @@ -1776,7 +1990,7 @@ function RL.GetMouseWheelMove() end ---@return any RL.SetMouseCursor function RL.SetMouseCursor( cursor ) end --- Core - Input-related Touch +-- Core - Input-related functions: touch ---Get touch position XY for a touch point index (relative to screen size) ---- Success return Vector2 @@ -1795,7 +2009,7 @@ function RL.GetTouchPointId( index ) end ---@return any count function RL.GetTouchPointCount() end --- Core - Input-related Gestures +-- Core - Input-related functions: gestures ---Enable a set of gestures using flags ---@param int any @@ -1838,159 +2052,13 @@ function RL.GetGesturePinchVector() end ---@return any angle function RL.GetGesturePinchAngle() end --- Core - File - ----Return game directory (where main.lua is located) ----- Success return string ----@return any path -function RL.GetBasePath() end - ----Check if file exists ----- Success return bool ----@param fileName string ----@return any fileExists -function RL.FileExists( fileName ) end - ----Check if a directory path exists ----- Success return bool ----@param dirPath string ----@return any dirExists -function RL.DirectoryExists( dirPath ) end - ----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) ----- 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') ----- Success return string ----@param fileName string ----@return any extension -function RL.GetFileExtension( fileName ) end - ----Get pointer to filename for a path string ----- Success return string ----@param filePath string ----@return any fileName -function RL.GetFileName( filePath ) end - ----Get filename string without extension (Uses static string) ----- Success return string ----@param filePath string ----@return any fileName -function RL.GetFileNameWithoutExt( filePath ) end - ----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) ----- Success return string ----@param dirPath string ----@return any directory -function RL.GetPrevDirectoryPath( dirPath ) end - ----Get current working directory (Uses static string) ----- Success return string ----@return any directory -function RL.GetWorkingDirectory() end - ----Load directory filepaths ----- Success return string{} ----@param dirPath string ----@return any fileNames -function RL.LoadDirectoryFiles( dirPath ) end - ----Load directory filepaths with extension filtering and recursive directory scan ----- Success return string{} ----@param basePath string ----@param filter string ----@param scanSubdirs boolean ----@return any fileNames -function RL.LoadDirectoryFilesEx( basePath, filter, scanSubdirs ) end - ----Change working directory, return true on success ----- Success return bool ----@param directory string ----@return any success -function RL.ChangeDirectory( directory ) end - ----Check if a given path is a file or a directory ----- Success return bool ----@param path string ----@return any isFile -function RL.IsPathFile( path ) end - ----Check if a file has been dropped into window ----- Success return bool ----@return any iSFileDropped -function RL.IsFileDropped() end - ----Load dropped filepaths ----- Success return string{} ----@return any files -function RL.LoadDroppedFiles() end - ----Get file modification time (Last write time) ----- Success return int ----@param fileName string ----@return any time -function RL.GetFileModTime( fileName ) end - --- Core - Compression/Encoding functionality - ----Compress data (DEFLATE algorithm) ----- Success return Buffer ----@param buffer any ----@return any compData -function RL.CompressData( buffer ) end - ----Decompress data (DEFLATE algorithm). ----- Success Buffer ----@param compData any ----@return any decompData -function RL.DecompressData( compData ) end - ----Encode data to Base64 string ----- Success return string, int ----@param data string ----@return any encodedData ----@return any outputSize -function RL.EncodeDataBase64( data ) end - ----Decode Base64 string data ----- Success return string, int ----@param data string ----@return any decodedData ----@return any outputSize -function RL.DecodeDataBase64( data ) end - --- Core - Camera2D +-- Core - Camera2D System functions ---Return camera2D set to default configuration ---- Success return Camera2D ---@return any camera2D function RL.CreateCamera2D() end ----Begin 2D mode with custom camera (2D) ----@param camera any ----@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) ---@param camera any ---@param target table @@ -2039,22 +2107,13 @@ function RL.GetCamera2DRotation( camera ) end ---@return any zoom function RL.GetCamera2DZoom( camera ) end --- Core - Camera3D +-- Core - Camera3D System functions ---Return camera3D id set to default configuration ---- Success return int ---@return any camera function RL.CreateCamera3D() end ----Begin 3D mode with custom camera (3D) ----@param camera any ----@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) ---@param camera any ---@param position table @@ -2218,57 +2277,7 @@ function RL.UpdateCamera3D( camera, mode ) end ---@return any RL.UpdateCamera3DPro function RL.UpdateCamera3DPro( camera, movement, rotation, zoom ) end --- Core - Screen-space - ----Get a ray trace from mouse position ----- Success return Ray ----@param mousePosition table ----@param camera any ----@return any ray -function RL.GetMouseRay( mousePosition, camera ) end - ----Get camera transform matrix (view matrix) ----- Success return Matrix ----@param camera any ----@return any matrix -function RL.GetCameraMatrix( camera ) end - ----Get camera 2d transform matrix ----- 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 ----- Success return Vector2 ----@param position table ----@param camera any ----@return any position -function RL.GetWorldToScreen( position, camera ) end - ----Get size position for a 3d world space position ----- Success return Vector2 ----@param position table ----@param camera any ----@param size table ----@return any position -function RL.GetWorldToScreenEx( position, camera, size ) end - ----Get the screen space position for a 2d camera world space position ----- Success return Vector2 ----@param position table ----@param camera any ----@return any position -function RL.GetWorldToScreen2D( position, camera ) end - ----Get the world space position for a 2d camera screen space position ----- Success return Vector2 ----@param position table ----@param camera any ----@return any position -function RL.GetScreenToWorld2D( position, camera ) end - --- Core - Buffer +-- Core - Buffer management functions ---Load Buffer. Type should be one of the Buffer types ---- Success return Buffer @@ -3167,15 +3176,6 @@ function RL.DrawTexturePro( texture, source, dest, origin, rotation, tint ) end ---@return any RL.DrawTextureNPatch function RL.DrawTextureNPatch( texture, nPatchInfo, dest, origin, rotation, tint ) end ----Begin drawing to render texture ----@param target any ----@return any RL.BeginTextureMode -function RL.BeginTextureMode( target ) end - ----Ends drawing to render texture ----@return any RL.EndTextureMode -function RL.EndTextureMode() end - -- Textures - Texture Configuration ---Generate GPU mipmaps for a texture @@ -47,6 +47,7 @@ DETAILED CHANGES: - ADDED: GetModelBoundingBox. - ADDED: DrawModelWires and DrawModelWiresEx. - ADDED: LoadMaterials. + - CHANGED: Organized core functions. ------------------------------------------------------------------------ Release: ReiLua version 0.5.0 Using Raylib 4.5 diff --git a/include/core.h b/include/core.h index ad50f1b..32aa8f9 100644 --- a/include/core.h +++ b/include/core.h @@ -3,7 +3,7 @@ #include "lua_core.h" void unloadBuffer( Buffer *buffer ); -/* Window. */ +/* Window-related functions. */ int lcoreIsWindowReady( lua_State *L ); int lcoreIsWindowFullscreen( lua_State *L ); int lcoreIsWindowHidden( lua_State *L ); @@ -36,41 +36,33 @@ int lcoreGetMonitorName( lua_State *L ); int lcoreCloseWindow( lua_State *L ); int lcoreSetClipboardText( lua_State *L ); int lcoreGetClipboardText( lua_State *L ); -/* Timing. */ -int lcoreSetTargetFPS( lua_State *L ); -int lcoreGetFPS( lua_State *L ); -int lcoreGetFrameTime( lua_State *L ); -int lcoreGetTime( lua_State *L ); -/* Misc. */ -int lcoreTakeScreenshot( lua_State *L ); -int lcoreSetConfigFlags( lua_State *L ); -int lcoreTraceLog( lua_State *L ); -int lcoreSetTraceLogLevel( lua_State *L ); -int lcoreSetLogLevelInvalid( lua_State *L ); -int lcoreGetLogLevelInvalid( lua_State *L ); -int lcoreOpenURL( lua_State *L ); -int lcoreIsGCUnloadEnabled( lua_State *L ); -/* Cursor. */ +/* Cursor-related functions. */ int lcoreShowCursor( lua_State *L ); int lcoreHideCursor( lua_State *L ); int lcoreIsCursorHidden( lua_State *L ); int lcoreEnableCursor( lua_State *L ); int lcoreDisableCursor( lua_State *L ); int lcoreIsCursorOnScreen( lua_State *L ); -/* Drawing. */ +/* Drawing-related functions. */ int lcoreClearBackground( lua_State *L ); int lcoreBeginDrawing( lua_State *L ); int lcoreEndDrawing( lua_State *L ); +int lcoreBeginMode2D( lua_State *L ); +int lcoreEndMode2D( lua_State *L ); +int lcoreBeginMode3D( lua_State *L ); +int lcoreEndMode3D( lua_State *L ); +int lcoreBeginTextureMode( lua_State *L ); +int lcoreEndTextureMode( lua_State *L ); +int lcoreBeginShaderMode( lua_State *L ); +int lcoreEndShaderMode( lua_State *L ); int lcoreBeginBlendMode( lua_State *L ); int lcoreEndBlendMode( lua_State *L ); int lcoreBeginScissorMode( lua_State *L ); int lcoreEndScissorMode( lua_State *L ); -/* Shader. */ +/* Shader management functions. */ int lcoreLoadShader( lua_State *L ); int lcoreLoadShaderFromMemory( lua_State *L ); int lcoreIsShaderReady( lua_State *L ); -int lcoreBeginShaderMode( lua_State *L ); -int lcoreEndShaderMode( lua_State *L ); int lcoreGetShaderLocation( lua_State *L ); int lcoreGetShaderLocationAttrib( lua_State *L ); int lcoreSetShaderLocationIndex( lua_State *L ); @@ -80,7 +72,29 @@ int lcoreSetShaderValueTexture( lua_State *L ); int lcoreSetShaderValue( lua_State *L ); int lcoreSetShaderValueV( lua_State *L ); int lcoreUnloadShader( lua_State *L ); -/* File. */ +/* Screen-space-related functions. */ +int lcoreGetMouseRay( lua_State *L ); +int lcoreGetCameraMatrix( lua_State *L ); +int lcoreGetCameraMatrix2D( lua_State *L ); +int lcoreGetWorldToScreen( lua_State *L ); +int lcoreGetWorldToScreenEx( lua_State *L ); +int lcoreGetWorldToScreen2D( lua_State *L ); +int lcoreGetScreenToWorld2D( lua_State *L ); +/* Timing-related functions. */ +int lcoreSetTargetFPS( lua_State *L ); +int lcoreGetFPS( lua_State *L ); +int lcoreGetFrameTime( lua_State *L ); +int lcoreGetTime( lua_State *L ); +/* Misc. functions */ +int lcoreTakeScreenshot( lua_State *L ); +int lcoreSetConfigFlags( lua_State *L ); +int lcoreTraceLog( lua_State *L ); +int lcoreSetTraceLogLevel( lua_State *L ); +int lcoreSetLogLevelInvalid( lua_State *L ); +int lcoreGetLogLevelInvalid( lua_State *L ); +int lcoreOpenURL( lua_State *L ); +int lcoreIsGCUnloadEnabled( lua_State *L ); +/* Files management functions. */ int lcoreGetBasePath( lua_State *L ); int lcoreFileExists( lua_State *L ); int lcoreDirectoryExists( lua_State *L ); @@ -104,47 +118,7 @@ int lcoreCompressData( lua_State *L ); int lcoreDecompressData( lua_State *L ); int lcoreEncodeDataBase64( lua_State *L ); int lcoreDecodeDataBase64( lua_State *L ); -/* Camera2D. */ -int lcoreCreateCamera2D( lua_State *L ); -int lcoreBeginMode2D( lua_State *L ); -int lcoreEndMode2D( lua_State *L ); -int lcoreSetCamera2DTarget( lua_State *L ); -int lcoreSetCamera2DOffset( lua_State *L ); -int lcoreSetCamera2DRotation( lua_State *L ); -int lcoreSetCamera2DZoom( lua_State *L ); -int lcoreGetCamera2DTarget( lua_State *L ); -int lcoreGetCamera2DOffset( lua_State *L ); -int lcoreGetCamera2DRotation( lua_State *L ); -int lcoreGetCamera2DZoom( lua_State *L ); -/* Camera3D. */ -int lcoreCreateCamera3D( lua_State *L ); -int lcoreBeginMode3D( lua_State *L ); -int lcoreEndMode3D( lua_State *L ); -int lcoreSetCamera3DPosition( lua_State *L ); -int lcoreSetCamera3DTarget( lua_State *L ); -int lcoreSetCamera3DUp( lua_State *L ); -int lcoreSetCamera3DFovy( lua_State *L ); -int lcoreSetCamera3DProjection( lua_State *L ); -int lcoreGetCamera3DPosition( lua_State *L ); -int lcoreGetCamera3DTarget( lua_State *L ); -int lcoreGetCamera3DUp( lua_State *L ); -int lcoreGetCamera3DFovy( lua_State *L ); -int lcoreGetCamera3DProjection( lua_State *L ); -int lcoreGetCamera3DForward( lua_State *L ); -int lcoreGetCamera3DUpNormalized( lua_State *L ); -int lcoreGetCamera3DRight( lua_State *L ); -int lcoreCamera3DMoveForward( lua_State *L ); -int lcoreCamera3DMoveUp( lua_State *L ); -int lcoreCamera3DMoveRight( lua_State *L ); -int lcoreCamera3DMoveToTarget( lua_State *L ); -int lcoreCamera3DYaw( lua_State *L ); -int lcoreCamera3DPitch( lua_State *L ); -int lcoreCamera3DRoll( lua_State *L ); -int lcoreGetCamera3DViewMatrix( lua_State *L ); -int lcoreGetCamera3DProjectionMatrix( lua_State *L ); -int lcoreUpdateCamera3D( lua_State *L ); -int lcoreUpdateCamera3DPro( lua_State *L ); -/* Input-related Keyboard. */ +/* Input-related functions: keyboard. */ int lcoreIsKeyPressed( lua_State *L ); int lcoreIsKeyDown( lua_State *L ); int lcoreIsKeyReleased( lua_State *L ); @@ -154,7 +128,7 @@ int lcoreGetCharPressed( lua_State *L ); int lcoreSetExitKey( lua_State *L ); int lcoreGetKeyName( lua_State *L ); int lcoreGetKeyScancode( lua_State *L ); -/* Input-related Gamepad. */ +/* Input-related functions: gamepads. */ int lcoreIsGamepadAvailable( lua_State *L ); int lcoreIsGamepadButtonPressed( lua_State *L ); int lcoreIsGamepadButtonDown( lua_State *L ); @@ -162,7 +136,7 @@ int lcoreIsGamepadButtonReleased( lua_State *L ); int lcoreGetGamepadAxisCount( lua_State *L ); int lcoreGetGamepadAxisMovement( lua_State *L ); int lcoreGetGamepadName( lua_State *L ); -/* Input-related Mouse. */ +/* Input-related functions: mouse. */ int lcoreIsMouseButtonPressed( lua_State *L ); int lcoreIsMouseButtonDown( lua_State *L ); int lcoreIsMouseButtonReleased( lua_State *L ); @@ -174,11 +148,11 @@ int lcoreSetMouseOffset( lua_State *L ); int lcoreSetMouseScale( lua_State *L ); int lcoreGetMouseWheelMove( lua_State *L ); int lcoreSetMouseCursor( lua_State *L ); -/* Input-related Touch */ +/* Input-related functions: touch. */ int lcoreGetTouchPosition( lua_State *L ); int lcoreGetTouchPointId( lua_State *L ); int lcoreGetTouchPointCount( lua_State *L ); -/* Input-related Gestures. */ +/* Input-related functions: gestures. */ int lcoreSetGesturesEnabled( lua_State *L ); int lcoreIsGestureDetected( lua_State *L ); int lcoreGetGestureDetected( lua_State *L ); @@ -187,15 +161,43 @@ int lcoreGetGestureDragVector( lua_State *L ); int lcoreGetGestureDragAngle( lua_State *L ); int lcoreGetGesturePinchVector( lua_State *L ); int lcoreGetGesturePinchAngle( lua_State *L ); -/* Screen-space. */ -int lcoreGetMouseRay( lua_State *L ); -int lcoreGetCameraMatrix( lua_State *L ); -int lcoreGetCameraMatrix2D( lua_State *L ); -int lcoreGetWorldToScreen( lua_State *L ); -int lcoreGetWorldToScreenEx( lua_State *L ); -int lcoreGetWorldToScreen2D( lua_State *L ); -int lcoreGetScreenToWorld2D( lua_State *L ); -/* Buffer. */ +/* Camera2D System functions. */ +int lcoreCreateCamera2D( lua_State *L ); +int lcoreSetCamera2DTarget( lua_State *L ); +int lcoreSetCamera2DOffset( lua_State *L ); +int lcoreSetCamera2DRotation( lua_State *L ); +int lcoreSetCamera2DZoom( lua_State *L ); +int lcoreGetCamera2DTarget( lua_State *L ); +int lcoreGetCamera2DOffset( lua_State *L ); +int lcoreGetCamera2DRotation( lua_State *L ); +int lcoreGetCamera2DZoom( lua_State *L ); +/* Camera3D System functions. */ +int lcoreCreateCamera3D( lua_State *L ); +int lcoreSetCamera3DPosition( lua_State *L ); +int lcoreSetCamera3DTarget( lua_State *L ); +int lcoreSetCamera3DUp( lua_State *L ); +int lcoreSetCamera3DFovy( lua_State *L ); +int lcoreSetCamera3DProjection( lua_State *L ); +int lcoreGetCamera3DPosition( lua_State *L ); +int lcoreGetCamera3DTarget( lua_State *L ); +int lcoreGetCamera3DUp( lua_State *L ); +int lcoreGetCamera3DFovy( lua_State *L ); +int lcoreGetCamera3DProjection( lua_State *L ); +int lcoreGetCamera3DForward( lua_State *L ); +int lcoreGetCamera3DUpNormalized( lua_State *L ); +int lcoreGetCamera3DRight( lua_State *L ); +int lcoreCamera3DMoveForward( lua_State *L ); +int lcoreCamera3DMoveUp( lua_State *L ); +int lcoreCamera3DMoveRight( lua_State *L ); +int lcoreCamera3DMoveToTarget( lua_State *L ); +int lcoreCamera3DYaw( lua_State *L ); +int lcoreCamera3DPitch( lua_State *L ); +int lcoreCamera3DRoll( lua_State *L ); +int lcoreGetCamera3DViewMatrix( lua_State *L ); +int lcoreGetCamera3DProjectionMatrix( lua_State *L ); +int lcoreUpdateCamera3D( lua_State *L ); +int lcoreUpdateCamera3DPro( lua_State *L ); +/* Buffer management functions. */ int lcoreLoadBuffer( lua_State *L ); int lcoreUnloadBuffer( lua_State *L ); int lcoreGetBufferData( lua_State *L ); diff --git a/include/textures.h b/include/textures.h index 353026e..237dc60 100644 --- a/include/textures.h +++ b/include/textures.h @@ -81,8 +81,6 @@ int ltexturesDrawTexture( lua_State *L ); int ltexturesDrawTextureRec( lua_State *L ); int ltexturesDrawTexturePro( lua_State *L ); int ltexturesDrawTextureNPatch( lua_State *L ); -int ltexturesBeginTextureMode( lua_State *L ); -int ltexturesEndTextureMode( lua_State *L ); /* Texture Configuration. */ int ltexturesGenTextureMipmaps( lua_State *L ); int ltexturesSetTextureFilter( lua_State *L ); @@ -25,7 +25,7 @@ void unloadBuffer( Buffer *buffer ) { } /* -## Core - Window +## Core - Window-related functions */ /* @@ -467,272 +467,210 @@ int lcoreGetClipboardText( lua_State *L ) { } /* -## Core - Timing +## Core - Cursor-related functions */ /* -> RL.SetTargetFPS( int fps ) +> RL.ShowCursor() -Set target FPS (maximum) +Shows cursor */ -int lcoreSetTargetFPS( lua_State *L ) { - int fps = luaL_checkinteger( L, 1 ); - - SetTargetFPS( fps ); +int lcoreShowCursor( lua_State *L ) { + ShowCursor(); return 0; } /* -> FPS = RL.GetFPS() - -Get current FPS +> RL.HideCursor() -- Success return int +Hides cursor */ -int lcoreGetFPS( lua_State *L ) { - lua_pushinteger( L, GetFPS() ); +int lcoreHideCursor( lua_State *L ) { + HideCursor(); - return 1; + return 0; } /* -> delta = RL.GetFrameTime() +> hidden = RL.IsCursorHidden() -Get time in seconds for last frame drawn (Delta time) +Check if cursor is not visible -- Success return float +- Success return bool */ -int lcoreGetFrameTime( lua_State *L ) { - lua_pushnumber( L, GetFrameTime() ); +int lcoreIsCursorHidden( lua_State *L ) { + lua_pushboolean( L, IsCursorHidden() ); return 1; } /* -> time = RL.GetTime() - -Get elapsed time in seconds since InitWindow() +> RL.EnableCursor() -- Success return float +Enables cursor (unlock cursor) */ -int lcoreGetTime( lua_State *L ) { - lua_pushnumber( L, GetTime() ); +int lcoreEnableCursor( lua_State *L ) { + EnableCursor(); - return 1; + return 0; } /* -## Core - Misc -*/ - -/* -> RL.TakeScreenshot( string fileName ) +> RL.DisableCursor() -Takes a screenshot of current screen (filename extension defines format) +Disables cursor (lock cursor) */ -int lcoreTakeScreenshot( lua_State *L ) { - TakeScreenshot( luaL_checkstring( L, 1 ) ); +int lcoreDisableCursor( lua_State *L ) { + DisableCursor(); return 0; } /* -> RL.SetConfigFlags( int flags ) +> onSreen = RL.IsCursorOnScreen() -Setup init configuration flags (view FLAGS) -*/ -int lcoreSetConfigFlags( lua_State *L ) { - unsigned int flag = (unsigned int)luaL_checkinteger( L, 1 ); +Check if cursor is on the screen - SetConfigFlags( flag ); +- Success return bool +*/ +int lcoreIsCursorOnScreen( lua_State *L ) { + lua_pushboolean( L, IsCursorOnScreen() ); - return 0; + return 1; } /* -> RL.TraceLog( int logLevel, string text ) - -Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) +## Core - Drawing-related functions */ -int lcoreTraceLog( lua_State *L ) { - int logLevel = luaL_checkinteger( L, 1 ); - - TraceLog( logLevel, "%s", luaL_checkstring( L, 2 ) ); - - return 0; -} /* -> RL.SetTraceLogLevel( int logLevel ) +> RL.ClearBackground( Color color ) -Set the current threshold (minimum) log level +Set background color (framebuffer clear color) */ -int lcoreSetTraceLogLevel( lua_State *L ) { - int logLevel = luaL_checkinteger( L, 1 ); +int lcoreClearBackground( lua_State *L ) { + Color color = uluaGetColor( L, 1 ); - SetTraceLogLevel( logLevel ); + ClearBackground( color ); return 0; } /* -> RL.SetLogLevelInvalid( int logLevel ) +> RL.BeginDrawing() -Set the log level for bad function calls and invalid data formats. +Setup canvas (framebuffer) to start drawing */ -int lcoreSetLogLevelInvalid( lua_State *L ) { - state->logLevelInvalid = luaL_checkinteger( L, 1 ); +int lcoreBeginDrawing( lua_State *L ) { + BeginDrawing(); return 0; } /* -> logLevel = RL.GetLogLevelInvalid() - -Get the log level for bad function calls and invalid data formats. - -- Success return int -*/ -int lcoreGetLogLevelInvalid( lua_State *L ) { - lua_pushinteger( L, state->logLevelInvalid ); - - return 1; -} - -/* -> RL.OpenURL( string url ) +> RL.EndDrawing() -Open URL with default system browser (If available) +End canvas drawing and swap buffers (double buffering) */ -int lcoreOpenURL( lua_State *L ) { - OpenURL( luaL_checkstring( L, 1 ) ); +int lcoreEndDrawing( lua_State *L ) { + EndDrawing(); return 0; } /* -> enabled = RL.IsGCUnloadEnabled() - -Check if Lua garbage collection is set to unload object data - -- Success return bool -*/ -int lcoreIsGCUnloadEnabled( lua_State *L ) { - lua_pushboolean( L, state->gcUnload ); - - return 1; -} +> RL.BeginMode2D( camera2D camera ) -/* -## Core - Cursor +Begin 2D mode with custom camera (2D) */ +int lcoreBeginMode2D( lua_State *L ) { + Camera2D *camera = uluaGetCamera2D( L, 1 ); -/* -> RL.ShowCursor() - -Shows cursor -*/ -int lcoreShowCursor( lua_State *L ) { - ShowCursor(); + BeginMode2D( *camera ); return 0; } /* -> RL.HideCursor() +> RL.EndMode2D() -Hides cursor +Ends 2D mode with custom camera */ -int lcoreHideCursor( lua_State *L ) { - HideCursor(); +int lcoreEndMode2D( lua_State *L ) { + EndMode2D(); return 0; } /* -> hidden = RL.IsCursorHidden() - -Check if cursor is not visible +> RL.BeginMode3D( camera3D camera ) -- Success return bool +Begin 3D mode with custom camera (3D) */ -int lcoreIsCursorHidden( lua_State *L ) { - lua_pushboolean( L, IsCursorHidden() ); - - return 1; -} - -/* -> RL.EnableCursor() +int lcoreBeginMode3D( lua_State *L ) { + Camera3D *camera = uluaGetCamera3D( L, 1 ); -Enables cursor (unlock cursor) -*/ -int lcoreEnableCursor( lua_State *L ) { - EnableCursor(); + BeginMode3D( *camera ); return 0; } /* -> RL.DisableCursor() +> RL.EndMode3D() -Disables cursor (lock cursor) +Ends 3D mode and returns to default 2D orthographic mode */ -int lcoreDisableCursor( lua_State *L ) { - DisableCursor(); +int lcoreEndMode3D( lua_State *L ) { + EndMode3D(); return 0; } /* -> onSreen = RL.IsCursorOnScreen() - -Check if cursor is on the screen +> RL.BeginTextureMode( RenderTexture target ) -- Success return bool +Begin drawing to render texture */ -int lcoreIsCursorOnScreen( lua_State *L ) { - lua_pushboolean( L, IsCursorOnScreen() ); +int lcoreBeginTextureMode( lua_State *L ) { + RenderTexture *renderTexture = uluaGetRenderTexture( L, 1 ); - return 1; -} + BeginTextureMode( *renderTexture ); -/* -## Core - Drawing -*/ + return 0; +} /* -> RL.ClearBackground( Color color ) +> RL.EndTextureMode() -Set background color (framebuffer clear color) +Ends drawing to render texture */ -int lcoreClearBackground( lua_State *L ) { - Color color = uluaGetColor( L, 1 ); - - ClearBackground( color ); +int lcoreEndTextureMode( lua_State *L ) { + EndTextureMode(); return 0; } /* -> RL.BeginDrawing() +> RL.BeginShaderMode( Shader shader ) -Setup canvas (framebuffer) to start drawing +Begin custom shader drawing */ -int lcoreBeginDrawing( lua_State *L ) { - BeginDrawing(); +int lcoreBeginShaderMode( lua_State *L ) { + Shader *shader = uluaGetShader( L, 1 ); + + BeginShaderMode( *shader ); return 0; } /* -> RL.EndDrawing() +> RL.EndShaderMode() -End canvas drawing and swap buffers (double buffering) +End custom shader drawing (use default shader) */ -int lcoreEndDrawing( lua_State *L ) { - EndDrawing(); +int lcoreEndShaderMode( lua_State *L ) { + EndShaderMode(); return 0; } @@ -786,7 +724,7 @@ int lcoreEndScissorMode( lua_State *L ) { } /* -## Core - Shader +## Core - Shader management functions */ /* @@ -854,30 +792,6 @@ int lcoreIsShaderReady( lua_State *L ) { } /* -> RL.BeginShaderMode( Shader shader ) - -Begin custom shader drawing -*/ -int lcoreBeginShaderMode( lua_State *L ) { - Shader *shader = uluaGetShader( L, 1 ); - - BeginShaderMode( *shader ); - - return 0; -} - -/* -> RL.EndShaderMode() - -End custom shader drawing (use default shader) -*/ -int lcoreEndShaderMode( lua_State *L ) { - EndShaderMode(); - - return 0; -} - -/* > location = RL.GetShaderLocation( Shader shader, string uniformName ) Get shader uniform location @@ -1067,7 +981,637 @@ int lcoreUnloadShader( lua_State *L ) { } /* -## Core - Input-related Keyboard +## Core - Screen-space-related functions +*/ + +/* +> ray = RL.GetMouseRay( Vector2 mousePosition, Camera3D camera ) + +Get a ray trace from mouse position + +- Success return Ray +*/ +int lcoreGetMouseRay( lua_State *L ) { + Vector2 mousePosition = uluaGetVector2( L, 1 ); + Camera3D *camera = uluaGetCamera3D( L, 2 ); + + uluaPushRay( L, GetMouseRay( mousePosition, *camera ) ); + + return 1; +} + +/* +> matrix = RL.GetCameraMatrix( Camera3D camera ) + +Get camera transform matrix (view matrix) + +- Success return Matrix +*/ +int lcoreGetCameraMatrix( lua_State *L ) { + Camera3D *camera = uluaGetCamera3D( L, 1 ); + + uluaPushMatrix( L, GetCameraMatrix( *camera ) ); + + return 1; +} + +/* +> matrix = RL.GetCameraMatrix2D( Camera2D camera ) + +Get camera 2d transform matrix + +- Success return Matrix +*/ +int lcoreGetCameraMatrix2D( lua_State *L ) { + Camera2D *camera = uluaGetCamera2D( L, 1 ); + + uluaPushMatrix( L, GetCameraMatrix2D( *camera ) ); + + return 1; +} + +/* +> position = RL.GetWorldToScreen( Vector3 position, Camera3D camera ) + +Get the screen space position for a 3d world space position + +- Success return Vector2 +*/ +int lcoreGetWorldToScreen( lua_State *L ) { + Vector3 position = uluaGetVector3( L, 1 ); + Camera3D *camera = uluaGetCamera3D( L, 2 ); + + uluaPushVector2( L, GetWorldToScreen( position, *camera ) ); + + return 1; +} + +/* +> position = RL.GetWorldToScreenEx( Vector3 position, Camera3D camera, Vector2 size ) + +Get size position for a 3d world space position + +- Success return Vector2 +*/ +int lcoreGetWorldToScreenEx( lua_State *L ) { + Vector3 position = uluaGetVector3( L, 1 ); + Camera3D *camera = uluaGetCamera3D( L, 2 ); + Vector2 size = uluaGetVector2( L, 3 ); + + uluaPushVector2( L, GetWorldToScreenEx( position, *camera, size.x, size.y ) ); + + return 1; +} + +/* +> position = RL.GetWorldToScreen2D( Vector2 position, Camera2D camera ) + +Get the screen space position for a 2d camera world space position + +- Success return Vector2 +*/ +int lcoreGetWorldToScreen2D( lua_State *L ) { + Vector2 position = uluaGetVector2( L, 1 ); + Camera2D *camera = uluaGetCamera2D( L, 2 ); + + uluaPushVector2( L, GetWorldToScreen2D( position, *camera ) ); + + return 1; +} + +/* +> position = RL.GetScreenToWorld2D( Vector2 position, Camera2D camera ) + +Get the world space position for a 2d camera screen space position + +- Success return Vector2 +*/ +int lcoreGetScreenToWorld2D( lua_State *L ) { + Vector2 position = uluaGetVector2( L, 1 ); + Camera2D *camera = uluaGetCamera2D( L, 2 ); + + uluaPushVector2( L, GetScreenToWorld2D( position, *camera ) ); + + return 1; +} + +/* +## Core - Timing-related functions +*/ + +/* +> RL.SetTargetFPS( int fps ) + +Set target FPS (maximum) +*/ +int lcoreSetTargetFPS( lua_State *L ) { + int fps = luaL_checkinteger( L, 1 ); + + SetTargetFPS( fps ); + + return 0; +} + +/* +> FPS = RL.GetFPS() + +Get current FPS + +- Success return int +*/ +int lcoreGetFPS( lua_State *L ) { + lua_pushinteger( L, GetFPS() ); + + return 1; +} + +/* +> delta = RL.GetFrameTime() + +Get time in seconds for last frame drawn (Delta time) + +- Success return float +*/ +int lcoreGetFrameTime( lua_State *L ) { + lua_pushnumber( L, GetFrameTime() ); + + return 1; +} + +/* +> time = RL.GetTime() + +Get elapsed time in seconds since InitWindow() + +- Success return float +*/ +int lcoreGetTime( lua_State *L ) { + lua_pushnumber( L, GetTime() ); + + return 1; +} + +/* +## Core - Misc +*/ + +/* +> RL.TakeScreenshot( string fileName ) + +Takes a screenshot of current screen (filename extension defines format) +*/ +int lcoreTakeScreenshot( lua_State *L ) { + TakeScreenshot( luaL_checkstring( L, 1 ) ); + + return 0; +} + +/* +> RL.SetConfigFlags( int flags ) + +Setup init configuration flags (view FLAGS) +*/ +int lcoreSetConfigFlags( lua_State *L ) { + unsigned int flag = (unsigned int)luaL_checkinteger( L, 1 ); + + SetConfigFlags( flag ); + + return 0; +} + +/* +> RL.TraceLog( int logLevel, string text ) + +Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) +*/ +int lcoreTraceLog( lua_State *L ) { + int logLevel = luaL_checkinteger( L, 1 ); + + TraceLog( logLevel, "%s", luaL_checkstring( L, 2 ) ); + + return 0; +} + +/* +> RL.SetTraceLogLevel( int logLevel ) + +Set the current threshold (minimum) log level +*/ +int lcoreSetTraceLogLevel( lua_State *L ) { + int logLevel = luaL_checkinteger( L, 1 ); + + SetTraceLogLevel( logLevel ); + + return 0; +} + +/* +> RL.SetLogLevelInvalid( int logLevel ) + +Set the log level for bad function calls and invalid data formats. +*/ +int lcoreSetLogLevelInvalid( lua_State *L ) { + state->logLevelInvalid = luaL_checkinteger( L, 1 ); + + return 0; +} + +/* +> logLevel = RL.GetLogLevelInvalid() + +Get the log level for bad function calls and invalid data formats. + +- Success return int +*/ +int lcoreGetLogLevelInvalid( lua_State *L ) { + lua_pushinteger( L, state->logLevelInvalid ); + + return 1; +} + +/* +> RL.OpenURL( string url ) + +Open URL with default system browser (If available) +*/ +int lcoreOpenURL( lua_State *L ) { + OpenURL( luaL_checkstring( L, 1 ) ); + + return 0; +} + +/* +> enabled = RL.IsGCUnloadEnabled() + +Check if Lua garbage collection is set to unload object data + +- Success return bool +*/ +int lcoreIsGCUnloadEnabled( lua_State *L ) { + lua_pushboolean( L, state->gcUnload ); + + return 1; +} + +/* +## Core - Files management functions +*/ + +/* +> path = RL.GetBasePath() + +Return game directory (where main.lua is located) + +- Success return string +*/ +int lcoreGetBasePath( lua_State *L ) { + lua_pushstring( L, state->exePath ); + + return 1; +} + +/* +> fileExists = RL.FileExists( string fileName ) + +Check if file exists + +- Success return bool +*/ +int lcoreFileExists( lua_State *L ) { + lua_pushboolean( L, FileExists( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +> dirExists = RL.DirectoryExists( string dirPath ) + +Check if a directory path exists + +- Success return bool +*/ +int lcoreDirectoryExists( lua_State *L ) { + lua_pushboolean( L, DirectoryExists( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +> hasFileExtension = RL.IsFileExtension( string fileName, string ext ) + +Check file extension (Including point: .png, .wav) + +- Success return bool +*/ +int lcoreIsFileExtension( lua_State *L ) { + lua_pushboolean( L, IsFileExtension( luaL_checkstring( L, 1 ), luaL_checkstring( L, 2 ) ) ); + + return 1; +} + +/* +> length = RL.GetFileLength( string fileName ) + +Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) + +- Success return int +*/ +int lcoreGetFileLength( lua_State *L ) { + lua_pushinteger( L, GetFileLength( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +> extension = RL.GetFileExtension( string fileName ) + +Get pointer to extension for a filename string (Includes dot: '.png') + +- Success return string +*/ +int lcoreGetFileExtension( lua_State *L ) { + lua_pushstring( L, GetFileExtension( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +> fileName = RL.GetFileName( string filePath ) + +Get pointer to filename for a path string + +- Success return string +*/ +int lcoreGetFileName( lua_State *L ) { + lua_pushstring( L, GetFileName( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +> fileName = RL.GetFileNameWithoutExt( string filePath ) + +Get filename string without extension (Uses static string) + +- Success return string +*/ +int lcoreGetFileNameWithoutExt( lua_State *L ) { + lua_pushstring( L, GetFileNameWithoutExt( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +> filePath = RL.GetDirectoryPath( string filePath ) + +Get full path for a given fileName with path (Uses static string) + +- Success return string +*/ +int lcoreGetDirectoryPath( lua_State *L ) { + lua_pushstring( L, GetDirectoryPath( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +> directory = RL.GetPrevDirectoryPath( string dirPath ) + +Get previous directory path for a given path (Uses static string) + +- Success return string +*/ +int lcoreGetPrevDirectoryPath( lua_State *L ) { + lua_pushstring( L, GetPrevDirectoryPath( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +> directory = RL.GetWorkingDirectory() + +Get current working directory (Uses static string) + +- Success return string +*/ +int lcoreGetWorkingDirectory( lua_State *L ) { + lua_pushstring( L, GetWorkingDirectory() ); + + return 1; +} + +/* +> fileNames = RL.LoadDirectoryFiles( string dirPath ) + +Load directory filepaths + +- Success return string{} +*/ +int lcoreLoadDirectoryFiles( lua_State *L ) { + FilePathList files = LoadDirectoryFiles( luaL_checkstring( L, 1 ) ); + + lua_createtable( L, files.count, 0 ); + + for ( int i = 0; i < files.count; ++i ) { + lua_pushstring( L, files.paths[i] ); + lua_rawseti( L, -2, i+1 ); + } + UnloadDirectoryFiles( files ); + + return 1; +} + +/* +> fileNames = RL.LoadDirectoryFilesEx( string basePath, string filter, bool scanSubdirs ) + +Load directory filepaths with extension filtering and recursive directory scan + +- Success return string{} +*/ +int lcoreLoadDirectoryFilesEx( lua_State *L ) { + bool scanSubdirs = uluaGetBoolean( L, 3 ); + + FilePathList files = LoadDirectoryFilesEx( luaL_checkstring( L, 1 ), luaL_checkstring( L, 2 ), scanSubdirs ); + + lua_createtable( L, files.count, 0 ); + + for ( int i = 0; i < files.count; ++i ) { + lua_pushstring( L, files.paths[i] ); + lua_rawseti( L, -2, i+1 ); + } + UnloadDirectoryFiles( files ); + + return 1; +} + +/* +> success = RL.ChangeDirectory( string directory ) + +Change working directory, return true on success + +- Success return bool +*/ +int lcoreChangeDirectory( lua_State *L ) { + lua_pushboolean( L, ChangeDirectory( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +> isFile = RL.IsPathFile( string path ) + +Check if a given path is a file or a directory + +- Success return bool +*/ +int lcoreIsPathFile( lua_State *L ) { + lua_pushboolean( L, IsPathFile( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +> iSFileDropped = RL.IsFileDropped() + +Check if a file has been dropped into window + +- Success return bool +*/ +int lcoreIsFileDropped( lua_State *L ) { + lua_pushboolean( L, IsFileDropped() ); + + return 1; +} + +/* +> files = RL.LoadDroppedFiles() + +Load dropped filepaths + +- Success return string{} +*/ +int lcoreLoadDroppedFiles( lua_State *L ) { + FilePathList files = LoadDroppedFiles(); + + lua_createtable( L, files.count, 0 ); + + for ( int i = 0; i < files.count; ++i ) { + lua_pushstring( L, files.paths[i] ); + lua_rawseti( L, -2, i+1 ); + } + UnloadDroppedFiles( files ); + + return 1; +} + +/* +> time = RL.GetFileModTime( string fileName ) + +Get file modification time (Last write time) + +- Success return int +*/ +int lcoreGetFileModTime( lua_State *L ) { + lua_pushinteger( L, GetFileModTime( luaL_checkstring( L, 1 ) ) ); + + return 1; +} + +/* +## Core - Compression/Encoding functionality +*/ + +/* +> compData = RL.CompressData( Buffer buffer ) + +Compress data (DEFLATE algorithm) + +- Success return Buffer +*/ +int lcoreCompressData( lua_State *L ) { + Buffer *inBuffer = uluaGetBuffer( L, 1 ); + Buffer outBuffer = { + .size = 0, + .type = inBuffer->type + }; + unsigned char *compData = CompressData( inBuffer->data, inBuffer->size, (int*)&outBuffer.size ); + + outBuffer.data = malloc( outBuffer.size ); + memcpy( outBuffer.data, compData, outBuffer.size ); + uluaPushBuffer( L, outBuffer ); + + free( compData ); + + return 1; +} + +/* +> decompData = RL.DecompressData( Buffer compData ) + +Decompress data (DEFLATE algorithm). + +- Success Buffer +*/ +int lcoreDecompressData( lua_State *L ) { + Buffer *inBuffer = uluaGetBuffer( L, 1 ); + Buffer outBuffer = { + .size = 0, + .type = inBuffer->type + }; + unsigned char *data = DecompressData( inBuffer->data, inBuffer->size, (int*)&outBuffer.size ); + + outBuffer.data = malloc( outBuffer.size ); + memcpy( outBuffer.data, data, outBuffer.size ); + uluaPushBuffer( L, outBuffer ); + + free( data ); + + return 1; +} + +/* +> encodedData, outputSize = RL.EncodeDataBase64( string data ) + +Encode data to Base64 string + +- Success return string, int +*/ +int lcoreEncodeDataBase64( lua_State *L ) { + int dataSize = 0; + const char *string = luaL_checklstring( L, 1, (size_t*)&dataSize ); + + int outputSize = 0; + char *compData = EncodeDataBase64( string, dataSize, &outputSize ); + + lua_pushstring( L, compData ); + lua_pushinteger( L, outputSize ); + + free( compData ); + + return 2; +} + +/* +> decodedData, outputSize = RL.DecodeDataBase64( string data ) + +Decode Base64 string data + +- Success return string, int +*/ +int lcoreDecodeDataBase64( lua_State *L ) { + int outputSize = 0; + unsigned char *decodedData = DecodeDataBase64( luaL_checkstring( L, 1 ), &outputSize ); + + lua_pushstring( L, decodedData ); + lua_pushinteger( L, outputSize ); + + free( decodedData ); + + return 2; +} + +/* +## Core - Input-related functions: keyboard */ /* @@ -1220,7 +1764,7 @@ int lcoreGetKeyScancode( lua_State *L ) { } /* -## Core - Input-related Gamepad +## Core - Input-related functions: gamepads */ /* @@ -1333,7 +1877,7 @@ int lcoreGetGamepadName( lua_State *L ) { } /* -## Core - Input-related Mouse +## Core - Input-related functions: mouse */ /* @@ -1488,7 +2032,7 @@ int lcoreSetMouseCursor( lua_State *L ) { } /* -## Core - Input-related Touch +## Core - Input-related functions: touch */ /* @@ -1535,7 +2079,7 @@ int lcoreGetTouchPointCount( lua_State *L ) { } /* -## Core - Input-related Gestures +## Core - Input-related functions: gestures */ /* @@ -1645,364 +2189,7 @@ int lcoreGetGesturePinchAngle( lua_State *L ) { } /* -## Core - File -*/ - -/* -> path = RL.GetBasePath() - -Return game directory (where main.lua is located) - -- Success return string -*/ -int lcoreGetBasePath( lua_State *L ) { - lua_pushstring( L, state->exePath ); - - return 1; -} - -/* -> fileExists = RL.FileExists( string fileName ) - -Check if file exists - -- Success return bool -*/ -int lcoreFileExists( lua_State *L ) { - lua_pushboolean( L, FileExists( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -> dirExists = RL.DirectoryExists( string dirPath ) - -Check if a directory path exists - -- Success return bool -*/ -int lcoreDirectoryExists( lua_State *L ) { - lua_pushboolean( L, DirectoryExists( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -> hasFileExtension = RL.IsFileExtension( string fileName, string ext ) - -Check file extension (Including point: .png, .wav) - -- Success return bool -*/ -int lcoreIsFileExtension( lua_State *L ) { - lua_pushboolean( L, IsFileExtension( luaL_checkstring( L, 1 ), luaL_checkstring( L, 2 ) ) ); - - return 1; -} - -/* -> length = RL.GetFileLength( string fileName ) - -Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) - -- Success return int -*/ -int lcoreGetFileLength( lua_State *L ) { - lua_pushinteger( L, GetFileLength( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -> extension = RL.GetFileExtension( string fileName ) - -Get pointer to extension for a filename string (Includes dot: '.png') - -- Success return string -*/ -int lcoreGetFileExtension( lua_State *L ) { - lua_pushstring( L, GetFileExtension( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -> fileName = RL.GetFileName( string filePath ) - -Get pointer to filename for a path string - -- Success return string -*/ -int lcoreGetFileName( lua_State *L ) { - lua_pushstring( L, GetFileName( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -> fileName = RL.GetFileNameWithoutExt( string filePath ) - -Get filename string without extension (Uses static string) - -- Success return string -*/ -int lcoreGetFileNameWithoutExt( lua_State *L ) { - lua_pushstring( L, GetFileNameWithoutExt( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -> filePath = RL.GetDirectoryPath( string filePath ) - -Get full path for a given fileName with path (Uses static string) - -- Success return string -*/ -int lcoreGetDirectoryPath( lua_State *L ) { - lua_pushstring( L, GetDirectoryPath( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -> directory = RL.GetPrevDirectoryPath( string dirPath ) - -Get previous directory path for a given path (Uses static string) - -- Success return string -*/ -int lcoreGetPrevDirectoryPath( lua_State *L ) { - lua_pushstring( L, GetPrevDirectoryPath( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -> directory = RL.GetWorkingDirectory() - -Get current working directory (Uses static string) - -- Success return string -*/ -int lcoreGetWorkingDirectory( lua_State *L ) { - lua_pushstring( L, GetWorkingDirectory() ); - - return 1; -} - -/* -> fileNames = RL.LoadDirectoryFiles( string dirPath ) - -Load directory filepaths - -- Success return string{} -*/ -int lcoreLoadDirectoryFiles( lua_State *L ) { - FilePathList files = LoadDirectoryFiles( luaL_checkstring( L, 1 ) ); - - lua_createtable( L, files.count, 0 ); - - for ( int i = 0; i < files.count; ++i ) { - lua_pushstring( L, files.paths[i] ); - lua_rawseti( L, -2, i+1 ); - } - UnloadDirectoryFiles( files ); - - return 1; -} - -/* -> fileNames = RL.LoadDirectoryFilesEx( string basePath, string filter, bool scanSubdirs ) - -Load directory filepaths with extension filtering and recursive directory scan - -- Success return string{} -*/ -int lcoreLoadDirectoryFilesEx( lua_State *L ) { - bool scanSubdirs = uluaGetBoolean( L, 3 ); - - FilePathList files = LoadDirectoryFilesEx( luaL_checkstring( L, 1 ), luaL_checkstring( L, 2 ), scanSubdirs ); - - lua_createtable( L, files.count, 0 ); - - for ( int i = 0; i < files.count; ++i ) { - lua_pushstring( L, files.paths[i] ); - lua_rawseti( L, -2, i+1 ); - } - UnloadDirectoryFiles( files ); - - return 1; -} - -/* -> success = RL.ChangeDirectory( string directory ) - -Change working directory, return true on success - -- Success return bool -*/ -int lcoreChangeDirectory( lua_State *L ) { - lua_pushboolean( L, ChangeDirectory( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -> isFile = RL.IsPathFile( string path ) - -Check if a given path is a file or a directory - -- Success return bool -*/ -int lcoreIsPathFile( lua_State *L ) { - lua_pushboolean( L, IsPathFile( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -> iSFileDropped = RL.IsFileDropped() - -Check if a file has been dropped into window - -- Success return bool -*/ -int lcoreIsFileDropped( lua_State *L ) { - lua_pushboolean( L, IsFileDropped() ); - - return 1; -} - -/* -> files = RL.LoadDroppedFiles() - -Load dropped filepaths - -- Success return string{} -*/ -int lcoreLoadDroppedFiles( lua_State *L ) { - FilePathList files = LoadDroppedFiles(); - - lua_createtable( L, files.count, 0 ); - - for ( int i = 0; i < files.count; ++i ) { - lua_pushstring( L, files.paths[i] ); - lua_rawseti( L, -2, i+1 ); - } - UnloadDroppedFiles( files ); - - return 1; -} - -/* -> time = RL.GetFileModTime( string fileName ) - -Get file modification time (Last write time) - -- Success return int -*/ -int lcoreGetFileModTime( lua_State *L ) { - lua_pushinteger( L, GetFileModTime( luaL_checkstring( L, 1 ) ) ); - - return 1; -} - -/* -## Core - Compression/Encoding functionality -*/ - -/* -> compData = RL.CompressData( Buffer buffer ) - -Compress data (DEFLATE algorithm) - -- Success return Buffer -*/ -int lcoreCompressData( lua_State *L ) { - Buffer *inBuffer = uluaGetBuffer( L, 1 ); - Buffer outBuffer = { - .size = 0, - .type = inBuffer->type - }; - unsigned char *compData = CompressData( inBuffer->data, inBuffer->size, (int*)&outBuffer.size ); - - outBuffer.data = malloc( outBuffer.size ); - memcpy( outBuffer.data, compData, outBuffer.size ); - uluaPushBuffer( L, outBuffer ); - - free( compData ); - - return 1; -} - -/* -> decompData = RL.DecompressData( Buffer compData ) - -Decompress data (DEFLATE algorithm). - -- Success Buffer -*/ -int lcoreDecompressData( lua_State *L ) { - Buffer *inBuffer = uluaGetBuffer( L, 1 ); - Buffer outBuffer = { - .size = 0, - .type = inBuffer->type - }; - unsigned char *data = DecompressData( inBuffer->data, inBuffer->size, (int*)&outBuffer.size ); - - outBuffer.data = malloc( outBuffer.size ); - memcpy( outBuffer.data, data, outBuffer.size ); - uluaPushBuffer( L, outBuffer ); - - free( data ); - - return 1; -} - -/* -> encodedData, outputSize = RL.EncodeDataBase64( string data ) - -Encode data to Base64 string - -- Success return string, int -*/ -int lcoreEncodeDataBase64( lua_State *L ) { - int dataSize = 0; - const char *string = luaL_checklstring( L, 1, (size_t*)&dataSize ); - - int outputSize = 0; - char *compData = EncodeDataBase64( string, dataSize, &outputSize ); - - lua_pushstring( L, compData ); - lua_pushinteger( L, outputSize ); - - free( compData ); - - return 2; -} - -/* -> decodedData, outputSize = RL.DecodeDataBase64( string data ) - -Decode Base64 string data - -- Success return string, int -*/ -int lcoreDecodeDataBase64( lua_State *L ) { - int outputSize = 0; - unsigned char *decodedData = DecodeDataBase64( luaL_checkstring( L, 1 ), &outputSize ); - - lua_pushstring( L, decodedData ); - lua_pushinteger( L, outputSize ); - - free( decodedData ); - - return 2; -} - -/* -## Core - Camera2D +## Core - Camera2D System functions */ /* @@ -2026,30 +2213,6 @@ int lcoreCreateCamera2D( lua_State *L ) { } /* -> RL.BeginMode2D( camera2D camera ) - -Begin 2D mode with custom camera (2D) -*/ -int lcoreBeginMode2D( lua_State *L ) { - Camera2D *camera = uluaGetCamera2D( L, 1 ); - - BeginMode2D( *camera ); - - return 0; -} - -/* -> RL.EndMode2D() - -Ends 2D mode with custom camera -*/ -int lcoreEndMode2D( lua_State *L ) { - EndMode2D(); - - return 0; -} - -/* > RL.SetCamera2DTarget( camera2D camera, Vector2 target ) Set camera target (rotation and zoom origin) @@ -2163,7 +2326,7 @@ int lcoreGetCamera2DZoom( lua_State *L ) { } /* -## Core - Camera3D +## Core - Camera3D System functions */ /* @@ -2188,30 +2351,6 @@ int lcoreCreateCamera3D( lua_State *L ) { } /* -> RL.BeginMode3D( camera3D camera ) - -Begin 3D mode with custom camera (3D) -*/ -int lcoreBeginMode3D( lua_State *L ) { - Camera3D *camera = uluaGetCamera3D( L, 1 ); - - BeginMode3D( *camera ); - - return 0; -} - -/* -> RL.EndMode3D() - -Ends 3D mode and returns to default 2D orthographic mode -*/ -int lcoreEndMode3D( lua_State *L ) { - EndMode3D(); - - return 0; -} - -/* > RL.SetCamera3DPosition( camera3D camera, Vector3 position ) Set camera position (Remember to call "RL.UpdateCamera3D()" to apply changes) @@ -2577,122 +2716,7 @@ int lcoreUpdateCamera3DPro( lua_State *L ) { } /* -## Core - Screen-space -*/ - -/* -> ray = RL.GetMouseRay( Vector2 mousePosition, Camera3D camera ) - -Get a ray trace from mouse position - -- Success return Ray -*/ -int lcoreGetMouseRay( lua_State *L ) { - Vector2 mousePosition = uluaGetVector2( L, 1 ); - Camera3D *camera = uluaGetCamera3D( L, 2 ); - - uluaPushRay( L, GetMouseRay( mousePosition, *camera ) ); - - return 1; -} - -/* -> matrix = RL.GetCameraMatrix( Camera3D camera ) - -Get camera transform matrix (view matrix) - -- Success return Matrix -*/ -int lcoreGetCameraMatrix( lua_State *L ) { - Camera3D *camera = uluaGetCamera3D( L, 1 ); - - uluaPushMatrix( L, GetCameraMatrix( *camera ) ); - - return 1; -} - -/* -> matrix = RL.GetCameraMatrix2D( Camera2D camera ) - -Get camera 2d transform matrix - -- Success return Matrix -*/ -int lcoreGetCameraMatrix2D( lua_State *L ) { - Camera2D *camera = uluaGetCamera2D( L, 1 ); - - uluaPushMatrix( L, GetCameraMatrix2D( *camera ) ); - - return 1; -} - -/* -> position = RL.GetWorldToScreen( Vector3 position, Camera3D camera ) - -Get the screen space position for a 3d world space position - -- Success return Vector2 -*/ -int lcoreGetWorldToScreen( lua_State *L ) { - Vector3 position = uluaGetVector3( L, 1 ); - Camera3D *camera = uluaGetCamera3D( L, 2 ); - - uluaPushVector2( L, GetWorldToScreen( position, *camera ) ); - - return 1; -} - -/* -> position = RL.GetWorldToScreenEx( Vector3 position, Camera3D camera, Vector2 size ) - -Get size position for a 3d world space position - -- Success return Vector2 -*/ -int lcoreGetWorldToScreenEx( lua_State *L ) { - Vector3 position = uluaGetVector3( L, 1 ); - Camera3D *camera = uluaGetCamera3D( L, 2 ); - Vector2 size = uluaGetVector2( L, 3 ); - - uluaPushVector2( L, GetWorldToScreenEx( position, *camera, size.x, size.y ) ); - - return 1; -} - -/* -> position = RL.GetWorldToScreen2D( Vector2 position, Camera2D camera ) - -Get the screen space position for a 2d camera world space position - -- Success return Vector2 -*/ -int lcoreGetWorldToScreen2D( lua_State *L ) { - Vector2 position = uluaGetVector2( L, 1 ); - Camera2D *camera = uluaGetCamera2D( L, 2 ); - - uluaPushVector2( L, GetWorldToScreen2D( position, *camera ) ); - - return 1; -} - -/* -> position = RL.GetScreenToWorld2D( Vector2 position, Camera2D camera ) - -Get the world space position for a 2d camera screen space position - -- Success return Vector2 -*/ -int lcoreGetScreenToWorld2D( lua_State *L ) { - Vector2 position = uluaGetVector2( L, 1 ); - Camera2D *camera = uluaGetCamera2D( L, 2 ); - - uluaPushVector2( L, GetScreenToWorld2D( position, *camera ) ); - - return 1; -} - -/* -## Core - Buffer +## Core - Buffer management functions */ /* diff --git a/src/lua_core.c b/src/lua_core.c index 89ca581..b32fd57 100644 --- a/src/lua_core.c +++ b/src/lua_core.c @@ -1500,7 +1500,7 @@ void luaRegister() { lua_getglobal( L, "RL" ); /* Core. */ - /* Window. */ + /* Window-related functions. */ assingGlobalFunction( "IsWindowReady", lcoreIsWindowReady ); assingGlobalFunction( "IsWindowFullscreen", lcoreIsWindowFullscreen ); assingGlobalFunction( "IsWindowHidden", lcoreIsWindowHidden ); @@ -1533,41 +1533,33 @@ void luaRegister() { assingGlobalFunction( "CloseWindow", lcoreCloseWindow ); assingGlobalFunction( "SetClipboardText", lcoreSetClipboardText ); assingGlobalFunction( "GetClipboardText", lcoreGetClipboardText ); - /* Timing. */ - assingGlobalFunction( "SetTargetFPS", lcoreSetTargetFPS ); - assingGlobalFunction( "GetFPS", lcoreGetFPS ); - assingGlobalFunction( "GetFrameTime", lcoreGetFrameTime ); - assingGlobalFunction( "GetTime", lcoreGetTime ); - /* Misc. */ - assingGlobalFunction( "TakeScreenshot", lcoreTakeScreenshot ); - assingGlobalFunction( "SetConfigFlags", lcoreSetConfigFlags ); - assingGlobalFunction( "TraceLog", lcoreTraceLog ); - assingGlobalFunction( "SetTraceLogLevel", lcoreSetTraceLogLevel ); - assingGlobalFunction( "SetLogLevelInvalid", lcoreSetLogLevelInvalid ); - assingGlobalFunction( "GetLogLevelInvalid", lcoreGetLogLevelInvalid ); - assingGlobalFunction( "OpenURL", lcoreOpenURL ); - assingGlobalFunction( "IsGCUnloadEnabled", lcoreIsGCUnloadEnabled ); - /* Cursor. */ + /* Cursor-related functions. */ assingGlobalFunction( "ShowCursor", lcoreShowCursor ); assingGlobalFunction( "HideCursor", lcoreHideCursor ); assingGlobalFunction( "IsCursorHidden", lcoreIsCursorHidden ); assingGlobalFunction( "EnableCursor", lcoreEnableCursor ); assingGlobalFunction( "DisableCursor", lcoreDisableCursor ); assingGlobalFunction( "IsCursorOnScreen", lcoreIsCursorOnScreen ); - /* Drawing. */ + /* Drawing-related functions. */ assingGlobalFunction( "ClearBackground", lcoreClearBackground ); assingGlobalFunction( "BeginDrawing", lcoreBeginDrawing ); assingGlobalFunction( "EndDrawing", lcoreEndDrawing ); + assingGlobalFunction( "BeginMode2D", lcoreBeginMode2D ); + assingGlobalFunction( "EndMode2D", lcoreEndMode2D ); + assingGlobalFunction( "BeginMode3D", lcoreBeginMode3D ); + assingGlobalFunction( "EndMode3D", lcoreEndMode3D ); + assingGlobalFunction( "BeginTextureMode", lcoreBeginTextureMode ); + assingGlobalFunction( "EndTextureMode", lcoreEndTextureMode ); + assingGlobalFunction( "BeginShaderMode", lcoreBeginShaderMode ); + assingGlobalFunction( "EndShaderMode", lcoreEndShaderMode ); assingGlobalFunction( "BeginBlendMode", lcoreBeginBlendMode ); assingGlobalFunction( "EndBlendMode", lcoreEndBlendMode ); assingGlobalFunction( "BeginScissorMode", lcoreBeginScissorMode ); assingGlobalFunction( "EndScissorMode", lcoreEndScissorMode ); - /* Shader. */ + /* Shader management functions. */ assingGlobalFunction( "LoadShader", lcoreLoadShader ); assingGlobalFunction( "LoadShaderFromMemory", lcoreLoadShaderFromMemory ); assingGlobalFunction( "IsShaderReady", lcoreIsShaderReady ); - assingGlobalFunction( "BeginShaderMode", lcoreBeginShaderMode ); - assingGlobalFunction( "EndShaderMode", lcoreEndShaderMode ); assingGlobalFunction( "GetShaderLocation", lcoreGetShaderLocation ); assingGlobalFunction( "GetShaderLocationAttrib", lcoreGetShaderLocationAttrib ); assingGlobalFunction( "SetShaderLocationIndex", lcoreSetShaderLocationIndex ); @@ -1577,7 +1569,29 @@ void luaRegister() { assingGlobalFunction( "SetShaderValue", lcoreSetShaderValue ); assingGlobalFunction( "SetShaderValueV", lcoreSetShaderValueV ); assingGlobalFunction( "UnloadShader", lcoreUnloadShader ); - /* File. */ + /* Screen-space-related functions. */ + assingGlobalFunction( "GetMouseRay", lcoreGetMouseRay ); + assingGlobalFunction( "GetCameraMatrix", lcoreGetCameraMatrix ); + assingGlobalFunction( "GetCameraMatrix2D", lcoreGetCameraMatrix2D ); + assingGlobalFunction( "GetWorldToScreen", lcoreGetWorldToScreen ); + assingGlobalFunction( "GetWorldToScreenEx", lcoreGetWorldToScreenEx ); + assingGlobalFunction( "GetWorldToScreen2D", lcoreGetWorldToScreen2D ); + assingGlobalFunction( "GetScreenToWorld2D", lcoreGetScreenToWorld2D ); + /* Timing-related functions. */ + assingGlobalFunction( "SetTargetFPS", lcoreSetTargetFPS ); + assingGlobalFunction( "GetFPS", lcoreGetFPS ); + assingGlobalFunction( "GetFrameTime", lcoreGetFrameTime ); + assingGlobalFunction( "GetTime", lcoreGetTime ); + /* Misc. functions. */ + assingGlobalFunction( "TakeScreenshot", lcoreTakeScreenshot ); + assingGlobalFunction( "SetConfigFlags", lcoreSetConfigFlags ); + assingGlobalFunction( "TraceLog", lcoreTraceLog ); + assingGlobalFunction( "SetTraceLogLevel", lcoreSetTraceLogLevel ); + assingGlobalFunction( "SetLogLevelInvalid", lcoreSetLogLevelInvalid ); + assingGlobalFunction( "GetLogLevelInvalid", lcoreGetLogLevelInvalid ); + assingGlobalFunction( "OpenURL", lcoreOpenURL ); + assingGlobalFunction( "IsGCUnloadEnabled", lcoreIsGCUnloadEnabled ); + /* Files management functions. */ assingGlobalFunction( "GetBasePath", lcoreGetBasePath ); assingGlobalFunction( "FileExists", lcoreFileExists ); assingGlobalFunction( "DirectoryExists", lcoreDirectoryExists ); @@ -1601,47 +1615,7 @@ void luaRegister() { assingGlobalFunction( "DecompressData", lcoreDecompressData ); assingGlobalFunction( "EncodeDataBase64", lcoreEncodeDataBase64 ); assingGlobalFunction( "DecodeDataBase64", lcoreDecodeDataBase64 ); - /* Camera2D. */ - assingGlobalFunction( "CreateCamera2D", lcoreCreateCamera2D ); - assingGlobalFunction( "BeginMode2D", lcoreBeginMode2D ); - assingGlobalFunction( "EndMode2D", lcoreEndMode2D ); - assingGlobalFunction( "SetCamera2DTarget", lcoreSetCamera2DTarget ); - assingGlobalFunction( "SetCamera2DOffset", lcoreSetCamera2DOffset ); - assingGlobalFunction( "SetCamera2DRotation", lcoreSetCamera2DRotation ); - assingGlobalFunction( "SetCamera2DZoom", lcoreSetCamera2DZoom ); - assingGlobalFunction( "GetCamera2DTarget", lcoreGetCamera2DTarget ); - assingGlobalFunction( "GetCamera2DOffset", lcoreGetCamera2DOffset ); - assingGlobalFunction( "GetCamera2DRotation", lcoreGetCamera2DRotation ); - assingGlobalFunction( "GetCamera2DZoom", lcoreGetCamera2DZoom ); - /* Camera3D. */ - assingGlobalFunction( "CreateCamera3D", lcoreCreateCamera3D ); - assingGlobalFunction( "BeginMode3D", lcoreBeginMode3D ); - assingGlobalFunction( "EndMode3D", lcoreEndMode3D ); - assingGlobalFunction( "SetCamera3DPosition", lcoreSetCamera3DPosition ); - assingGlobalFunction( "SetCamera3DTarget", lcoreSetCamera3DTarget ); - assingGlobalFunction( "SetCamera3DUp", lcoreSetCamera3DUp ); - assingGlobalFunction( "SetCamera3DFovy", lcoreSetCamera3DFovy ); - assingGlobalFunction( "SetCamera3DProjection", lcoreSetCamera3DProjection ); - assingGlobalFunction( "GetCamera3DPosition", lcoreGetCamera3DPosition ); - assingGlobalFunction( "GetCamera3DTarget", lcoreGetCamera3DTarget ); - assingGlobalFunction( "GetCamera3DUp", lcoreGetCamera3DUp ); - assingGlobalFunction( "GetCamera3DFovy", lcoreGetCamera3DFovy ); - assingGlobalFunction( "GetCamera3DProjection", lcoreGetCamera3DProjection ); - assingGlobalFunction( "GetCamera3DForward", lcoreGetCamera3DForward ); - assingGlobalFunction( "GetCamera3DUpNormalized", lcoreGetCamera3DUpNormalized ); - assingGlobalFunction( "GetCamera3DRight", lcoreGetCamera3DRight ); - assingGlobalFunction( "Camera3DMoveForward", lcoreCamera3DMoveForward ); - assingGlobalFunction( "Camera3DMoveUp", lcoreCamera3DMoveUp ); - assingGlobalFunction( "Camera3DMoveRight", lcoreCamera3DMoveRight ); - assingGlobalFunction( "Camera3DMoveToTarget", lcoreCamera3DMoveToTarget ); - assingGlobalFunction( "Camera3DYaw", lcoreCamera3DYaw ); - assingGlobalFunction( "Camera3DPitch", lcoreCamera3DPitch ); - assingGlobalFunction( "Camera3DRoll", lcoreCamera3DRoll ); - assingGlobalFunction( "GetCamera3DViewMatrix", lcoreGetCamera3DViewMatrix ); - assingGlobalFunction( "GetCamera3DProjectionMatrix", lcoreGetCamera3DProjectionMatrix ); - assingGlobalFunction( "UpdateCamera3D", lcoreUpdateCamera3D ); - assingGlobalFunction( "UpdateCamera3DPro", lcoreUpdateCamera3DPro ); - /* Input-related Keyboard. */ + /* Input-related functions: keyboard. */ assingGlobalFunction( "IsKeyPressed", lcoreIsKeyPressed ); assingGlobalFunction( "IsKeyDown", lcoreIsKeyDown ); assingGlobalFunction( "IsKeyReleased", lcoreIsKeyReleased ); @@ -1651,7 +1625,7 @@ void luaRegister() { assingGlobalFunction( "SetExitKey", lcoreSetExitKey ); assingGlobalFunction( "GetKeyName", lcoreGetKeyName ); assingGlobalFunction( "GetKeyScancode", lcoreGetKeyScancode ); - /* Input-related Gamepad. */ + /* Input-related functions: gamepads. */ assingGlobalFunction( "IsGamepadAvailable", lcoreIsGamepadAvailable ); assingGlobalFunction( "IsGamepadButtonPressed", lcoreIsGamepadButtonPressed ); assingGlobalFunction( "IsGamepadButtonDown", lcoreIsGamepadButtonDown ); @@ -1659,7 +1633,7 @@ void luaRegister() { assingGlobalFunction( "GetGamepadAxisCount", lcoreGetGamepadAxisCount ); assingGlobalFunction( "GetGamepadAxisMovement", lcoreGetGamepadAxisMovement ); assingGlobalFunction( "GetGamepadName", lcoreGetGamepadName ); - /* Input-related Mouse. */ + /* Input-related functions: mouse. */ assingGlobalFunction( "IsMouseButtonPressed", lcoreIsMouseButtonPressed ); assingGlobalFunction( "IsMouseButtonDown", lcoreIsMouseButtonDown ); assingGlobalFunction( "IsMouseButtonReleased", lcoreIsMouseButtonReleased ); @@ -1671,11 +1645,11 @@ void luaRegister() { assingGlobalFunction( "SetMouseScale", lcoreSetMouseScale ); assingGlobalFunction( "GetMouseWheelMove", lcoreGetMouseWheelMove ); assingGlobalFunction( "SetMouseCursor", lcoreSetMouseCursor ); - /* Input-related Touch */ + /* Input-related functions: touch */ assingGlobalFunction( "GetTouchPosition", lcoreGetTouchPosition ); assingGlobalFunction( "GetTouchPointId", lcoreGetTouchPointId ); assingGlobalFunction( "GetTouchPointCount", lcoreGetTouchPointCount ); - /* Input-related Gestures. */ + /* Input-related functions: gestures. */ assingGlobalFunction( "SetGesturesEnabled", lcoreSetGesturesEnabled ); assingGlobalFunction( "IsGestureDetected", lcoreIsGestureDetected ); assingGlobalFunction( "GetGestureDetected", lcoreGetGestureDetected ); @@ -1684,15 +1658,43 @@ void luaRegister() { assingGlobalFunction( "GetGestureDragAngle", lcoreGetGestureDragAngle ); assingGlobalFunction( "GetGesturePinchVector", lcoreGetGesturePinchVector ); assingGlobalFunction( "GetGesturePinchAngle", lcoreGetGesturePinchAngle ); - /* Screen-space. */ - assingGlobalFunction( "GetMouseRay", lcoreGetMouseRay ); - assingGlobalFunction( "GetCameraMatrix", lcoreGetCameraMatrix ); - assingGlobalFunction( "GetCameraMatrix2D", lcoreGetCameraMatrix2D ); - assingGlobalFunction( "GetWorldToScreen", lcoreGetWorldToScreen ); - assingGlobalFunction( "GetWorldToScreenEx", lcoreGetWorldToScreenEx ); - assingGlobalFunction( "GetWorldToScreen2D", lcoreGetWorldToScreen2D ); - assingGlobalFunction( "GetScreenToWorld2D", lcoreGetScreenToWorld2D ); - /* Buffer. */ + /* Camera2D System functions. */ + assingGlobalFunction( "CreateCamera2D", lcoreCreateCamera2D ); + assingGlobalFunction( "SetCamera2DTarget", lcoreSetCamera2DTarget ); + assingGlobalFunction( "SetCamera2DOffset", lcoreSetCamera2DOffset ); + assingGlobalFunction( "SetCamera2DRotation", lcoreSetCamera2DRotation ); + assingGlobalFunction( "SetCamera2DZoom", lcoreSetCamera2DZoom ); + assingGlobalFunction( "GetCamera2DTarget", lcoreGetCamera2DTarget ); + assingGlobalFunction( "GetCamera2DOffset", lcoreGetCamera2DOffset ); + assingGlobalFunction( "GetCamera2DRotation", lcoreGetCamera2DRotation ); + assingGlobalFunction( "GetCamera2DZoom", lcoreGetCamera2DZoom ); + /* Camera3D System functions. */ + assingGlobalFunction( "CreateCamera3D", lcoreCreateCamera3D ); + assingGlobalFunction( "SetCamera3DPosition", lcoreSetCamera3DPosition ); + assingGlobalFunction( "SetCamera3DTarget", lcoreSetCamera3DTarget ); + assingGlobalFunction( "SetCamera3DUp", lcoreSetCamera3DUp ); + assingGlobalFunction( "SetCamera3DFovy", lcoreSetCamera3DFovy ); + assingGlobalFunction( "SetCamera3DProjection", lcoreSetCamera3DProjection ); + assingGlobalFunction( "GetCamera3DPosition", lcoreGetCamera3DPosition ); + assingGlobalFunction( "GetCamera3DTarget", lcoreGetCamera3DTarget ); + assingGlobalFunction( "GetCamera3DUp", lcoreGetCamera3DUp ); + assingGlobalFunction( "GetCamera3DFovy", lcoreGetCamera3DFovy ); + assingGlobalFunction( "GetCamera3DProjection", lcoreGetCamera3DProjection ); + assingGlobalFunction( "GetCamera3DForward", lcoreGetCamera3DForward ); + assingGlobalFunction( "GetCamera3DUpNormalized", lcoreGetCamera3DUpNormalized ); + assingGlobalFunction( "GetCamera3DRight", lcoreGetCamera3DRight ); + assingGlobalFunction( "Camera3DMoveForward", lcoreCamera3DMoveForward ); + assingGlobalFunction( "Camera3DMoveUp", lcoreCamera3DMoveUp ); + assingGlobalFunction( "Camera3DMoveRight", lcoreCamera3DMoveRight ); + assingGlobalFunction( "Camera3DMoveToTarget", lcoreCamera3DMoveToTarget ); + assingGlobalFunction( "Camera3DYaw", lcoreCamera3DYaw ); + assingGlobalFunction( "Camera3DPitch", lcoreCamera3DPitch ); + assingGlobalFunction( "Camera3DRoll", lcoreCamera3DRoll ); + assingGlobalFunction( "GetCamera3DViewMatrix", lcoreGetCamera3DViewMatrix ); + assingGlobalFunction( "GetCamera3DProjectionMatrix", lcoreGetCamera3DProjectionMatrix ); + assingGlobalFunction( "UpdateCamera3D", lcoreUpdateCamera3D ); + assingGlobalFunction( "UpdateCamera3DPro", lcoreUpdateCamera3DPro ); + /* Buffer management functions. */ assingGlobalFunction( "LoadBuffer", lcoreLoadBuffer ); assingGlobalFunction( "UnloadBuffer", lcoreUnloadBuffer ); assingGlobalFunction( "GetBufferData", lcoreGetBufferData ); @@ -1829,8 +1831,6 @@ void luaRegister() { assingGlobalFunction( "DrawTextureRec", ltexturesDrawTextureRec ); assingGlobalFunction( "DrawTexturePro", ltexturesDrawTexturePro ); assingGlobalFunction( "DrawTextureNPatch", ltexturesDrawTextureNPatch ); - assingGlobalFunction( "BeginTextureMode", ltexturesBeginTextureMode ); - assingGlobalFunction( "EndTextureMode", ltexturesEndTextureMode ); /* Texture Configuration. */ assingGlobalFunction( "GenTextureMipmaps", ltexturesGenTextureMipmaps ); assingGlobalFunction( "SetTextureFilter", ltexturesSetTextureFilter ); diff --git a/src/textures.c b/src/textures.c index f31d4d8..2274aa9 100644 --- a/src/textures.c +++ b/src/textures.c @@ -1259,30 +1259,6 @@ int ltexturesDrawTextureNPatch( lua_State *L ) { } /* -> RL.BeginTextureMode( RenderTexture target ) - -Begin drawing to render texture -*/ -int ltexturesBeginTextureMode( lua_State *L ) { - RenderTexture *renderTexture = uluaGetRenderTexture( L, 1 ); - - BeginTextureMode( *renderTexture ); - - return 0; -} - -/* -> RL.EndTextureMode() - -Ends drawing to render texture -*/ -int ltexturesEndTextureMode( lua_State *L ) { - EndTextureMode(); - - return 0; -} - -/* ## Textures - Texture Configuration */ |
