mirror of
https://github.com/raysan5/raylib.git
synced 2025-11-17 15:51:19 +00:00
WARNING: BREAKING: REDESIGNED: Filepath loading API
REDESIGNED: `LoadDirectoryFiles()` ADDED: `LoadDirectoryFilesEx()` REDESIGNED: `LoadDroppedFiles()` ADDED: `IsPathFile()` This BIG BREAKING change simplifies the functions and gives more control to the user: - A new `struct FilePathList` has been added to avoid exposing complex pointers. - User is responsible of memory loading/unloading - Filepaths loading support recursive directories and file extension filters
This commit is contained in:
@@ -97,18 +97,17 @@ int main(void)
|
||||
// Load new cubemap texture on drag&drop
|
||||
if (IsFileDropped())
|
||||
{
|
||||
int count = 0;
|
||||
char **droppedFiles = LoadDroppedFiles(&count);
|
||||
FilePathList droppedFiles = LoadDroppedFiles();
|
||||
|
||||
if (count == 1) // Only support one file dropped
|
||||
if (droppedFiles.count == 1) // Only support one file dropped
|
||||
{
|
||||
if (IsFileExtension(droppedFiles[0], ".png;.jpg;.hdr;.bmp;.tga"))
|
||||
if (IsFileExtension(droppedFiles.paths[0], ".png;.jpg;.hdr;.bmp;.tga"))
|
||||
{
|
||||
// Unload current cubemap texture and load new one
|
||||
UnloadTexture(skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture);
|
||||
if (useHDR)
|
||||
{
|
||||
Texture2D panorama = LoadTexture(droppedFiles[0]);
|
||||
Texture2D panorama = LoadTexture(droppedFiles.paths[0]);
|
||||
|
||||
// Generate cubemap from panorama texture
|
||||
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
|
||||
@@ -116,7 +115,7 @@ int main(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
Image img = LoadImage(droppedFiles[0]);
|
||||
Image img = LoadImage(droppedFiles.paths[0]);
|
||||
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = LoadTextureCubemap(img, CUBEMAP_LAYOUT_AUTO_DETECT);
|
||||
UnloadImage(img);
|
||||
}
|
||||
@@ -125,7 +124,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
UnloadDroppedFiles(); // Clear internal buffers
|
||||
UnloadDroppedFiles(droppedFiles); // Unload filepaths from memory
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user