summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core.c1424
-rw-r--r--src/lua_core.c154
-rw-r--r--src/textures.c24
3 files changed, 801 insertions, 801 deletions
diff --git a/src/core.c b/src/core.c
index a32b226..05af7c8 100644
--- a/src/core.c
+++ b/src/core.c
@@ -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
*/