glfw: add version constants

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-07-16 11:21:51 -07:00
parent 0a7e8d341c
commit c0c7305738

View file

@ -3,6 +3,21 @@ const testing = std.testing;
const c = @cImport(@cInclude("GLFW/glfw3.h")); const c = @cImport(@cInclude("GLFW/glfw3.h"));
// The major version number of the GLFW library.
//
// This is incremented when the API is changed in non-compatible ways.
pub const version_major = c.GLFW_VERSION_MAJOR;
// The minor version number of the GLFW library.
//
// This is incremented when features are added to the API but it remains backward-compatible.
pub const version_minor = c.GLFW_VERSION_MINOR;
// The revision number of the GLFW library.
//
// This is incremented when a bug fix release is made that does not contain any API changes.
pub const version_revision = c.GLFW_VERSION_REVISION;
pub fn basicTest() void { pub fn basicTest() void {
if (c.glfwInit() != c.GLFW_TRUE) { if (c.glfwInit() != c.GLFW_TRUE) {
@panic("failed to init"); @panic("failed to init");
@ -23,6 +38,10 @@ pub fn basicTest() void {
c.glfwTerminate(); c.glfwTerminate();
} }
test "version" {
std.debug.print("\nGLFW version v{}.{}.{}\n", .{version_major, version_minor, version_revision});
}
test "basic" { test "basic" {
basicTest(); basicTest();
} }