From bda78aca74a07bf42c92a3241ea2f616bcd0c7c2 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Fri, 16 Jul 2021 16:00:28 -0700 Subject: [PATCH] glfw: add getVersionString Signed-off-by: Stephen Gutekanst --- glfw/src/main.zig | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/glfw/src/main.zig b/glfw/src/main.zig index 870d4d85..c5a88424 100644 --- a/glfw/src/main.zig +++ b/glfw/src/main.zig @@ -96,6 +96,28 @@ pub inline fn initHint(hint: c_int, value: c_int) !void { try getError(); } +/// Returns a string describing the compile-time configuration. +/// +/// This function returns the compile-time generated version string of the GLFW library binary. It +/// describes the version, platform, compiler and any platform-specific compile-time options. It +/// should not be confused with the OpenGL or OpenGL ES version string, queried with `glGetString`. +/// +/// __Do not use the version string__ to parse the GLFW library version. Use the glfw.version +/// constants instead. +/// +/// @return The ASCII encoded GLFW version string. +/// +/// @errors None. +/// +/// @remark This function may be called before @ref glfwInit. +/// +/// @pointer_lifetime The returned string is static and compile-time generated. +/// +/// @thread_safety This function may be called from any thread. +pub inline fn getVersionString() [*c]const u8 { + return c.glfwGetVersionString(); +} + pub fn basicTest() !void { try init(); defer terminate(); @@ -116,6 +138,7 @@ pub fn basicTest() !void { test "version" { std.debug.print("\nGLFW version v{}.{}.{}\n", .{ version.major, version.minor, version.revision }); + std.debug.print("\nstring: {s}\n", .{ getVersionString() }); } test "basic" {