mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
253 lines
11 KiB
C#
253 lines
11 KiB
C#
// <auto-generated/>
|
|
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
|
#nullable enable
|
|
|
|
namespace Brutal.GlfwApi
|
|
{
|
|
public static unsafe partial class Glfw
|
|
{
|
|
/// <summary>
|
|
/// Returns the primary monitor.
|
|
/// </summary>
|
|
/// <returns>The primary monitor, or <see cref="GlfwMonitor.Null"/> if no monitors were found or if an
|
|
/// error occurred.</returns>
|
|
/// <remarks>
|
|
/// This function returns the primary monitor. This is usually the monitor where elements like the task bar or
|
|
/// global menu bar are located.
|
|
/// <para>
|
|
/// The primary monitor is always first in the array returned by <see cref="GetMonitors"/>.
|
|
/// </para>
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function must only be called from the main thread.
|
|
/// </threadSafety>
|
|
/// <seealso cref="GetMonitors"/>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/monitor_guide.html#monitor_monitors">Retrieving
|
|
/// monitors</seealso>
|
|
public static GlfwMonitor PrimaryMonitor
|
|
{
|
|
get => PInvoke.GetPrimaryMonitor();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the currently connected monitors.
|
|
/// </summary>
|
|
/// <returns>An array of monitor handles, or <c>null</c> if no monitors were found or if an error
|
|
/// occurred.</returns>
|
|
/// <remarks>
|
|
/// This function returns an array of handles for all currently connected monitors. The primary monitor is
|
|
/// always first in the returned array. If no monitors were found, this function returns <c>null</c>.
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function must only be called from the main thread.
|
|
/// </threadSafety>
|
|
/// <seealso cref="GetPrimaryMonitor"/>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/monitor_guide.html#monitor_monitors">Retrieving
|
|
/// monitors</seealso>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/monitor_guide.html#monitor_event">Monitor
|
|
/// configuration changes</seealso>
|
|
public static ReadOnlySpan<GlfwMonitor> GetMonitors()
|
|
{
|
|
int count;
|
|
return new ReadOnlySpan<GlfwMonitor>(PInvoke.GetMonitors(out count), count);
|
|
}
|
|
}
|
|
|
|
public readonly unsafe partial struct GlfwMonitor
|
|
{
|
|
/// <summary>
|
|
/// Returns the name of the monitor.
|
|
/// </summary>
|
|
/// <returns>The name of the monitor, or null if an error occurred.</returns>
|
|
/// <remarks>
|
|
/// This function returns a human-readable name of the monitor. The name typically reflects the make and model
|
|
/// of the monitor and is not guaranteed to be unique among the connected monitors.
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function must only be called from the main thread.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/monitor_guide.html#monitor_properties">Monitor
|
|
/// properties</seealso>
|
|
public string? Name
|
|
{
|
|
get => Glfw.PInvoke.GetMonitorName(this);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets/Sets the user pointer of the monitor.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This function sets the user-defined pointer of the monitor. The current value is retained until the
|
|
/// monitor is disconnected. The initial value is <c>null</c>.
|
|
/// <para>
|
|
/// This function may be called from the monitor callback, even for a monitor that is being disconnected.
|
|
/// </para>
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function may be called from any thread. Access is not synchronized.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/monitor_guide.html#monitor_userptr">User pointer</seealso>
|
|
public void* UserPointer
|
|
{
|
|
get => Glfw.PInvoke.GetMonitorUserPointer(this);
|
|
set => Glfw.PInvoke.SetMonitorUserPointer(this, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the position of the monitor's viewport on the virtual screen.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This function returns the position, in screen coordinates, of the upper-left corner of the monitor.
|
|
/// <para>
|
|
/// If an error occurs, the position is set to (0, 0).
|
|
/// </para>
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function must only be called from the main thread.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/monitor_guide.html#monitor_properties">Monitor
|
|
/// properties</seealso>
|
|
public int2 Position
|
|
{
|
|
get
|
|
{
|
|
int xPos;
|
|
int yPos;
|
|
Glfw.PInvoke.GetMonitorPos(this, out xPos, out yPos);
|
|
return new int2(xPos, yPos);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the physical size of the monitor.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This function returns the size, in millimetres, of the display area of the monitor.
|
|
/// <para>
|
|
/// Some systems do not provide accurate monitor size information, either because the monitor EDID data is
|
|
/// incorrect or because the driver does not report it accurately.
|
|
/// </para>
|
|
/// <para>
|
|
/// Any or all of the size arguments may be <c>null</c>. If an error occurs, all values will be set to zero.
|
|
/// </para>
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function must only be called from the main thread.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/monitor_guide.html#monitor_properties">Monitor
|
|
/// properties</seealso>
|
|
public int2 PhysicalSize
|
|
{
|
|
get
|
|
{
|
|
int widthMillimeters;
|
|
int heightMillimeters;
|
|
Glfw.PInvoke.GetMonitorPhysicalSize(this, out widthMillimeters, out heightMillimeters);
|
|
return new int2(widthMillimeters, heightMillimeters);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Retrieves the content scale for the monitor.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This function retrieves the content scale for the monitor. The content scale is the ratio between the
|
|
/// current DPI and the platform's default DPI. This is especially important for text and any UI elements. If
|
|
/// the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a
|
|
/// reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system
|
|
/// DPI and scaling settings being somewhat correct.
|
|
/// <para>
|
|
/// The content scale may depend on both the monitor resolution and pixel density and on user settings. It
|
|
/// may be very different from the raw DPI calculated from the physical size and current resolution.
|
|
/// </para>
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function must only be called from the main thread.
|
|
/// </threadSafety>
|
|
/// <seealso cref="GlfwWindow.ContentScale"/>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/monitor_guide.html#monitor_scale">Content scale</seealso>
|
|
public float2 ContentScale
|
|
{
|
|
get
|
|
{
|
|
float xScale;
|
|
float yScale;
|
|
Glfw.PInvoke.GetMonitorContentScale(this, out xScale, out yScale);
|
|
return new float2(xScale, yScale);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the available video modes for the monitor.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This function returns an array of all video modes supported by the monitor. The returned array is sorted
|
|
/// in ascending order, first by color bit depth (the sum of all channel depths), then by resolution area (the
|
|
/// product of width and height), then resolution width and finally by refresh rate.
|
|
/// <para>
|
|
/// On macOS the array holds the non-HiDPI modes plus the desktop mode at the time the array was created,
|
|
/// which is usually a HiDPI mode. A request matching the mode in place before GLFW changed it restores that
|
|
/// exact mode; otherwise a request matching the current mode with an explicit refresh rate keeps it.
|
|
/// </para>
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.PlatformError"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function must only be called from the main thread.
|
|
/// </threadSafety>
|
|
/// <seealso cref="VideoMode">VideoMode</seealso>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/monitor_guide.html#monitor_modes">Video modes</seealso>
|
|
public ReadOnlySpan<GlfwVidMode> VideoModes
|
|
{
|
|
get
|
|
{
|
|
int count;
|
|
return new ReadOnlySpan<GlfwVidMode>(Glfw.PInvoke.GetVideoModes(this, out count), count);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Generates a gamma ramp and sets it for the monitor.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This function generates an appropriately sized gamma ramp from the specified exponent and then calls
|
|
/// glfwSetGammaRamp with it. The value must be a finite number greater than zero.
|
|
/// <para>
|
|
/// 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.
|
|
/// </para>
|
|
/// <para>
|
|
/// For gamma correct rendering with OpenGL or OpenGL ES, see the GLFW_SRGB_CAPABLE hint.
|
|
/// </para>
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidValue"/>
|
|
/// <see cref="GlfwErrorCode.PlatformError"/>
|
|
/// </possibleErrors>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/monitor_guide.html#monitor_gamma">Gamma ramp</seealso>
|
|
public void SetGamma(float gamma) => Glfw.PInvoke.SetGamma(this, gamma);
|
|
}
|
|
}
|