From 27d311702496e11de1939396f1117da3805f0e6c Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sat, 17 Jul 2021 21:30:52 -0700 Subject: [PATCH] glfw: move Monitor method for consistency Signed-off-by: Stephen Gutekanst --- glfw/src/Monitor.zig | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/glfw/src/Monitor.zig b/glfw/src/Monitor.zig index e768bd01..94c80837 100644 --- a/glfw/src/Monitor.zig +++ b/glfw/src/Monitor.zig @@ -226,6 +226,30 @@ pub inline fn getVideoMode(self: Monitor) Error!VideoMode { return VideoMode{ .handle = mode.?.* }; } +/// Generates a gamma ramp and sets it for the specified monitor. +/// +/// This function generates an appropriately sized gamma ramp from the specified exponent and then +/// calls glfw.Monitor.setGammaRamp with it. The value must be a finite number greater than zero. +/// +/// The software controlled gamma ramp is applied _in addition_ to the hardware gamma correction, +/// which today is usually an approximation of sRGB gamma. This means that setting a perfectly +/// linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior. +/// +/// For gamma correct rendering with OpenGL or OpenGL ES, see the glfw.srgb_capable hint. +/// +/// Possible errors include glfw.Error.NotInitialized, glfw.Error.InvalidValue and glfw.Error.PlatformError. +/// +/// wayland: Gamma handling is a privileged protocol, this function will thus never be implemented +/// and emits glfw.Error.PlatformError. +/// +/// @thread_safety This function must only be called from the main thread. +/// +/// see also: monitor_gamma +pub fn setGamma(self: Monitor, gamma: f32) Error!void { + c.glfwSetGamma(self.handle, gamma); + try getError(); +} + /// Returns the currently connected monitors. /// /// This function returns a slice of all currently connected monitors. The primary monitor is @@ -317,30 +341,6 @@ pub inline fn setCallback(comptime Data: type, data: *Data, f: ?*const fn (monit try getError(); } -/// Generates a gamma ramp and sets it for the specified monitor. -/// -/// This function generates an appropriately sized gamma ramp from the specified exponent and then -/// calls glfw.Monitor.setGammaRamp with it. The value must be a finite number greater than zero. -/// -/// The software controlled gamma ramp is applied _in addition_ to the hardware gamma correction, -/// which today is usually an approximation of sRGB gamma. This means that setting a perfectly -/// linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior. -/// -/// For gamma correct rendering with OpenGL or OpenGL ES, see the glfw.srgb_capable hint. -/// -/// Possible errors include glfw.Error.NotInitialized, glfw.Error.InvalidValue and glfw.Error.PlatformError. -/// -/// wayland: Gamma handling is a privileged protocol, this function will thus never be implemented -/// and emits glfw.Error.PlatformError. -/// -/// @thread_safety This function must only be called from the main thread. -/// -/// see also: monitor_gamma -pub fn setGamma(self: Monitor, gamma: f32) Error!void { - c.glfwSetGamma(self.handle, gamma); - try getError(); -} - test "getAll" { const glfw = @import("main.zig"); try glfw.init();