glfw: move constants into separate modules
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
166d621797
commit
6308a2f8dd
4 changed files with 30 additions and 25 deletions
|
|
@ -262,7 +262,7 @@ fn confirmAppleSDKAgreement(allocator: *std.mem.Allocator) !bool {
|
||||||
if (try stdin.readUntilDelimiterOrEof(buf[0..], '\n')) |user_input| {
|
if (try stdin.readUntilDelimiterOrEof(buf[0..], '\n')) |user_input| {
|
||||||
try stdout.print("\n", .{});
|
try stdout.print("\n", .{});
|
||||||
var in = user_input;
|
var in = user_input;
|
||||||
if (in[in.len-1] == '\r') in = in[0..in.len-1];
|
if (in[in.len - 1] == '\r') in = in[0 .. in.len - 1];
|
||||||
return std.mem.eql(u8, in, "y") or std.mem.eql(u8, in, "Y") or std.mem.eql(u8, in, "yes") or std.mem.eql(u8, in, "");
|
return std.mem.eql(u8, in, "y") or std.mem.eql(u8, in, "Y") or std.mem.eql(u8, in, "yes") or std.mem.eql(u8, in, "");
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
10
glfw/src/action.zig
Normal file
10
glfw/src/action.zig
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
const c = @cImport(@cInclude("GLFW/glfw3.h"));
|
||||||
|
|
||||||
|
// The key or mouse button was released.
|
||||||
|
pub const release = C.GLFW_RELEASE;
|
||||||
|
|
||||||
|
// The key or mouse button was pressed.
|
||||||
|
pub const press = C.GLFW_RELEASE;
|
||||||
|
|
||||||
|
// The key was held down until it repeated.
|
||||||
|
pub const repeat = C.GLFW_REPEAT;
|
||||||
|
|
@ -3,29 +3,8 @@ 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.
|
pub const version = @import("version.zig");
|
||||||
//
|
pub const action = @import("action.zig");
|
||||||
// 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;
|
|
||||||
|
|
||||||
// The key or mouse button was released.
|
|
||||||
pub const release = C.GLFW_RELEASE
|
|
||||||
|
|
||||||
// The key or mouse button was pressed.
|
|
||||||
pub const press = C.GLFW_RELEASE
|
|
||||||
|
|
||||||
// The key was held down until it repeated.
|
|
||||||
pub const repeat = C.GLFW_REPEAT
|
|
||||||
|
|
||||||
pub fn basicTest() void {
|
pub fn basicTest() void {
|
||||||
if (c.glfwInit() != c.GLFW_TRUE) {
|
if (c.glfwInit() != c.GLFW_TRUE) {
|
||||||
|
|
@ -48,7 +27,7 @@ pub fn basicTest() void {
|
||||||
}
|
}
|
||||||
|
|
||||||
test "version" {
|
test "version" {
|
||||||
std.debug.print("\nGLFW version v{}.{}.{}\n", .{version_major, version_minor, version_revision});
|
std.debug.print("\nGLFW version v{}.{}.{}\n", .{ version.major, version.minor, version.revision });
|
||||||
}
|
}
|
||||||
|
|
||||||
test "basic" {
|
test "basic" {
|
||||||
|
|
|
||||||
16
glfw/src/version.zig
Normal file
16
glfw/src/version.zig
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
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 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 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 revision = c.GLFW_VERSION_REVISION;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue