RL_LoadDirectoryFilesEx and separate option for doc_parser.
This commit is contained in:
9
API.md
9
API.md
@@ -2065,6 +2065,15 @@ Load directory filepaths
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> fileNames = RL_LoadDirectoryFilesEx( string basePath, string filter, bool scanSubdirs )
|
||||||
|
|
||||||
|
Load directory filepaths with extension filtering and recursive directory scan
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return string{}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
> success = RL_ChangeDirectory( string directory )
|
> success = RL_ChangeDirectory( string directory )
|
||||||
|
|
||||||
Change working directory, return true on success
|
Change working directory, return true on success
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ List of some MISSING features that are planned to be included. For specific func
|
|||||||
* Textures
|
* Textures
|
||||||
* LoadImageFromMemory
|
* LoadImageFromMemory
|
||||||
* Text
|
* Text
|
||||||
* LoadFontFromMemory
|
|
||||||
* GlyphInfo
|
* GlyphInfo
|
||||||
|
* LoadFontFromMemory
|
||||||
* Audio
|
* Audio
|
||||||
|
* AudioStream management functions
|
||||||
* LoadWaveFromMemory
|
* LoadWaveFromMemory
|
||||||
* LoadMusicStreamFromMemory
|
* LoadMusicStreamFromMemory
|
||||||
* AudioStream management functions
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|||||||
@@ -13,3 +13,5 @@ ADDED: Help argument.
|
|||||||
CHANGED: Changed fuction name RL_rlSetLineWidth to RL_rlglSetLineWidth.
|
CHANGED: Changed fuction name RL_rlSetLineWidth to RL_rlglSetLineWidth.
|
||||||
CHANGED: Changed fuction name RL_rlGetLineWidth to RL_rlglGetLineWidth.
|
CHANGED: Changed fuction name RL_rlGetLineWidth to RL_rlglGetLineWidth.
|
||||||
FIX: DrawRectangleGradient V and H expecting wrong amount of arguments.
|
FIX: DrawRectangleGradient V and H expecting wrong amount of arguments.
|
||||||
|
ADDED: RL_LoadDirectoryFilesEx.
|
||||||
|
ADDED: Flag option (-s) for doc_parser.lua for exporting module APIs to separate files.
|
||||||
|
|||||||
10
devnotes
10
devnotes
@@ -2,13 +2,9 @@ Current {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Backlog {
|
Backlog {
|
||||||
* Core
|
|
||||||
* LoadDirectoryFilesEx
|
|
||||||
* Audio
|
* Audio
|
||||||
* AudioStream
|
* AudioStream.
|
||||||
* Text
|
* Text
|
||||||
* Codepoints
|
* Codepoints?
|
||||||
* String management. At least TextSplit.
|
* VR.
|
||||||
|
|
||||||
* VR?
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
--Create api.md file from c sources.
|
--Create api.md file from c sources.
|
||||||
|
|
||||||
|
-- Export each module as separate .md file.
|
||||||
|
local separate = false
|
||||||
|
|
||||||
|
if arg[1] ~= nil and arg[1] == "-s" then
|
||||||
|
separate = true
|
||||||
|
end
|
||||||
|
|
||||||
local function split( str, sep )
|
local function split( str, sep )
|
||||||
if sep == nil then
|
if sep == nil then
|
||||||
sep = "%s"
|
sep = "%s"
|
||||||
@@ -34,6 +41,8 @@ Note: Engine will call Raylib functions 'BeginDrawing()' before this function ca
|
|||||||
You can still use RL_BeginDrawing() and RL_EndDrawing() manually from anywhere.\n\n---\n" )
|
You can still use RL_BeginDrawing() and RL_EndDrawing() manually from anywhere.\n\n---\n" )
|
||||||
apiFile:write( "\n> function log( logLevel, message )\n\
|
apiFile:write( "\n> function log( logLevel, message )\n\
|
||||||
This function can be used for custom log message handling.\n\n---\n" )
|
This function can be used for custom log message handling.\n\n---\n" )
|
||||||
|
apiFile:write( "\n> function exit()\n\
|
||||||
|
This function will be called on program close. Cleanup could be done here.\n\n---\n" )
|
||||||
|
|
||||||
-- Globals.
|
-- Globals.
|
||||||
|
|
||||||
@@ -142,27 +151,35 @@ apiFile:write( "\n> NPatchInfo = { { 0, 0, 24, 24 }, 0, 0, 0, 0, NPATCH_NINE_PAT
|
|||||||
apiFile:write( "\n> ModelAnimations = ModelAnimationsId\n\
|
apiFile:write( "\n> ModelAnimations = ModelAnimationsId\n\
|
||||||
int id. ModelAnimations\n\n---\n" )
|
int id. ModelAnimations\n\n---\n" )
|
||||||
|
|
||||||
|
if separate then
|
||||||
|
apiFile:close()
|
||||||
|
end
|
||||||
|
|
||||||
-- Functions.
|
-- Functions.
|
||||||
|
|
||||||
local sourceFiles = {
|
local sourceFiles = {
|
||||||
"src/core.c",
|
"core",
|
||||||
"src/shapes.c",
|
"shapes",
|
||||||
"src/textures.c",
|
"textures",
|
||||||
"src/text.c",
|
"text",
|
||||||
"src/models.c",
|
"models",
|
||||||
"src/audio.c",
|
"audio",
|
||||||
"src/rmath.c",
|
"rmath",
|
||||||
"src/rgui.c",
|
"rgui",
|
||||||
"src/lights.c",
|
"lights",
|
||||||
"src/rlgl.c",
|
"rlgl",
|
||||||
"src/easings.c",
|
"easings",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, src in ipairs( sourceFiles ) do
|
for _, src in ipairs( sourceFiles ) do
|
||||||
srcFile = io.open( src, "r" )
|
srcFile = io.open( "src/"..src..".c", "r" )
|
||||||
local line = ""
|
local line = ""
|
||||||
local p = false
|
local p = false
|
||||||
|
|
||||||
|
if separate then
|
||||||
|
apiFile = io.open( src..".md", "w" )
|
||||||
|
end
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
line = srcFile:read( "*l" )
|
line = srcFile:read( "*l" )
|
||||||
|
|
||||||
@@ -182,6 +199,12 @@ for _, src in ipairs( sourceFiles ) do
|
|||||||
until line == nil
|
until line == nil
|
||||||
|
|
||||||
srcFile:close()
|
srcFile:close()
|
||||||
|
|
||||||
|
if separate then
|
||||||
|
apiFile:close()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not separate then
|
||||||
apiFile:close()
|
apiFile:close()
|
||||||
|
end
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ int lcoreGetDirectoryPath( lua_State *L );
|
|||||||
int lcoreGetPrevDirectoryPath( lua_State *L );
|
int lcoreGetPrevDirectoryPath( lua_State *L );
|
||||||
int lcoreGetWorkingDirectory( lua_State *L );
|
int lcoreGetWorkingDirectory( lua_State *L );
|
||||||
int lcoreLoadDirectoryFiles( lua_State *L );
|
int lcoreLoadDirectoryFiles( lua_State *L );
|
||||||
|
int lcoreLoadDirectoryFilesEx( lua_State *L );
|
||||||
int lcoreChangeDirectory( lua_State *L );
|
int lcoreChangeDirectory( lua_State *L );
|
||||||
int lcoreIsFileDropped( lua_State *L );
|
int lcoreIsFileDropped( lua_State *L );
|
||||||
int lcoreLoadDroppedFiles( lua_State *L );
|
int lcoreLoadDroppedFiles( lua_State *L );
|
||||||
|
|||||||
27
src/core.c
27
src/core.c
@@ -2198,6 +2198,33 @@ int lcoreLoadDirectoryFiles( lua_State *L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> fileNames = RL_LoadDirectoryFilesEx( string basePath, string filter, bool scanSubdirs )
|
||||||
|
|
||||||
|
Load directory filepaths with extension filtering and recursive directory scan
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return string{}
|
||||||
|
*/
|
||||||
|
int lcoreLoadDirectoryFilesEx( lua_State *L ) {
|
||||||
|
if ( !lua_isstring( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isboolean( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_LoadDirectoryFilesEx( string dirPath )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
FilePathList files = LoadDirectoryFilesEx( lua_tostring( L, -3 ), lua_tostring( L, -2 ), lua_toboolean( 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;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL_ChangeDirectory( string directory )
|
> success = RL_ChangeDirectory( string directory )
|
||||||
|
|
||||||
|
|||||||
@@ -748,6 +748,7 @@ void luaRegister() {
|
|||||||
lua_register( L, "RL_GetPrevDirectoryPath", lcoreGetPrevDirectoryPath );
|
lua_register( L, "RL_GetPrevDirectoryPath", lcoreGetPrevDirectoryPath );
|
||||||
lua_register( L, "RL_GetWorkingDirectory", lcoreGetWorkingDirectory );
|
lua_register( L, "RL_GetWorkingDirectory", lcoreGetWorkingDirectory );
|
||||||
lua_register( L, "RL_LoadDirectoryFiles", lcoreLoadDirectoryFiles );
|
lua_register( L, "RL_LoadDirectoryFiles", lcoreLoadDirectoryFiles );
|
||||||
|
lua_register( L, "RL_LoadDirectoryFilesEx", lcoreLoadDirectoryFilesEx );
|
||||||
lua_register( L, "RL_ChangeDirectory", lcoreChangeDirectory );
|
lua_register( L, "RL_ChangeDirectory", lcoreChangeDirectory );
|
||||||
lua_register( L, "RL_IsFileDropped", lcoreIsFileDropped );
|
lua_register( L, "RL_IsFileDropped", lcoreIsFileDropped );
|
||||||
lua_register( L, "RL_LoadDroppedFiles", lcoreLoadDroppedFiles );
|
lua_register( L, "RL_LoadDroppedFiles", lcoreLoadDroppedFiles );
|
||||||
|
|||||||
Reference in New Issue
Block a user