glfw: add Window.hintString
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
f136ad0031
commit
1e37864cb8
1 changed files with 36 additions and 0 deletions
|
|
@ -47,6 +47,34 @@ pub fn hint(hint_const: usize, value: isize) Error!void {
|
||||||
try getError();
|
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 string type hints can be set with this function. Integer value hints are set with
|
||||||
|
/// glfw.Window.hint.
|
||||||
|
///
|
||||||
|
/// 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.window.create.
|
||||||
|
///
|
||||||
|
/// 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. Setting these hints requires no
|
||||||
|
/// platform specific headers or functions.
|
||||||
|
///
|
||||||
|
/// Possible errors include glfw.Error.NotInitialized and glfw.Error.InvalidEnum.
|
||||||
|
///
|
||||||
|
/// @pointer_lifetime The specified string is copied before this function returns.
|
||||||
|
///
|
||||||
|
/// @thread_safety This function must only be called from the main thread.
|
||||||
|
///
|
||||||
|
/// see also: window_hints, glfw.Window.hint, glfw.Window.defaultHints
|
||||||
|
pub fn hintString(hint_const: usize, value: [:0]const u8) Error!void {
|
||||||
|
c.glfwWindowHintString(@intCast(c_int, hint_const), &value[0]);
|
||||||
|
try getError();
|
||||||
|
}
|
||||||
|
|
||||||
test "defaultHints" {
|
test "defaultHints" {
|
||||||
const glfw = @import("main.zig");
|
const glfw = @import("main.zig");
|
||||||
try glfw.init();
|
try glfw.init();
|
||||||
|
|
@ -63,3 +91,11 @@ test "hint" {
|
||||||
try hint(glfw.focused, 1);
|
try hint(glfw.focused, 1);
|
||||||
try defaultHints();
|
try defaultHints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "hintString" {
|
||||||
|
const glfw = @import("main.zig");
|
||||||
|
try glfw.init();
|
||||||
|
defer glfw.terminate();
|
||||||
|
|
||||||
|
try hintString(glfw.x11_class_name, "myclass");
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue