glfw: add Window.hide
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
b37a94814b
commit
fc5628f997
1 changed files with 31 additions and 0 deletions
|
@ -690,6 +690,21 @@ pub inline fn show(self: Window) Error!void {
|
|||
try getError();
|
||||
}
|
||||
|
||||
/// Hides the specified window.
|
||||
///
|
||||
/// This function hides the specified window if it was previously visible. If the window is already
|
||||
/// hidden or is in full screen mode, this function does nothing.
|
||||
///
|
||||
/// Possible errors include glfw.Error.NotInitialized and glfw.Error.PlatformError.
|
||||
///
|
||||
/// @thread_safety This function must only be called from the main thread.
|
||||
///
|
||||
/// see also: window_hide, glfw.Window.show
|
||||
pub inline fn hide(self: Window) Error!void {
|
||||
c.glfwHideWindow(self.handle);
|
||||
try getError();
|
||||
}
|
||||
|
||||
test "defaultHints" {
|
||||
const glfw = @import("main.zig");
|
||||
try glfw.init();
|
||||
|
@ -1020,3 +1035,19 @@ test "show" {
|
|||
|
||||
_ = window.show() catch |err| std.debug.print("can't show window, not supported by OS maybe? error={}\n", .{err});
|
||||
}
|
||||
|
||||
test "hide" {
|
||||
const glfw = @import("main.zig");
|
||||
try glfw.init();
|
||||
defer glfw.terminate();
|
||||
|
||||
const window = glfw.Window.create(640, 480, "Hello, Zig!", null, null) catch |err| {
|
||||
// return without fail, because most of our CI environments are headless / we cannot open
|
||||
// windows on them.
|
||||
std.debug.print("note: failed to create window: {}\n", .{err});
|
||||
return;
|
||||
};
|
||||
defer window.destroy();
|
||||
|
||||
_ = window.hide() catch |err| std.debug.print("can't hide window, not supported by OS maybe? error={}\n", .{err});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue