Update some comments to warn users about callbacks

This commit is contained in:
Ray 2021-03-04 20:44:22 +01:00
parent b084552808
commit 0d096b43c2

View File

@ -873,15 +873,18 @@ typedef enum {
NPATCH_THREE_PATCH_HORIZONTAL // Npatch defined by 3x1 tiles NPATCH_THREE_PATCH_HORIZONTAL // Npatch defined by 3x1 tiles
} NPatchType; } NPatchType;
// Callbacks to be implemented by users // Callbacks to hook some internal functions
typedef void (*TraceLogCallback)(int logType, const char *text, va_list args); // WARNING: This callbacks are intended for advance users
typedef void *(*MemAllocCallback)(int size); typedef void (*TraceLogCallback)(int logType, const char *text, va_list args); // Logging: Redirect trace log messages
typedef void *(*MemReallocCallback)(void *ptr, int size);
typedef void (*MemFreeCallback)(void *ptr); typedef void *(*MemAllocCallback)(int size); // Memory: Custom allocator
typedef unsigned char* (*LoadFileDataCallback)(const char* fileName, unsigned int* bytesRead); typedef void *(*MemReallocCallback)(void *ptr, int size); // Memory: Custom re-allocator
typedef void (*SaveFileDataCallback)(const char *fileName, void *data, unsigned int bytesToWrite); typedef void (*MemFreeCallback)(void *ptr); // Memory: Custom free
typedef char *(*LoadFileTextCallback)(const char* fileName);
typedef void (*SaveFileTextCallback)(const char *fileName, char *text); typedef unsigned char* (*LoadFileDataCallback)(const char* fileName, unsigned int* bytesRead); // FileIO: Load binary data
typedef void (*SaveFileDataCallback)(const char *fileName, void *data, unsigned int bytesToWrite); // FileIO: Save binary data
typedef char *(*LoadFileTextCallback)(const char* fileName); // FileIO: Load text data
typedef void (*SaveFileTextCallback)(const char *fileName, char *text); // FileIO: Save text data
#if defined(__cplusplus) #if defined(__cplusplus)
@ -985,15 +988,16 @@ RLAPI void *MemAlloc(int size); // Internal me
RLAPI void *MemRealloc(void *ptr, int size); // Internal memory reallocator RLAPI void *MemRealloc(void *ptr, int size); // Internal memory reallocator
RLAPI void MemFree(void *ptr); // Internal memory free RLAPI void MemFree(void *ptr); // Internal memory free
// Set custom system callbacks // Set custom callbacks
// WARNING: Callbacks setup is intended for advance users
RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log
RLAPI void SetMemAllocCallback(MemAllocCallback callback); // Set custom memory allocator RLAPI void SetMemAllocCallback(MemAllocCallback callback); // Set custom memory allocator
RLAPI void SetMemReallocCallback(MemReallocCallback callback); // Set custom memory reallocator RLAPI void SetMemReallocCallback(MemReallocCallback callback); // Set custom memory reallocator
RLAPI void SetMemFreeCallback(MemFreeCallback callback); // Set custom memory free RLAPI void SetMemFreeCallback(MemFreeCallback callback); // Set custom memory free
RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file data loader RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader
RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file data saver RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver
RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text loader RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader
RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text saver RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver
// Files management functions // Files management functions
RLAPI unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read) RLAPI unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read)