From 900f5c2d8f2f9be0f7b86174ff54addd6fa99fa9 Mon Sep 17 00:00:00 2001 From: Steven Schveighoffer Date: Mon, 6 Dec 2021 12:53:52 -0500 Subject: [PATCH] Fix #2190 - Add GetRaylibVersion function for bindings other than C which do not read the header file, but may use the compiled binary library. --- src/raylib.h | 1 + src/rcore.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/raylib.h b/src/raylib.h index 41d23bfad..1154f368c 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1015,6 +1015,7 @@ RLAPI int GetRandomValue(int min, int max); // Get a rando RLAPI void SetRandomSeed(unsigned int seed); // Set the seed for the random number generator 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 const char *GetRaylibVersion(); // Get Raylib version (for non-C bindings) RLAPI void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) RLAPI void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level diff --git a/src/rcore.c b/src/rcore.c index ba64d1db1..c674be94e 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -6855,3 +6855,10 @@ const char *TextFormat(const char *text, ...) return currentBuffer; } #endif // !SUPPORT_MODULE_RTEXT + +// Get the release of raylib that this library is built with, to assist in non-C bindings determining +// a mismatch of structures and/or parameters. +const char*GetRaylibVersion() +{ + return RAYLIB_VERSION; +}