summaryrefslogtreecommitdiffhomepage
path: root/src/raylib.h
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2021-02-14 16:47:08 +0100
committerraysan5 <[email protected]>2021-02-14 16:47:08 +0100
commit0c63c7c9078167f314674ba7981ef20fbcf6a690 (patch)
treef614e21a5a67245c4dee369f8246e239d6636010 /src/raylib.h
parent2b1ec5d8d20275db7625fdff06c32ff06531cfd5 (diff)
downloadraylib-0c63c7c9078167f314674ba7981ef20fbcf6a690.tar.gz
raylib-0c63c7c9078167f314674ba7981ef20fbcf6a690.zip
Possible callbacks -WIP-
Diffstat (limited to 'src/raylib.h')
-rw-r--r--src/raylib.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/raylib.h b/src/raylib.h
index bbb25cc6..15df914b 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -877,6 +877,8 @@ typedef void (*TraceLogCallback)(int logType, const char *text, va_list args);
typedef void *(*MemAllocCallback)(int size);
typedef void *(*MemReallocCallback)(int size);
typedef void (*MemFreeCallback)(void *ptr);
+typedef unsigned char* (*LoadFileDataCallback)(const char* fileName, unsigned int* bytesRead); // Load file data as byte array (read)
+typedef char* (*LoadFileTextCallback)(const char* fileName); // Load text data from file (read), returns a '\0' terminated string
#if defined(__cplusplus)
extern "C" { // Prevents name mangling of functions
@@ -969,20 +971,22 @@ RLAPI float GetFrameTime(void); // Returns tim
RLAPI double GetTime(void); // Returns elapsed time in seconds since InitWindow()
// Misc. functions
+RLAPI int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
+RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format)
RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS)
-RLAPI void SetTraceLogLevel(int logType); // Set the current threshold (minimum) log level
-RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set a trace log callback to enable custom logging
RLAPI void TraceLog(int logType, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
-
+RLAPI void SetTraceLogLevel(int logType); // Set the current threshold (minimum) log level
RLAPI void *MemAlloc(int size); // Internal memory allocator
RLAPI void MemFree(void *ptr); // Internal memory free
+
+// Set system callbacks
+RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set a trace log callback to enable custom logging
RLAPI void SetMemAllocCallback(MemAllocCallback callback); // Set custom memory allocator
RLAPI void SetMemReallocCallback(MemReallocCallback callback); // Set custom memory reallocator
RLAPI void SetMemFreeCallback(MemFreeCallback callback); // Set custom memory free
-
-RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (saved a .png)
-RLAPI int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
+RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // override default file access functions
+RLAPI void SetLoadFileTextCallback(LoadFileDataCallback callback); // override default file access functions
// Files management functions
RLAPI unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read)