glfw: add Window.hint
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
441d8d7928
commit
f136ad0031
1 changed files with 34 additions and 0 deletions
|
|
@ -22,6 +22,31 @@ pub fn defaultHints() Error!void {
|
|||
try getError();
|
||||
}
|
||||
|
||||
/// Sets the specified window hint to the desired value.
|
||||
///
|
||||
/// This function sets hints for the next call to glfw.Window.create. The hints, once set, retain
|
||||
/// their values until changed by a call to this function or glfw.window.defaultHints, or until the
|
||||
/// library is terminated.
|
||||
///
|
||||
/// Only integer value hints can be set with this function. String value hints are set with
|
||||
/// glfw.Window.hintString.
|
||||
///
|
||||
/// This function does not check whether the specified hint values are valid. If you set hints to
|
||||
/// invalid values this will instead be reported by the next call to glfw.createWindow.
|
||||
///
|
||||
/// Some hints are platform specific. These may be set on any platform but they will only affect
|
||||
/// their specific platform. Other platforms will ignore them.
|
||||
///
|
||||
/// Possible errors include glfw.Error.NotInitialized and glfw.Error.InvalidEnum.
|
||||
///
|
||||
/// @thread_safety This function must only be called from the main thread.
|
||||
///
|
||||
/// see also: window_hints, glfw.Window.hintString, glfw.Window.defaultHints
|
||||
pub fn hint(hint_const: usize, value: isize) Error!void {
|
||||
c.glfwWindowHint(@intCast(c_int, hint_const), @intCast(c_int, value));
|
||||
try getError();
|
||||
}
|
||||
|
||||
test "defaultHints" {
|
||||
const glfw = @import("main.zig");
|
||||
try glfw.init();
|
||||
|
|
@ -29,3 +54,12 @@ test "defaultHints" {
|
|||
|
||||
try defaultHints();
|
||||
}
|
||||
|
||||
test "hint" {
|
||||
const glfw = @import("main.zig");
|
||||
try glfw.init();
|
||||
defer glfw.terminate();
|
||||
|
||||
try hint(glfw.focused, 1);
|
||||
try defaultHints();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue