WARNING: RENAMED: GetDroppedFiles()
to LoadDroppedFiles()
RENAMED: `ClearDroppedFiles()` to `UnloadDroppedFiles()`
This commit is contained in:
parent
ebbcc2ffce
commit
e6bc401c93
@ -35,7 +35,7 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsFileDropped())
|
||||
{
|
||||
droppedFiles = GetDroppedFiles(&count);
|
||||
droppedFiles = LoadDroppedFiles(&count);
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
@ -67,7 +67,7 @@ int main(void)
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
ClearDroppedFiles(); // Clear internal buffers
|
||||
UnloadDroppedFiles(); // Clear internal buffers
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@ -68,7 +68,7 @@ int main(void)
|
||||
if (IsFileDropped())
|
||||
{
|
||||
int count = 0;
|
||||
char **droppedFiles = GetDroppedFiles(&count);
|
||||
char **droppedFiles = LoadDroppedFiles(&count);
|
||||
|
||||
if (count == 1) // Only support one file dropped
|
||||
{
|
||||
@ -95,7 +95,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
ClearDroppedFiles(); // Clear internal buffers
|
||||
UnloadDroppedFiles(); // Clear internal buffers
|
||||
}
|
||||
|
||||
// Select model on mouse click
|
||||
|
@ -98,7 +98,7 @@ int main(void)
|
||||
if (IsFileDropped())
|
||||
{
|
||||
int count = 0;
|
||||
char **droppedFiles = GetDroppedFiles(&count);
|
||||
char **droppedFiles = LoadDroppedFiles(&count);
|
||||
|
||||
if (count == 1) // Only support one file dropped
|
||||
{
|
||||
@ -125,7 +125,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
ClearDroppedFiles(); // Clear internal buffers
|
||||
UnloadDroppedFiles(); // Clear internal buffers
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
@ -142,7 +142,7 @@ int main(void)
|
||||
if (IsFileDropped())
|
||||
{
|
||||
int count = 0;
|
||||
char **droppedFiles = GetDroppedFiles(&count);
|
||||
char **droppedFiles = LoadDroppedFiles(&count);
|
||||
|
||||
// NOTE: We only support first ttf file dropped
|
||||
if (IsFileExtension(droppedFiles[0], ".ttf"))
|
||||
@ -156,7 +156,7 @@ int main(void)
|
||||
font = LoadFont(droppedFiles[0]);
|
||||
fontSize = font.baseSize;
|
||||
}
|
||||
ClearDroppedFiles();
|
||||
UnloadDroppedFiles();
|
||||
}
|
||||
|
||||
// Handle Events
|
||||
|
@ -80,14 +80,14 @@ int main(void)
|
||||
if (IsFileDropped())
|
||||
{
|
||||
int count = 0;
|
||||
char **droppedFiles = GetDroppedFiles(&count);
|
||||
char **droppedFiles = LoadDroppedFiles(&count);
|
||||
|
||||
// NOTE: We only support first ttf file dropped
|
||||
if (IsFileExtension(droppedFiles[0], ".ttf"))
|
||||
{
|
||||
UnloadFont(font);
|
||||
font = LoadFontEx(droppedFiles[0], (int)fontSize, 0, 0);
|
||||
ClearDroppedFiles();
|
||||
UnloadDroppedFiles();
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -123,7 +123,7 @@ int main(void)
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
ClearDroppedFiles(); // Clear internal buffers
|
||||
UnloadDroppedFiles(); // Clear internal buffers
|
||||
|
||||
UnloadFont(font); // Font unloading
|
||||
|
||||
|
@ -149,8 +149,8 @@ RLAPI char **GetDirectoryFiles(const char *dirPath, int *count); // Get filenam
|
||||
RLAPI void ClearDirectoryFiles(void); // Clear directory files paths buffers (free memory)
|
||||
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, return true on success
|
||||
RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
|
||||
RLAPI char **GetDroppedFiles(int *count); // Get dropped files names (memory should be freed)
|
||||
RLAPI void ClearDroppedFiles(void); // Clear dropped files paths buffer (free memory)
|
||||
RLAPI char **LoadDroppedFiles(int *count); // Get dropped files names (memory should be freed)
|
||||
RLAPI void UnloadDroppedFiles(void); // Clear dropped files paths buffer (free memory)
|
||||
RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
|
||||
|
||||
// Compression/Encoding functionality
|
||||
|
12
src/raylib.h
12
src/raylib.h
@ -1,6 +1,6 @@
|
||||
/**********************************************************************************************
|
||||
*
|
||||
* raylib v4.1-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
|
||||
* raylib v4.2-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
|
||||
*
|
||||
* FEATURES:
|
||||
* - NO external dependencies, all required libraries included with raylib
|
||||
@ -80,7 +80,7 @@
|
||||
|
||||
#include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback
|
||||
|
||||
#define RAYLIB_VERSION "4.1-dev"
|
||||
#define RAYLIB_VERSION "4.2-dev"
|
||||
|
||||
// Function specifiers in case library is build/used as a shared library (Windows)
|
||||
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
|
||||
@ -1058,11 +1058,11 @@ RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previou
|
||||
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
|
||||
RLAPI const char *GetApplicationDirectory(void); // Get the directory if the running application (uses static string)
|
||||
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, return true on success
|
||||
RLAPI char **LoadDirectoryFiles(const char *dirPath, int *count); // Load filenames in a directory path
|
||||
RLAPI void UnloadDirectoryFiles(void); // Clear directory files paths buffers
|
||||
RLAPI char **LoadDirectoryFiles(const char *dirPath, int *count); // Load directory filepaths
|
||||
RLAPI void UnloadDirectoryFiles(void); // Unload directory filepaths
|
||||
RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
|
||||
RLAPI char **GetDroppedFiles(int *count); // Get dropped files names (memory must be freed)
|
||||
RLAPI void ClearDroppedFiles(void); // Clear dropped files paths buffer (free memory)
|
||||
RLAPI char **LoadDroppedFiles(int *count); // Load dropped filepaths
|
||||
RLAPI void UnloadDroppedFiles(void); // Unload dropped filepaths
|
||||
RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
|
||||
|
||||
// Compression/Encoding functionality
|
||||
|
28
src/rcore.c
28
src/rcore.c
@ -404,7 +404,7 @@ typedef struct CoreData {
|
||||
Point renderOffset; // Offset from render area (must be divided by 2)
|
||||
Matrix screenScale; // Matrix to scale screen (framebuffer rendering)
|
||||
|
||||
char **dropFilesPath; // Store dropped files paths as strings
|
||||
char **dropFilepaths; // Store dropped files paths as strings
|
||||
int dropFileCount; // Count dropped files strings
|
||||
|
||||
} Window;
|
||||
@ -3109,7 +3109,7 @@ const char *GetApplicationDirectory(void)
|
||||
return appDir;
|
||||
}
|
||||
|
||||
// Get filenames in a directory path
|
||||
// Load directory filepaths
|
||||
// NOTE: Files count is returned by parameters pointer
|
||||
char **LoadDirectoryFiles(const char *dirPath, int *fileCount)
|
||||
{
|
||||
@ -3144,7 +3144,7 @@ char **LoadDirectoryFiles(const char *dirPath, int *fileCount)
|
||||
return dirFilesPath;
|
||||
}
|
||||
|
||||
// Clear directory files paths buffers
|
||||
// Unload directory filepaths
|
||||
void UnloadDirectoryFiles(void)
|
||||
{
|
||||
if (dirFileCount > 0)
|
||||
@ -3174,21 +3174,21 @@ bool IsFileDropped(void)
|
||||
else return false;
|
||||
}
|
||||
|
||||
// Get dropped files names
|
||||
char **GetDroppedFiles(int *count)
|
||||
// Load dropped filepaths
|
||||
char **LoadDroppedFiles(int *count)
|
||||
{
|
||||
*count = CORE.Window.dropFileCount;
|
||||
return CORE.Window.dropFilesPath;
|
||||
return CORE.Window.dropFilepaths;
|
||||
}
|
||||
|
||||
// Clear dropped files paths buffer
|
||||
void ClearDroppedFiles(void)
|
||||
// Unload dropped filepaths
|
||||
void UnloadDroppedFiles(void)
|
||||
{
|
||||
if (CORE.Window.dropFileCount > 0)
|
||||
{
|
||||
for (int i = 0; i < CORE.Window.dropFileCount; i++) RL_FREE(CORE.Window.dropFilesPath[i]);
|
||||
for (int i = 0; i < CORE.Window.dropFileCount; i++) RL_FREE(CORE.Window.dropFilepaths[i]);
|
||||
|
||||
RL_FREE(CORE.Window.dropFilesPath);
|
||||
RL_FREE(CORE.Window.dropFilepaths);
|
||||
|
||||
CORE.Window.dropFileCount = 0;
|
||||
}
|
||||
@ -5419,14 +5419,14 @@ static void CursorEnterCallback(GLFWwindow *window, int enter)
|
||||
// Everytime new files are dropped, old ones are discarded
|
||||
static void WindowDropCallback(GLFWwindow *window, int count, const char **paths)
|
||||
{
|
||||
ClearDroppedFiles();
|
||||
UnloadDroppedFiles();
|
||||
|
||||
CORE.Window.dropFilesPath = (char **)RL_MALLOC(count*sizeof(char *));
|
||||
CORE.Window.dropFilepaths = (char **)RL_MALLOC(count*sizeof(char *));
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
CORE.Window.dropFilesPath[i] = (char *)RL_MALLOC(MAX_FILEPATH_LENGTH*sizeof(char));
|
||||
strcpy(CORE.Window.dropFilesPath[i], paths[i]);
|
||||
CORE.Window.dropFilepaths[i] = (char *)RL_MALLOC(MAX_FILEPATH_LENGTH*sizeof(char));
|
||||
strcpy(CORE.Window.dropFilepaths[i], paths[i]);
|
||||
}
|
||||
|
||||
CORE.Window.dropFileCount = count;
|
||||
|
Loading…
Reference in New Issue
Block a user