glfw: add version constants
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
0a7e8d341c
commit
c0c7305738
1 changed files with 19 additions and 0 deletions
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue