glfw: add Window.defaultHints
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
477d8f85d8
commit
441d8d7928
2 changed files with 33 additions and 0 deletions
31
glfw/src/Window.zig
Normal file
31
glfw/src/Window.zig
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//! Window type and related functions
|
||||
|
||||
const std = @import("std");
|
||||
const c = @import("c.zig").c;
|
||||
|
||||
const Error = @import("errors.zig").Error;
|
||||
const getError = @import("errors.zig").getError;
|
||||
|
||||
const Window = @This();
|
||||
|
||||
/// Resets all window hints to their default values.
|
||||
///
|
||||
/// This function resets all window hints to their default values.
|
||||
///
|
||||
/// Possible errors include glfw.Error.NotInitialized.
|
||||
///
|
||||
/// @thread_safety This function must only be called from the main thread.
|
||||
///
|
||||
/// see also: window_hints, glfw.Window.hint, glfw.Window.hintString
|
||||
pub fn defaultHints() Error!void {
|
||||
c.glfwDefaultWindowHints();
|
||||
try getError();
|
||||
}
|
||||
|
||||
test "defaultHints" {
|
||||
const glfw = @import("main.zig");
|
||||
try glfw.init();
|
||||
defer glfw.terminate();
|
||||
|
||||
try defaultHints();
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ pub const Monitor = @import("Monitor.zig");
|
|||
pub const mouse_button = @import("mouse_button.zig");
|
||||
pub const version = @import("version.zig");
|
||||
pub const VideoMode = @import("VideoMode.zig");
|
||||
pub const Window = @import("Window.zig");
|
||||
|
||||
/// Initializes the GLFW library.
|
||||
///
|
||||
|
|
@ -149,5 +150,6 @@ test "basic" {
|
|||
_ = Monitor;
|
||||
_ = GammaRamp;
|
||||
_ = VideoMode;
|
||||
_ = Window;
|
||||
basicTest() catch unreachable;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue