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 /API.md | |
| parent | ef75e2530dd92c55ba6b2462fe71fa888e1883df (diff) | |
| download | reilua-enhanced-e056446750bff6db15842aea662f18a322052d8c.tar.gz reilua-enhanced-e056446750bff6db15842aea662f18a322052d8c.tar.bz2 reilua-enhanced-e056446750bff6db15842aea662f18a322052d8c.zip | |
Organized core functions.
Diffstat (limited to 'API.md')
| -rw-r--r-- | API.md | 730 |
1 files changed, 365 insertions, 365 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 --- |
