summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2021-02-05 10:17:21 +0100
committerRay <[email protected]>2021-02-05 10:17:21 +0100
commit3431d5858611217e14b5422670cd7ddbdc4d3d8f (patch)
tree564f5466d85cdd0bd7bfa0d2210ed1509ec2aebb /src
parent005bc4c4143f2b79ffc18fa98be144c905d2ce7f (diff)
downloadraylib-3431d5858611217e14b5422670cd7ddbdc4d3d8f.tar.gz
raylib-3431d5858611217e14b5422670cd7ddbdc4d3d8f.zip
Designing some callbacks -WIP-
Diffstat (limited to 'src')
-rw-r--r--src/raylib.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/raylib.h b/src/raylib.h
index d693f026..9116729a 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -874,6 +874,9 @@ typedef enum {
// Callbacks to be implemented by users
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);
#if defined(__cplusplus)
extern "C" { // Prevents name mangling of functions
@@ -975,6 +978,10 @@ RLAPI void TraceLog(int logType, const char *text, ...); // Show trace
RLAPI void *MemAlloc(int size); // Internal memory allocator
RLAPI void MemFree(void *ptr); // Internal memory free
+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)