mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-28 22:18:25 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
14 changed files with 784842 additions and 0 deletions
85
Brutal.Glfw/Generated/Libraries/Glfw.Context.gen.cs
Normal file
85
Brutal.Glfw/Generated/Libraries/Glfw.Context.gen.cs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.GlfwApi
|
||||
{
|
||||
public static unsafe partial class Glfw
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets the swap interval for the current context.
|
||||
/// </summary>
|
||||
/// <param name="interval">The minimum number of screen updates to wait for until the buffers are
|
||||
/// swapped by <see cref="GlfwWindow.SwapBuffers"/>.</param>
|
||||
/// <remarks>
|
||||
/// This function sets the swap interval for the current OpenGL or OpenGL ES context, i.e. the number of
|
||||
/// screen updates to wait from the time <see cref="GlfwWindow.SwapBuffers"/> was called before swapping the
|
||||
/// buffers and returning. This is sometimes called vertical synchronization, vertical retrace synchronization
|
||||
/// or just vsync.
|
||||
/// <para>
|
||||
/// A context that supports either of the <c>WGL_EXT_swap_control_tear</c> and
|
||||
/// <c>GLX_EXT_swap_control_tear</c> extensions also accepts negative swap intervals, which allows the
|
||||
/// driver to swap immediately even if a frame arrives a little bit late. You can check for these extensions
|
||||
/// with glfwExtensionSupported.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// A context must be current on the calling thread. Calling this function without a current context will
|
||||
/// cause a <see cref="GlfwErrorCode.NoCurrentContext"/> error.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function does not apply to Vulkan. If you are rendering with Vulkan, see the present mode of your
|
||||
/// swapchain instead.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function is not called during context creation, leaving the swap interval set to whatever is the
|
||||
/// default on that platform. This is done because some swap interval extensions used by GLFW do not allow
|
||||
/// the swap interval to be reset to zero once it has been set to a non-zero value.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Some GPU drivers do not honor the requested swap interval, either because of a user setting that
|
||||
/// overrides the application's request or due to bugs in the driver.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoCurrentContext"/>,
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#buffer_swap">Buffer swapping</seealso>
|
||||
public static void SwapInterval(int interval) => PInvoke.SwapInterval(interval);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the specified extension is available.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function returns whether the specified API extension is supported by the current OpenGL or OpenGL ES
|
||||
/// context. It searches both for client API extension and context creation API extensions.
|
||||
/// <para>
|
||||
/// A context must be current on the calling thread. Calling this function without a current context will
|
||||
/// cause a <see cref="GlfwErrorCode.NoCurrentContext"/> error.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// As this functions retrieves and searches one or more extension strings each call, it is recommended that
|
||||
/// you cache its results if it is going to be used frequently. The extension strings will not change during
|
||||
/// the lifetime of a context, so there is no danger in doing this.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function does not apply to Vulkan. If you are using Vulkan, see
|
||||
/// <see cref="GetRequiredInstanceExtensions"/>, <see cref="Vulkan.EnumerateInstanceExtensionProperties"/>
|
||||
/// and <see cref="PhysicalDeviceLibrary.EnumerateDeviceExtensionProperties"/> instead.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoCurrentContext"/>,
|
||||
/// <see cref="GlfwErrorCode.InvalidValue"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/context_guide.html#context_glext">OpenGL and
|
||||
/// OpenGL ES extensions</seealso>
|
||||
public static bool ExtensionSupported(string extension) => PInvoke.ExtensionSupported(extension) == GLFW_TRUE;
|
||||
}
|
||||
}
|
||||
31
Brutal.Glfw/Generated/Libraries/Glfw.Cursor.gen.cs
Normal file
31
Brutal.Glfw/Generated/Libraries/Glfw.Cursor.gen.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.GlfwApi
|
||||
{
|
||||
public static unsafe partial class Glfw
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a cursor with a standard shape.
|
||||
/// </summary>
|
||||
/// <param name="shape">One of the
|
||||
/// <see href="https://www.glfw.org/docs/latest/group__shapes.html">standard shapes</see>.</param>
|
||||
/// <returns>A new cursor ready to use or <c>null</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// Returns a cursor with a
|
||||
/// <see href="https://www.glfw.org/docs/latest/group__shapes.html">standard shape</see>, that can be set for
|
||||
/// a window with <see cref="GlfwWindow.SetCursor"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso cref="CreateCursor(in Brutal.GlfwApi.GlfwCursor.CreateInfo)"/>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#cursor_object">Cursor objects</seealso>
|
||||
public static GlfwCursor CreateCursor(GlfwStandardCursor shape) => PInvoke.CreateStandardCursor((int)shape);
|
||||
}
|
||||
}
|
||||
57
Brutal.Glfw/Generated/Libraries/Glfw.Initialization.gen.cs
Normal file
57
Brutal.Glfw/Generated/Libraries/Glfw.Initialization.gen.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.GlfwApi
|
||||
{
|
||||
public static unsafe partial class Glfw
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets the specified initialization hint to the desired value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function sets hints for the next initialization of GLFW.
|
||||
/// <para>
|
||||
/// The values you set hints to are never reset by GLFW, but they only take effect during initialization.
|
||||
/// Once GLFW has been initialized, any values you set will be ignored until the library is terminated and
|
||||
/// initialized again.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// 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.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <warning>
|
||||
/// The contexts of any remaining windows must not be current on any other thread when this function is
|
||||
/// called.
|
||||
/// </warning>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.InvalidEnum"/>, <see cref="GlfwErrorCode.InvalidValue"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/intro_guide.html#intro_init">Initialization and
|
||||
/// termination</seealso>
|
||||
public static void SetInitHint(GlfwInitHint hint, int value) => PInvoke.InitHint((int)hint, value);
|
||||
|
||||
/// <summary>
|
||||
/// Returns and clears the <see cref="GlfwErrorCode"/> of the last error for the calling thread.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function returns and clears the <see cref="GlfwErrorCode"/> of the last error that occurred on the
|
||||
/// calling thread, and optionally a human-readable description of it. if no error has occurred since the last
|
||||
/// call, it returns <see cref="GlfwErrorCode.NoError"/> (zero) and the description string will be empty.
|
||||
/// <para>
|
||||
/// This function may be called before <see cref="Init"/>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/intro_guide.html#error_handling">Error handling</seealso>
|
||||
public static GlfwErrorCode GetError(out string? description) =>
|
||||
(GlfwErrorCode)PInvoke.GetError(out description);
|
||||
}
|
||||
}
|
||||
458
Brutal.Glfw/Generated/Libraries/Glfw.Input.gen.cs
Normal file
458
Brutal.Glfw/Generated/Libraries/Glfw.Input.gen.cs
Normal file
|
|
@ -0,0 +1,458 @@
|
|||
// <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 whether raw mouse motion is supported.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function returns whether raw mouse motion is supported on the current system. This status does not
|
||||
/// change after GLFW has been initialized so you only need to check this once. If you attempt to enable raw
|
||||
/// motion on a system that does not support it, a <see cref="GlfwErrorCode.PlatformError"/> will be emitted.
|
||||
/// <para>
|
||||
/// Raw mouse motion is closer to the actual motion of the mouse across a surface. It is not affected by the
|
||||
/// scaling and acceleration applied to the motion of the desktop cursor. That processing is suitable for a
|
||||
/// cursor while raw motion is better for controlling for example a 3D camera. Because of this, raw mouse
|
||||
/// motion is only provided when the cursor is disabled.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="GlfwWindow.SetInputMode">GlfwWindow.SetInputMode</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#raw_mouse_motion">Raw mouse
|
||||
/// motion</seealso>
|
||||
public static bool RawMotionSupported() => PInvoke.RawMouseMotionSupported() == GLFW_TRUE;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the layout-specific name of the specified printable key.
|
||||
/// </summary>
|
||||
/// <param name="key">The key to query, or <see cref="GlfwKey.Unknown"/>.</param>
|
||||
/// <param name="scanCode">The scancode of the key to query.</param>
|
||||
/// <returns>The layout-specific name of the specified key, or null if the key is non-printable.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the name of the specified printable key, encoded as UTF-8. This is typically the
|
||||
/// character that key would produce without any modifier keys, intended for displaying key bindings to the
|
||||
/// user. For dead keys, it is typically the diacritic it would add to a character.
|
||||
/// <para>
|
||||
/// <b>Do not use this function</b> for
|
||||
/// <see href="https://www.glfw.org/docs/latest/input_guide.html#input_char">text input</see>. You will
|
||||
/// break text input for many languages even if it happens to work for yours.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the key is <see cref="GlfwKey.Unknown"/>, the scancode is used to identify the key, otherwise the
|
||||
/// scancode is ignored. If you specify a non-printable key, or <see cref="GlfwKey.Unknown"/> and a scancode
|
||||
/// that maps to a non-printable key, this function returns null but does not emit an error.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This behavior allows you to always pass in the arguments in the
|
||||
/// <see href="https://www.glfw.org/docs/latest/input_guide.html#input_key">key callback</see> without
|
||||
/// modification.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Names for printable keys depend on a keyboard layout, while names for non-printable keys are the same
|
||||
/// across layouts but depend on the application language and should be localized along with other user
|
||||
/// interface text.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidValue"/>
|
||||
/// <see cref="GlfwErrorCode.InvalidEnum"/> <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#input_key_name">Key names</seealso>
|
||||
public static string? GetKeyName(GlfwKey key, int scanCode) => PInvoke.GetKeyName((int)key, scanCode);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the platform-specific scancode of the specified key.
|
||||
/// </summary>
|
||||
/// <param name="key">Any key token.</param>
|
||||
/// <returns>The platform-specific scancode of the specified key, or <c>-1</c> if the key is not
|
||||
/// supported on the current platform or an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the platform-specified scancode of the specified key.
|
||||
/// <para>
|
||||
/// If the specified <see href="https://www.glfw.org/docs/latest/group__keys.html">key token</see>
|
||||
/// corresponds to a physical key not supported on the current platform then this method will return
|
||||
/// <c>-1</c>. Calling this function with anything other than a key token will return <c>-1</c>. and
|
||||
/// generate a <see cref="GlfwErrorCode.InvalidEnum"/> error.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#input_key">Key input</seealso>
|
||||
public static int GetKeyScanCode(int key) => PInvoke.GetKeyScanCode(key);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the specified joystick is present.
|
||||
/// </summary>
|
||||
/// <param name="joystickId">The joystick ID to query.</param>
|
||||
/// <remarks>
|
||||
/// This function returns whether the specified joystick is present.
|
||||
/// <para>
|
||||
/// There is no need to call this function before other functions that accept a joystick ID, as they all
|
||||
/// check for presence before performing any other work.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#joystick">Joystick input</seealso>
|
||||
public static bool JoystickPresent(int joystickId) => PInvoke.JoystickPresent(joystickId) == GLFW_TRUE;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the values of all axes of the specified joystick.
|
||||
/// </summary>
|
||||
/// <param name="joystickId">The joystick ID to query.</param>
|
||||
/// <returns>An array of axis values, or <c>null</c> if the joystick is not present or an error
|
||||
/// occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the values of all axes of the specified joystick. Each element in the array is a
|
||||
/// value between -1.0 and 1.0.
|
||||
/// <para>
|
||||
/// If the specified joystick is not present this function will return <c>null</c> but will not generate an
|
||||
/// error. This can be used instead of first calling
|
||||
/// <see cref="JoystickPresent(int)">Glfw.JoystickPresent</see>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#joystick_axis">Joystick axis
|
||||
/// states</seealso>
|
||||
public static ReadOnlySpan<float> GetJoystickAxes(int joystickId)
|
||||
{
|
||||
int count;
|
||||
return new ReadOnlySpan<float>(PInvoke.GetJoystickAxes(joystickId, out count), count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the state of all buttons of the specified joystick.
|
||||
/// </summary>
|
||||
/// <param name="joystickId">The joystick ID to query.</param>
|
||||
/// <returns>An array of button states, or <c>null</c> if the joystick is not present or an error
|
||||
/// occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the state of all buttons of the specified joystick. Each element in the array is
|
||||
/// either <see cref="GlfwButtonAction.Press"/> or <see cref="GlfwButtonAction.Release"/>.
|
||||
/// <para>
|
||||
/// For backward compatibility with earlier versions that did not have <see cref="GetJoystickHats"/>, the
|
||||
/// button array also includes all hats, each represented as four buttons. The hats are in the same order as
|
||||
/// returned by <c>GetJoystickHats</c> and are in the order <em>up</em>, <em>right</em>, <em>down</em> and
|
||||
/// <em>left</em>. To disable these extra buttons, set the <see cref="GlfwInitHint.JoystickHatButtons"/>
|
||||
/// init hint before initialization.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the specified joystick is not present this function will return <c>null</c> but will not generate an
|
||||
/// error. This can be used instead of first calling
|
||||
/// <see cref="JoystickPresent(int)">Glfw.JoystickPresent</see>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#joystick_button">Joystick button
|
||||
/// states</seealso>
|
||||
public static ReadOnlySpan<byte> GetJoystickButtons(int joystickId)
|
||||
{
|
||||
int count;
|
||||
return new ReadOnlySpan<byte>(PInvoke.GetJoystickButtons(joystickId, out count), count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the specified joystick.
|
||||
/// </summary>
|
||||
/// <param name="joystickId">The joystick ID to query.</param>
|
||||
/// <returns>The name of the joystick, or null if the joystick is not present or an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the name, encoded as UTF-8, of the specified joystick. The returned string is
|
||||
/// allocated and freed by GLFW. You should not free it yourself.
|
||||
/// <para>
|
||||
/// If the specified joystick is not present this function will return <c>null</c> but will not generate an
|
||||
/// error. This can be used instead of first calling
|
||||
/// <see cref="JoystickPresent(int)">Glfw.JoystickPresent</see>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#joystick_name">Joystick name</seealso>
|
||||
public static string? GetJoystickName(int joystickId) => PInvoke.GetJoystickName(joystickId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the SDL compatible GUID of the specified joystick.
|
||||
/// </summary>
|
||||
/// <param name="joystickId">The joystick ID to query.</param>
|
||||
/// <returns>The GUID of the joystick, or null if the joystick is not present or an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the SDL compatible GUID, as a UTF-8 encoded hexadecimal string, of the specified
|
||||
/// joystick. The returned string is allocated and freed by GLFW. You should not free it yourself.
|
||||
/// <para>
|
||||
/// The GUID is what connects a joystick to a gamepad mapping. A connected joystick will always have a GUID
|
||||
/// even if there is no gamepad mapping assigned to it.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the specified joystick is not present this function will return null but will not generate an error.
|
||||
/// This can be used instead of first calling <see cref="JoystickPresent(int)">Glfw.JoystickPresent</see>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The GUID uses the format introduced in SDL 2.0.5. This GUID tries to uniquely identify the make and
|
||||
/// model of a joystick but does not identify a specific unit, e.g. all wired Xbox 360 controllers will have
|
||||
/// the same GUID on that platform. The GUID for a unit may vary between platforms depending on what
|
||||
/// hardware information the platform specific APIs provide.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#gamepad">Gamepad input</seealso>
|
||||
public static string? GetJoystickGuid(int joystickId) => PInvoke.GetJoystickGuid(joystickId);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the user pointer of the specified joystick.
|
||||
/// </summary>
|
||||
/// <param name="joystickId">The joystick whose user pointer to set.</param>
|
||||
/// <param name="handle">The new user pointer value.</param>
|
||||
/// <remarks>
|
||||
/// This function sets the user-defined pointer of the specified joystick. The current value is retained until
|
||||
/// the joystick is disconnected. The initial value is <c>null</c>.
|
||||
/// <para>
|
||||
/// This function may be called from the joystick callback, even for a joystick that is being disconnected.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="GetJoystickUserPointer(int)">GetJoystickUserPointer</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#joystick_userptr">Joystick user
|
||||
/// pointer</seealso>
|
||||
public static void SetJoystickUserPointer(int joystickId, void* handle) =>
|
||||
PInvoke.SetJoystickUserPointer(joystickId, handle);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the user pointer of the specified joystick.
|
||||
/// </summary>
|
||||
/// <param name="joystickId">The joystick whose user pointer to return.</param>
|
||||
/// <remarks>
|
||||
/// This function returns the current value of the user-defined pointer of the specified joystick. The initial
|
||||
/// value is <c>null</c>.
|
||||
/// <para>
|
||||
/// This function may be called from the joystick callback, even for a joystick that is being disconnected.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="SetJoystickUserPointer">SetJoystickUserPointer</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#joystick_userptr">Joystick user
|
||||
/// pointer</seealso>
|
||||
public static void* GetJoystickUserPointer(int joystickId) => PInvoke.GetJoystickUserPointer(joystickId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the specified joystick has a gamepad mapping
|
||||
/// </summary>
|
||||
/// <param name="joystickId">The joystick ID to query.</param>
|
||||
/// <returns><c>true</c> if the joystick is both present and has a gamepad mapping, otherwise
|
||||
/// <c>false</c>.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns whether the specified joystick is both present and has a gamepad mapping.
|
||||
/// <para>
|
||||
/// If the specified joystick is present but does not have a gamepad mapping this function will return
|
||||
/// <c>false</c> but will not generate an error. Call
|
||||
/// <see cref="JoystickPresent(int)">Glfw.JoystickPresent</see> to check if a joystick is present regardless
|
||||
/// of whether it has a mapping.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="GetGamepadState"/>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#gamepad">Gamepad input</seealso>
|
||||
public static bool JoystickIsGamepad(int joystickId) => PInvoke.JoystickIsGamepad(joystickId) == GLFW_TRUE;
|
||||
|
||||
/// <summary>
|
||||
/// Adds the specified SDL_GameControllerDB gamepad mappings
|
||||
/// </summary>
|
||||
/// <param name="mappings">The string containing the gamepad mappings.</param>
|
||||
/// <returns><c>true</c> if successful, or <c>false</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function parses the specified ASCII encoded string and updates the internal list with any gamepad
|
||||
/// mappings it finds. This string may contain either a single gamepad mapping or many mappings separated by
|
||||
/// newlines. The parser supports the full format of the <c>gamecontrollerdb.txt</c> source file including
|
||||
/// empty lines and comments.
|
||||
/// <para>
|
||||
/// See <see href="https://www.glfw.org/docs/latest/input_guide.html#gamepad_mapping">Gamepad mappings</see>
|
||||
/// for a description of the format.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If there is already a gamepad mapping for a given GUID in the internal list, it will be replaced by the
|
||||
/// one passed to this function. If the library is terminated and re-initialized the internal list will
|
||||
/// revert to the built-in default.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidValue"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="JoystickIsGamepad"/>
|
||||
/// <seealso cref="GetGamepadName"/>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#gamepad">Gamepad input</seealso>
|
||||
public static bool UpdateGamepadMappings(string mappings) =>
|
||||
PInvoke.UpdateGamepadMappings(mappings) == GLFW_TRUE;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the human-readable gamepad name for the specified joystick.
|
||||
/// </summary>
|
||||
/// <param name="gamepadId">The joystick ID to query.</param>
|
||||
/// <returns>The name of the gamepad, or null if the joystick is not present, or does not have a
|
||||
/// gamepad mapping or an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the human-readable name of the gamepad from the gamepad mapping assigned to the
|
||||
/// specified joystick. If the specified joystick is not present or does not have a gamepad mapping this
|
||||
/// function will return null but will not generate an error. Call <see cref="JoystickPresent"/> to check
|
||||
/// whether it is present regardless of whether it has a mapping.
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="JoystickIsGamepad"/>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#gamepad">Gamepad input</seealso>
|
||||
public static string? GetGamepadName(int gamepadId) => PInvoke.GetGamepadName(gamepadId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the state of the specified joystick remapped as a gamepad.
|
||||
/// </summary>
|
||||
/// <param name="gamepadId">The joystick ID to query.</param>
|
||||
/// <param name="state">The gamepad state to fill.</param>
|
||||
/// <returns><c>true</c> if successful, or <c>false</c> if the joystick is not present, it does not
|
||||
/// have a gamepad mapping or an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function retrieves the state of the specified joystick remapped to an Xbox-like gamepad.
|
||||
/// <para>
|
||||
/// If the specified joystick is not present or does not have a gamepad mapping this function will return
|
||||
/// <c>false</c> but will not generate an error. Call <see cref="JoystickPresent"/> to check whether it is
|
||||
/// present regardless of whether it has a mapping.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The Guide button may not be available for input as it is often hooked by the system or the Steam client.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Not all devices have all the buttons or axes provided by <see cref="GlfwGamepadState"/>. Unavailable
|
||||
/// buttons and axes will always report <see cref="GlfwButtonAction.Release"/> and <c>0.0</c> respectively.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="UpdateGamepadMappings"/>
|
||||
/// <seealso cref="JoystickIsGamepad"/>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#gamepad">Gamepad input</seealso>
|
||||
public static bool GetGamepadState(int gamepadId, out GlfwGamepadState state)
|
||||
{
|
||||
state = default;
|
||||
return PInvoke.GetGamepadState(gamepadId, out state) == GLFW_TRUE;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the GLFW time.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function sets the current GLFW time, in seconds. The value must be a positive finite number less than
|
||||
/// or equal to <c>18446744073.0</c>, which is approximately <c>584.5</c> years.
|
||||
/// <para>
|
||||
/// This function and <see cref="Time"/> are helper functions on top of <see cref="GetTimerFrequency"/> and
|
||||
/// <see cref="GetTimerValue"/>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Reading and writing of the internal base time is not atomic,
|
||||
/// so it needs to be externally synchronized with calls to <see cref="Time"/>.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidValue"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#time">Time input</seealso>
|
||||
public static void SetTime(double time) => PInvoke.SetTime(time);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current value of the raw timer.
|
||||
/// </summary>
|
||||
/// <returns>The value of the timer, or zero if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the current value of the raw timer, measured in 1 / frequency seconds. To get the
|
||||
/// frequency, call <see cref="GetTimerFrequency"/>.
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#time">Time input</seealso>
|
||||
public static ulong GetTimerValue() => PInvoke.GetTimerValue();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the frequency, in Hz, of the raw timer.
|
||||
/// </summary>
|
||||
/// <returns>The frequency of the timer, in Hz, or zero if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the frequency, in Hz, of the raw timer.
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="GetTimerValue"/>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#time">Time input</seealso>
|
||||
public static ulong GetTimerFrequency() => PInvoke.GetTimerFrequency();
|
||||
}
|
||||
}
|
||||
253
Brutal.Glfw/Generated/Libraries/Glfw.Monitor.gen.cs
Normal file
253
Brutal.Glfw/Generated/Libraries/Glfw.Monitor.gen.cs
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
// <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);
|
||||
}
|
||||
}
|
||||
89
Brutal.Glfw/Generated/Libraries/Glfw.Native.Cocoa.gen.cs
Normal file
89
Brutal.Glfw/Generated/Libraries/Glfw.Native.Cocoa.gen.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.GlfwApi.Cocoa
|
||||
{
|
||||
/// <summary>
|
||||
/// Native handle accessors for the Cocoa (macOS) and NSGL backends. Add <c>using Brutal.GlfwApi.Cocoa;</c> to
|
||||
/// call these extension methods on <see cref="GlfwWindow"/> / <see cref="GlfwMonitor"/>.
|
||||
/// </summary>
|
||||
public static class CocoaExtensions
|
||||
{
|
||||
extension(GlfwMonitor monitor)
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the <c>CGDirectDisplayID</c> of the specified monitor.
|
||||
/// </summary>
|
||||
/// <returns>The <c>CGDirectDisplayID</c> of the specified monitor, or <c>kCGNullDirectDisplay</c>
|
||||
/// (0) if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the macOS native build. Calling it on any other platform will
|
||||
/// result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetCocoaMonitor</seealso>
|
||||
public uint GetCocoaMonitor() => Glfw.PInvoke.GetCocoaMonitor(monitor);
|
||||
}
|
||||
extension(GlfwWindow window)
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the <c>NSWindow</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The <c>NSWindow</c> handle of the specified window, or <c>0</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the macOS native build. Calling it on any other platform will
|
||||
/// result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetCocoaWindow</seealso>
|
||||
public nint GetCocoaWindow() => Glfw.PInvoke.GetCocoaWindow(window);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <c>NSView</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The <c>NSView</c> handle of the specified window, or <c>0</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the macOS native build. Calling it on any other platform will
|
||||
/// result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetCocoaView</seealso>
|
||||
public nint GetCocoaView() => Glfw.PInvoke.GetCocoaView(window);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <c>NSOpenGLContext</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The <c>NSOpenGLContext</c> handle of the specified window, or <c>0</c> if an error
|
||||
/// occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the macOS native build with NSGL context support. Calling it on any
|
||||
/// other platform will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>,
|
||||
/// <see cref="GlfwErrorCode.NoWindowContext"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetNSGLContext</seealso>
|
||||
public nint GetNSGLContext() => Glfw.PInvoke.GetNSGLContext(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
100
Brutal.Glfw/Generated/Libraries/Glfw.Native.Egl.gen.cs
Normal file
100
Brutal.Glfw/Generated/Libraries/Glfw.Native.Egl.gen.cs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.GlfwApi.Egl
|
||||
{
|
||||
/// <summary>
|
||||
/// Native handle accessors for the EGL context backend (cross-platform). Add <c>using Brutal.GlfwApi.Egl;</c> to
|
||||
/// call these extension methods on <see cref="GlfwWindow"/>.
|
||||
/// </summary>
|
||||
public static class EglExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the <c>EGLDisplay</c> used by GLFW.
|
||||
/// </summary>
|
||||
/// <returns>The <c>EGLDisplay</c> used by GLFW, or <c>EGL_NO_DISPLAY</c> (0) if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available when GLFW was built with EGL context support. Calling it otherwise will
|
||||
/// result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// <para>
|
||||
/// Because EGL is initialized on demand, this method will return <c>EGL_NO_DISPLAY</c> (0) until the first
|
||||
/// context has been created via EGL.
|
||||
/// </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/group__native.html">glfwGetEGLDisplay</seealso>
|
||||
public static nint GetEGLDisplay() => Glfw.PInvoke.GetEGLDisplay();
|
||||
|
||||
extension(GlfwWindow window)
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the <c>EGLContext</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The <c>EGLContext</c> of the specified window, or <c>EGL_NO_CONTEXT</c> (0) if an
|
||||
/// error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available when GLFW was built with EGL context support. Calling it otherwise
|
||||
/// will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetEGLContext</seealso>
|
||||
public nint GetEGLContext() => Glfw.PInvoke.GetEGLContext(window);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <c>EGLSurface</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The <c>EGLSurface</c> of the specified window, or <c>EGL_NO_SURFACE</c> (0) if an
|
||||
/// error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available when GLFW was built with EGL context support. Calling it otherwise
|
||||
/// will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetEGLSurface</seealso>
|
||||
public nint GetEGLSurface() => Glfw.PInvoke.GetEGLSurface(window);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the <c>EGLConfig</c> of the specified window's <c>EGLSurface</c>.
|
||||
/// </summary>
|
||||
/// <param name="config">Receives the <c>EGLConfig</c> of the window's <c>EGLSurface</c>, if
|
||||
/// available.</param>
|
||||
/// <returns><c>true</c> if successful, or <c>false</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available when GLFW was built with EGL context support. Calling it otherwise
|
||||
/// will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// <para>
|
||||
/// <c>EGLConfig</c> is an opaque handle. GLFW leaves it unwritten on error, as core EGL defines no
|
||||
/// invalid value, so <c>config</c> is set to 0 before the call.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetEGLConfig</seealso>
|
||||
public bool GetEGLConfig(out nint config)
|
||||
{
|
||||
config = default;
|
||||
return Glfw.PInvoke.GetEGLConfig(window, out config) == GLFW_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
78
Brutal.Glfw/Generated/Libraries/Glfw.Native.OSMesa.gen.cs
Normal file
78
Brutal.Glfw/Generated/Libraries/Glfw.Native.OSMesa.gen.cs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.GlfwApi.OSMesa
|
||||
{
|
||||
/// <summary>
|
||||
/// Native handle accessors for the OSMesa software context backend. Add <c>using Brutal.GlfwApi.OSMesa;</c> to
|
||||
/// call these extension methods on <see cref="GlfwWindow"/>.
|
||||
/// </summary>
|
||||
public static unsafe class OSMesaExtensions
|
||||
{
|
||||
extension(GlfwWindow window)
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the color buffer associated with the specified window.
|
||||
/// </summary>
|
||||
/// <param name="width">Receives the width of the color buffer.</param>
|
||||
/// <param name="height">Receives the height of the color buffer.</param>
|
||||
/// <param name="format">Receives the OSMesa pixel format of the color buffer.</param>
|
||||
/// <param name="buffer">Receives the address of the color buffer.</param>
|
||||
/// <returns><c>true</c> if successful, or <c>false</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available when GLFW was built with OSMesa context support. Calling it otherwise
|
||||
/// will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetOSMesaColorBuffer</seealso>
|
||||
public bool GetOSMesaColorBuffer(out int width, out int height, out int format, out void* buffer) =>
|
||||
Glfw.PInvoke.GetOSMesaColorBuffer(window, out width, out height, out format, out buffer) == GLFW_TRUE;
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the depth buffer associated with the specified window.
|
||||
/// </summary>
|
||||
/// <param name="width">Receives the width of the depth buffer.</param>
|
||||
/// <param name="height">Receives the height of the depth buffer.</param>
|
||||
/// <param name="bytesPerValue">Receives the number of bytes per depth buffer element.</param>
|
||||
/// <param name="buffer">Receives the address of the depth buffer.</param>
|
||||
/// <returns><c>true</c> if successful, or <c>false</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available when GLFW was built with OSMesa context support. Calling it otherwise
|
||||
/// will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetOSMesaDepthBuffer</seealso>
|
||||
public bool GetOSMesaDepthBuffer(out int width, out int height, out int bytesPerValue, out void* buffer) =>
|
||||
Glfw.PInvoke.GetOSMesaDepthBuffer(window, out width, out height, out bytesPerValue, out buffer)
|
||||
== GLFW_TRUE;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <c>OSMesaContext</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The <c>OSMesaContext</c> of the specified window, or <c>0</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available when GLFW was built with OSMesa context support. Calling it otherwise
|
||||
/// will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetOSMesaContext</seealso>
|
||||
public nint GetOSMesaContext() => Glfw.PInvoke.GetOSMesaContext(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
70
Brutal.Glfw/Generated/Libraries/Glfw.Native.Wayland.gen.cs
Normal file
70
Brutal.Glfw/Generated/Libraries/Glfw.Native.Wayland.gen.cs
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.GlfwApi.Wayland
|
||||
{
|
||||
/// <summary>
|
||||
/// Native handle accessors for the Wayland (Linux/BSD) backend. Add <c>using Brutal.GlfwApi.Wayland;</c> to call
|
||||
/// these extension methods on <see cref="GlfwWindow"/> / <see cref="GlfwMonitor"/>.
|
||||
/// </summary>
|
||||
public static class WaylandExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the <c>wl_display*</c> used by GLFW.
|
||||
/// </summary>
|
||||
/// <returns>The <c>wl_display*</c> used by GLFW, or <c>0</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the Wayland native build. Calling it on any other platform will result
|
||||
/// in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetWaylandDisplay</seealso>
|
||||
public static nint GetWaylandDisplay() => Glfw.PInvoke.GetWaylandDisplay();
|
||||
|
||||
extension(GlfwMonitor monitor)
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the <c>wl_output*</c> of the specified monitor.
|
||||
/// </summary>
|
||||
/// <returns>The <c>wl_output*</c> of the specified monitor, or <c>0</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the Wayland native build. Calling it on any other platform will
|
||||
/// result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetWaylandMonitor</seealso>
|
||||
public nint GetWaylandMonitor() => Glfw.PInvoke.GetWaylandMonitor(monitor);
|
||||
}
|
||||
extension(GlfwWindow window)
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the main <c>wl_surface*</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The main <c>wl_surface*</c> of the specified window, or <c>0</c> if an error
|
||||
/// occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the Wayland native build. Calling it on any other platform will
|
||||
/// result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetWaylandWindow</seealso>
|
||||
public nint GetWaylandWindow() => Glfw.PInvoke.GetWaylandWindow(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
93
Brutal.Glfw/Generated/Libraries/Glfw.Native.Win32.gen.cs
Normal file
93
Brutal.Glfw/Generated/Libraries/Glfw.Native.Win32.gen.cs
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.GlfwApi.Win32
|
||||
{
|
||||
/// <summary>
|
||||
/// Native handle accessors for the Win32 (Windows) and WGL backends. Add <c>using Brutal.GlfwApi.Win32;</c> to
|
||||
/// call these extension methods on <see cref="GlfwWindow"/> / <see cref="GlfwMonitor"/>.
|
||||
/// </summary>
|
||||
public static class Win32Extensions
|
||||
{
|
||||
extension(GlfwMonitor monitor)
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the adapter device name of the specified monitor.
|
||||
/// </summary>
|
||||
/// <returns>The UTF-8 encoded adapter device name (for example <c>\\.\DISPLAY1</c>) of the
|
||||
/// specified monitor, or null if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the Windows native build. Calling it on any other platform will
|
||||
/// result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetWin32Adapter</seealso>
|
||||
public string? GetWin32Adapter() => Glfw.PInvoke.GetWin32Adapter(monitor);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the display device name of the specified monitor.
|
||||
/// </summary>
|
||||
/// <returns>The UTF-8 encoded display device name (for example <c>\\.\DISPLAY1\Monitor0</c>) of
|
||||
/// the specified monitor, or null if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the Windows native build. Calling it on any other platform will
|
||||
/// result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetWin32Monitor</seealso>
|
||||
public string? GetWin32Monitor() => Glfw.PInvoke.GetWin32Monitor(monitor);
|
||||
}
|
||||
extension(GlfwWindow window)
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the <c>HWND</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The <c>HWND</c> of the specified window, or <c>0</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the Windows native build. Calling it on any other platform will
|
||||
/// result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// <para>
|
||||
/// The <c>HDC</c> associated with the window can be obtained by passing the returned <c>HWND</c> to the
|
||||
/// Win32 <c>GetDC</c> function. The returned DC is private and does not need to be released.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetWin32Window</seealso>
|
||||
public nint GetWin32Window() => Glfw.PInvoke.GetWin32Window(window);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <c>HGLRC</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The <c>HGLRC</c> of the specified window, or <c>0</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the Windows native build with WGL context support. Calling it on
|
||||
/// any other platform will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>,
|
||||
/// <see cref="GlfwErrorCode.NoWindowContext"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetWGLContext</seealso>
|
||||
public nint GetWGLContext() => Glfw.PInvoke.GetWGLContext(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
192
Brutal.Glfw/Generated/Libraries/Glfw.Native.X11.gen.cs
Normal file
192
Brutal.Glfw/Generated/Libraries/Glfw.Native.X11.gen.cs
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.GlfwApi.X11
|
||||
{
|
||||
/// <summary>
|
||||
/// Native handle accessors for the X11 (Linux/BSD) and GLX backends. Add <c>using Brutal.GlfwApi.X11;</c> to call
|
||||
/// these extension methods on <see cref="GlfwWindow"/> / <see cref="GlfwMonitor"/>.
|
||||
/// </summary>
|
||||
public static class X11Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the X11 <c>Display</c> used by GLFW.
|
||||
/// </summary>
|
||||
/// <returns>The <c>Display</c> pointer used by GLFW, or <c>0</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the X11 native build. Calling it on any other platform will result in
|
||||
/// an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetX11Display</seealso>
|
||||
public static nint GetX11Display() => Glfw.PInvoke.GetX11Display();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the contents of the current X11 primary selection as a string.
|
||||
/// </summary>
|
||||
/// <returns>The contents of the selection as a UTF-8 encoded string, or null if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the X11 native build. Calling it on any other platform will result in
|
||||
/// an <see cref="EntryPointNotFoundException"/>.
|
||||
/// <para>
|
||||
/// If the selection is empty or its contents cannot be converted, null is returned and a
|
||||
/// <see cref="GlfwErrorCode.FormatUnavailable"/> error is generated.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>,
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>, <see cref="GlfwErrorCode.FormatUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetX11SelectionString</seealso>
|
||||
public static string? GetX11SelectionString() => Glfw.PInvoke.GetX11SelectionString();
|
||||
|
||||
extension(GlfwMonitor monitor)
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the <c>RRCrtc</c> of the specified monitor.
|
||||
/// </summary>
|
||||
/// <returns>The <c>RRCrtc</c> of the specified monitor, or <c>None</c> (0) if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the X11 native build. Calling it on any other platform will result
|
||||
/// in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetX11Adapter</seealso>
|
||||
public ulong GetX11Adapter() => Glfw.PInvoke.GetX11Adapter(monitor);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <c>RROutput</c> of the specified monitor.
|
||||
/// </summary>
|
||||
/// <returns>The <c>RROutput</c> of the specified monitor, or <c>None</c> (0) if an error
|
||||
/// occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the X11 native build. Calling it on any other platform will result
|
||||
/// in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetX11Monitor</seealso>
|
||||
public ulong GetX11Monitor() => Glfw.PInvoke.GetX11Monitor(monitor);
|
||||
}
|
||||
extension(GlfwWindow window)
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the X11 <c>Window</c> XID of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The X11 <c>Window</c> of the specified window, or <c>None</c> (0) if an error
|
||||
/// occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the X11 native build. Calling it on any other platform will result
|
||||
/// in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetX11Window</seealso>
|
||||
public ulong GetX11Window() => Glfw.PInvoke.GetX11Window(window);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <c>GLXContext</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The <c>GLXContext</c> of the specified window, or <c>0</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the X11 native build with GLX context support. Calling it on any
|
||||
/// other platform will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>,
|
||||
/// <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetGLXContext</seealso>
|
||||
public nint GetGLXContext() => Glfw.PInvoke.GetGLXContext(window);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <c>GLXWindow</c> of the specified window.
|
||||
/// </summary>
|
||||
/// <returns>The <c>GLXWindow</c> of the specified window, or <c>None</c> (0) if an error
|
||||
/// occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available on the X11 native build with GLX context support. Calling it on any
|
||||
/// other platform will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>,
|
||||
/// <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetGLXWindow</seealso>
|
||||
public ulong GetGLXWindow() => Glfw.PInvoke.GetGLXWindow(window);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the <c>GLXFBConfig</c> of the specified window's <c>GLXWindow</c>.
|
||||
/// </summary>
|
||||
/// <param name="config">Receives the <c>GLXFBConfig</c> of the window's <c>GLXWindow</c>, if
|
||||
/// available.</param>
|
||||
/// <returns><c>true</c> if successful, or <c>false</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function is only available when GLFW was built with GLX context support. Calling it otherwise
|
||||
/// will result in an <see cref="EntryPointNotFoundException"/>.
|
||||
/// <para>
|
||||
/// <c>GLXFBConfig</c> is an opaque handle. GLFW leaves it unwritten on error, as core GLX defines no
|
||||
/// invalid value, so <c>config</c> is set to 0 before the call.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread. Access is not synchronized.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetGLXFBConfig</seealso>
|
||||
public bool GetGLXFBConfig(out nint config)
|
||||
{
|
||||
config = default;
|
||||
return Glfw.PInvoke.GetGLXFBConfig(window, out config) == GLFW_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current X11 primary selection to the specified string.
|
||||
/// </summary>
|
||||
/// <param name="string">A UTF-8 encoded string. Copied before this method returns.</param>
|
||||
/// <remarks>
|
||||
/// This function is only available on the X11 native build. Calling it on any other platform will result in
|
||||
/// an <see cref="EntryPointNotFoundException"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>,
|
||||
/// <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/group__native.html">glfwSetX11SelectionString</seealso>
|
||||
public static void SetX11SelectionString(string @string) => Glfw.PInvoke.SetX11SelectionString(@string);
|
||||
}
|
||||
}
|
||||
50
Brutal.Glfw/Generated/Libraries/Glfw.Platform.gen.cs
Normal file
50
Brutal.Glfw/Generated/Libraries/Glfw.Platform.gen.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// <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 platform GLFW was initialized for.
|
||||
/// </summary>
|
||||
/// <returns>One of <see cref="GlfwPlatform"/>.</returns>
|
||||
/// <remarks>
|
||||
/// <see cref="Init"/> must succeed before this method is called. If GLFW has not been initialized the
|
||||
/// returned value is undefined; check <see cref="GlfwErrorCode.NotInitialized"/> via
|
||||
/// <see cref="GetError(out string)"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso cref="IsPlatformSupported"/>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/intro_guide.html#platform">Runtime platform
|
||||
/// selection</seealso>
|
||||
public static GlfwPlatform GetPlatform() => (GlfwPlatform)PInvoke.GetPlatform();
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the library includes support for the specified platform.
|
||||
/// </summary>
|
||||
/// <param name="platform">The platform to query.</param>
|
||||
/// <returns><c>true</c> if the platform is supported, <c>false</c> otherwise.</returns>
|
||||
/// <remarks>
|
||||
/// The result depends on which backends were enabled when the GLFW native library was compiled. May be called
|
||||
/// before <see cref="Init"/>.
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso cref="GetPlatform"/>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/intro_guide.html#platform">Runtime platform
|
||||
/// selection</seealso>
|
||||
public static bool IsPlatformSupported(GlfwPlatform platform) =>
|
||||
PInvoke.PlatformSupported((int)platform) == GLFW_TRUE;
|
||||
}
|
||||
}
|
||||
148
Brutal.Glfw/Generated/Libraries/Glfw.Vulkan.gen.cs
Normal file
148
Brutal.Glfw/Generated/Libraries/Glfw.Vulkan.gen.cs
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
// <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 whether the Vulkan loader and an ICD have been found.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if Vulkan is minimally available, or <c>false</c> otherwise.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns whether the Vulkan loader and any minimally functional ICD have been found.
|
||||
/// <para>
|
||||
/// The availability of a Vulkan loader and even an ICD does not by itself guarantee that surface creation
|
||||
/// or even instance creation is possible. Call
|
||||
/// <see cref="GetRequiredInstanceExtensions">GetRequiredInstanceExtensions</see> to check whether the
|
||||
/// extensions necessary for Vulkan surface creation are available and
|
||||
/// <see cref="GetPhysicalDevicePresentationSupport">GetPhysicalDevicePresentationSupport</see> to check
|
||||
/// whether a queue family of a physical device supports image presentation.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/vulkan_guide.html#vulkan_support">Querying for
|
||||
/// Vulkan support</seealso>
|
||||
public static bool VulkanSupported() => PInvoke.VulkanSupported() == GLFW_TRUE;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Vulkan instance extensions required by GLFW.
|
||||
/// </summary>
|
||||
/// <returns>An array of ASCII encoded extension names, or <c>null</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns an array of names of Vulkan instance extensions required by GLFW for creating Vulkan
|
||||
/// surfaces for GLFW windows. If successful, the list will always contain <c>VK_KHR_surface</c>, so if you
|
||||
/// don't require any additional extensions you can pass this list directly to the VkInstanceCreateInfo
|
||||
/// struct.
|
||||
/// <para>
|
||||
/// If Vulkan is not available on the machine, this function returns <c>null</c> and generates a
|
||||
/// <see cref="GlfwErrorCode.ApiUnavailable"/> error. Call
|
||||
/// <see cref="VulkanSupported">Glfw.VulkanSupported</see> to check whether Vulkan is at least minimally
|
||||
/// available.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If Vulkan is available but no set of extensions allowing window surface creation was found, this
|
||||
/// function returns <c>null</c>. You may still use Vulkan for off-screen rendering and compute work.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Additional extensions may be required by future versions of GLFW. You should check if any extensions you
|
||||
/// wish to enable are already in the returned array, as it is an error to specify an extension more than
|
||||
/// once in the VkInstanceCreateInfo struct.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.ApiUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <pointerLifetime>
|
||||
/// The returned array is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be
|
||||
/// valid only until the library is terminated.
|
||||
/// </pointerLifetime>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/vulkan_guide.html#vulkan_ext">Querying required
|
||||
/// Vulkan extensions</seealso>
|
||||
public static byte** GetRequiredInstanceExtensions(out uint count) =>
|
||||
PInvoke.GetRequiredInstanceExtensions(out count);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the address of the specified Vulkan instance function.
|
||||
/// </summary>
|
||||
/// <returns>The address of the function, or <c>null</c> if an error occurred.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the address of the specified Vulkan core or extension function for the specified
|
||||
/// instance. If instance is set to <c>null</c> it can return any function exported from the Vulkan loader,
|
||||
/// including at least the following functions:
|
||||
/// <list type="bullet">
|
||||
/// <item><c>vkEnumerateInstanceExtensionProperties</c></item>
|
||||
/// <item><c>vkEnumerateInstanceLayerProperties</c></item>
|
||||
/// <item><c>vkCreateInstance</c></item>
|
||||
/// <item><c>vkGetInstanceProcAddr</c></item>
|
||||
/// </list>
|
||||
/// <para>
|
||||
/// If Vulkan is not available on the machine, this function returns <c>null</c> and generates a
|
||||
/// <see cref="GlfwErrorCode.ApiUnavailable"/> error. Call
|
||||
/// <see cref="VulkanSupported">Glfw.VulkanSupported</see> to check whether Vulkan is at least minimally
|
||||
/// available.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function is equivalent to calling <c>vkGetInstanceProcAddr</c> with a platform-specific query of
|
||||
/// the Vulkan loader as a fallback.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.ApiUnavailable"/>
|
||||
/// </possibleErrors>
|
||||
/// <pointerLifetime>
|
||||
/// The returned pointer is valid until the library is terminated.
|
||||
/// </pointerLifetime>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/vulkan_guide.html#vulkan_proc">Querying Vulkan
|
||||
/// function pointers</seealso>
|
||||
public static nint GetInstanceProcAddress(nint instance, string procName) =>
|
||||
PInvoke.GetInstanceProcAddress(instance, procName);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the specified queue family can present images.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function returns whether the specified queue family of the specified physical device supports
|
||||
/// presentation to the specified platform GLFW was built for.
|
||||
/// <para>
|
||||
/// If Vulkan or the required window surface creation instance extensions are not available on the machine,
|
||||
/// or if the specified instance was not created with the required extensions, this function returns
|
||||
/// <c>false</c> and generates a <see cref="GlfwErrorCode.ApiUnavailable"/> error. Call
|
||||
/// <see cref="VulkanSupported">Glfw.VulkanSupported</see> to check whether Vulkan is at least minimally
|
||||
/// available and <see cref="GetRequiredInstanceExtensions">GetRequiredInstanceExtensions</see> to check
|
||||
/// what instance extensions are required.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <macOS>
|
||||
/// This function currently always returns <c>true</c>, as the <c>VK_MVK_macos_surface</c> and
|
||||
/// <c>VK_EXT_metal_surface</c> extensions do not provide a function to query this.
|
||||
/// </macOS>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.ApiUnavailable"/>,
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/vulkan_guide.html#vulkan_present">Querying for
|
||||
/// Vulkan presentation support</seealso>
|
||||
public static bool GetPhysicalDevicePresentationSupport(
|
||||
nint instance,
|
||||
nint physicalDevice,
|
||||
int queueFamilyIndex
|
||||
) =>
|
||||
PInvoke.GetPhysicalDevicePresentationSupport(instance, physicalDevice, (uint)queueFamilyIndex) == GLFW_TRUE;
|
||||
}
|
||||
}
|
||||
587
Brutal.Glfw/Generated/Libraries/Glfw.Window.gen.cs
Normal file
587
Brutal.Glfw/Generated/Libraries/Glfw.Window.gen.cs
Normal file
|
|
@ -0,0 +1,587 @@
|
|||
// <auto-generated/>
|
||||
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.GlfwApi
|
||||
{
|
||||
public static unsafe partial class Glfw
|
||||
{
|
||||
/// <summary>
|
||||
/// Resets all window hints to their default values.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function resets all window hints to their default values.
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="WindowHint(Brutal.GlfwApi.GlfwWindowHint,int)"/>
|
||||
/// <seealso cref="WindowHint(Brutal.GlfwApi.GlfwWindowHint,string)"/>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#window_hints">Window creation
|
||||
/// hints</seealso>
|
||||
public static void DefaultWindowHints() => PInvoke.DefaultWindowHints();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the specified window hint to the desired value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function sets hints for the creation of a <see cref="GlfwWindow"/>. The hints, once set, retain their
|
||||
/// values until changed by a call to this function or <see cref="DefaultWindowHints"/>, or until the library
|
||||
/// is terminated.
|
||||
/// <para>
|
||||
/// 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 creation of a <see cref="GlfwWindow"/>
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// 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.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="DefaultWindowHints">Glfw.DefaultWindowHints</seealso>
|
||||
/// <seealso cref="WindowHint(Brutal.GlfwApi.GlfwWindowHint,string)"/>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#window_hints">Window creation
|
||||
/// hints</seealso>
|
||||
public static void WindowHint(GlfwWindowHint hint, int value) => PInvoke.WindowHint((int)hint, value);
|
||||
|
||||
/// <inheritdoc cref="WindowHint(Brutal.GlfwApi.GlfwWindowHint,int)"/>
|
||||
/// <seealso cref="WindowHint(Brutal.GlfwApi.GlfwWindowHint,int)"/>
|
||||
public static void WindowHint(GlfwWindowHint hint, string value) => PInvoke.WindowHintString((int)hint, value);
|
||||
|
||||
/// <summary>
|
||||
/// Waits until events are queued and processes them.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function puts the calling thread to sleep until at least one event is available in the event queue.
|
||||
/// Once one or more events are available, it behaves exactly like <see cref="PollEvents"/>, i.e. the events
|
||||
/// in the queue are processed and the function then returns immediately. Processing events will cause the
|
||||
/// window and input callbacks associated with those events to be called.
|
||||
/// <para>
|
||||
/// Since not all events are associated with callbacks, this function may return without a callback having
|
||||
/// been called event if you are monitoring all callbacks.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// On some platforms, a window move, resize or menu operation will cause event processing to block. This is
|
||||
/// due to how event processing is designed on those platforms. You can use the
|
||||
/// <see href="https://www.glfw.org/docs/latest/window_guide.html#window_refresh">window refresh callback</see>
|
||||
/// to redraw the contents of your window when necessary during such operations.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Do not assume that callbacks you set will <em>only</em> be called in response to event processing
|
||||
/// functions like this one. While it is necessary to poll for events, window systems that require GLFW to
|
||||
/// register callbacks of its own can pass events to GLFW in response to many window system function calls.
|
||||
/// GLFW will pass those events on to the application callbacks before returning.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Event processing is not required for joystick input to work.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <reentrancy>
|
||||
/// This function must not be called from a callback.
|
||||
/// </reentrancy>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="PollEvents">Glfw.PollEvents</seealso>
|
||||
/// <seealso cref="WaitEventsTimeout">Glfw.WaitEventsTimeout</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#events">Event processing</seealso>
|
||||
public static void WaitEvents() => PInvoke.WaitEvents();
|
||||
|
||||
/// <summary>
|
||||
/// Waits with timeout until events are queued and processes them.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function puts the calling thread to sleep until at least one event is available in the event queue,
|
||||
/// or until the specified timeout is reached. If one or more events is available, it behaves exactly like
|
||||
/// <see cref="PollEvents"/>, i.e. the events in the queue are processed and the function then returns
|
||||
/// immediately. Processing events will cause the window and input callbacks associated with those events to
|
||||
/// be called.
|
||||
/// <para>
|
||||
/// The timeout value must be a positive finite number.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Since not all events are associated with callbacks, this function may return without a callback having
|
||||
/// been called even if you are monitoring all callbacks.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// On some platforms, a window move, resize or menu operation will cause event processing to block. This is
|
||||
/// due to how event processing is designed on those platforms. You can use the
|
||||
/// <see href="https://www.glfw.org/docs/latest/window_guide.html#window_refresh">window refresh callback</see>
|
||||
/// to redraw the contents of your window when necessary during such operations.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Do not assume that callbacks you set will <em>only</em> be called in response to event processing
|
||||
/// functions like this one. While it is necessary to poll for events, window systems that require GLFW to
|
||||
/// register callbacks of its own can pass events to GLFW in response to many window system function calls.
|
||||
/// GLFW will pass those events on to the application callbacks before returning.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Event processing is not required for joystick input to work.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <reentrancy>
|
||||
/// This function must not be called from a callback.
|
||||
/// </reentrancy>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.InvalidValue"/>,
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="PollEvents">Glfw.PollEvents</seealso>
|
||||
/// <seealso cref="WaitEvents">Glfw.WaitEvents</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#events">Event processing</seealso>
|
||||
public static void WaitEventsTimeout(double timeout) => PInvoke.WaitEventsTimeout(timeout);
|
||||
|
||||
/// <summary>
|
||||
/// Posts an empty event to the event queue.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function posts an empty event from the current thread to the event queue, causing
|
||||
/// <see cref="WaitEvents"/> or <see cref="WaitEventsTimeout"/> to return.
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="WaitEvents">Glfw.WaitEvents</seealso>
|
||||
/// <seealso cref="WaitEventsTimeout">Glfw.WaitEventsTimeout</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#events">Event processing</seealso>
|
||||
public static void PostEmptyEvent() => PInvoke.PostEmptyEvent();
|
||||
}
|
||||
|
||||
public sealed partial class GlfwWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the size of the frame of the window
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function retrieves the size, in screen coordinates, of each edge of the frame of the window. This
|
||||
/// size includes the title bar, if the window has one. The size of the frame may vary depending on the
|
||||
/// <see href="https://www.glfw.org/docs/latest/window_guide.html#window_hints_wnd">window-related hints</see>
|
||||
/// used to create it.
|
||||
/// <para>
|
||||
/// Because this function retrieves the size of each window frame edge and not the offset along a particular
|
||||
/// coordinate axis, the retrieved values will always be zero or positive.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Any or all of the size arguments may be <c>null</c>. If an error occurs, all arguments will be set to
|
||||
/// zero.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#window_size">Window size</seealso>
|
||||
public void GetWindowFrameSize(out int left, out int top, out int right, out int bottom) =>
|
||||
Glfw.PInvoke.GetWindowFrameSize(this, out left, out top, out right, out bottom);
|
||||
|
||||
/// <summary>
|
||||
/// Iconifies the window
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function iconifies (minimizes) the window if it was previously restored. If the window is already
|
||||
/// iconified, this function does nothing.
|
||||
/// <para>
|
||||
/// If the window is a full screen window, GLFW restores the original video mode of the monitor. The
|
||||
/// window's desired video mode is set again when the window is restored.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="Restore">GlfwWindow.Restore</seealso>
|
||||
/// <seealso cref="Maximize">GlfwWindow.Maximize</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#window_iconify">Window
|
||||
/// iconification</seealso>
|
||||
public void Iconify() => Glfw.PInvoke.IconifyWindow(this);
|
||||
|
||||
/// <summary>
|
||||
/// Restores the window
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function restores the window if it was previously iconified (minimized) or maximized. If the window
|
||||
/// is restored, this function does nothing.
|
||||
/// <para>
|
||||
/// If the window is an iconified full screen window, its desired video mode is set again for its monitor
|
||||
/// when the window is restored.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="Iconify">GlfwWindow.Iconify</seealso>
|
||||
/// <seealso cref="Maximize">GlfwWindow.Maximize</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#window_iconify">Window
|
||||
/// iconification</seealso>
|
||||
public void Restore() => Glfw.PInvoke.RestoreWindow(this);
|
||||
|
||||
/// <summary>
|
||||
/// Maximizes the window
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function maximizes the window if it was previously not maximized. If the window is already maximized,
|
||||
/// this function does nothing.
|
||||
/// <para>
|
||||
/// If the window is a full screen window, this function does nothing.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="Iconify">GlfwWindow.Iconify</seealso>
|
||||
/// <seealso cref="Restore">GlfwWindow.Restore</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#window_iconify">Window
|
||||
/// iconification</seealso>
|
||||
public void Maximize() => Glfw.PInvoke.MaximizeWindow(this);
|
||||
|
||||
/// <summary>
|
||||
/// Brings the window to front and sets input focus
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function brings the window to front and sets input focus. The window should already be visible and
|
||||
/// not iconified.
|
||||
/// <para>
|
||||
/// By default, both windowed and full screen mode windows are focused when initially created. Set the
|
||||
/// <see cref="GLFW_FOCUSED"/> to disable this behaviour.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Do not use this function</b> to steal focus from other applications unless you are certain that is
|
||||
/// what the user wants. Focus stealing can be extremely disruptive.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// For a less disruptive way of getting the user's attention, use
|
||||
/// <see href="https://www.glfw.org/docs/latest/window_guide.html#window_attention">attention requests</see>
|
||||
/// .
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <wayland>
|
||||
/// It is not possible for an application to bring its windows to front, this function will always emit
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>.
|
||||
/// </wayland>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#window_focus">Window input focus</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#window_attention">Window
|
||||
/// attention request</seealso>
|
||||
public void Focus() => Glfw.PInvoke.FocusWindow(this);
|
||||
|
||||
/// <summary>
|
||||
/// Requests user attention to the window
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function requests user attention to the window. On platforms where this is not supported, attention
|
||||
/// is requested to the application as a whole.
|
||||
/// <para>
|
||||
/// Once the user has given attention, usually by focusing the window or application, the system will end
|
||||
/// the request automatically.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <macOS>
|
||||
/// Attention is requested to the application as a whole, not the specific
|
||||
/// </macOS>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#window_attention">Window
|
||||
/// attention request</seealso>
|
||||
public void RequestAttention() => Glfw.PInvoke.RequestWindowAttention(this);
|
||||
|
||||
/// <summary>
|
||||
/// Sets an attribute of the window
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function sets the value of an attribute of the window
|
||||
/// <para>
|
||||
/// The supported attributes are:
|
||||
/// </para>
|
||||
/// <list type="bullet">
|
||||
/// <item><see cref="GlfwWindowAttribute.Decorated"/></item>
|
||||
/// <item><see cref="GlfwWindowAttribute.Resizable"/></item>
|
||||
/// <item><see cref="GlfwWindowAttribute.Floating"/></item>
|
||||
/// <item><see cref="GlfwWindowAttribute.AutoIconify"/></item>
|
||||
/// <item><see cref="GlfwWindowAttribute.FocusOnShow"/></item>
|
||||
/// </list>
|
||||
/// <para>
|
||||
/// Some of these attributes are ignored for full screen windows. The new value will take effect if the
|
||||
/// window is later made windowed.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Some of these attributes are ignored for windowed mode windows. The new value will take effect if the
|
||||
/// window is later made full screen.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Calling <see cref="GetAttribute(Brutal.GlfwApi.GlfwWindowAttribute)">GlfwWindow.GetAttribute</see> will
|
||||
/// always return the latest value, even if hat value is ignored by the current mode of the
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <wayland>
|
||||
/// The <see cref="GlfwWindowAttribute.Floating"/> window attribute is not supported. Setting this will emit
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>.
|
||||
/// </wayland>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.InvalidEnum"/>,
|
||||
/// <see cref="GlfwErrorCode.InvalidValue"/>, <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="GetAttribute(Brutal.GlfwApi.GlfwWindowAttribute)">GlfwWindow.GetAttribute</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#window_attribs">Window
|
||||
/// attributes</seealso>
|
||||
public void SetAttribute(GlfwWindowAttribute attrib, int value) =>
|
||||
Glfw.PInvoke.SetWindowAttrib(this, (int)attrib, value);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the value of an input option for the specified window.
|
||||
/// </summary>
|
||||
/// <param name="mode">The input mode whose value to query.</param>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="GlfwWindow.SetInputMode">GlfwWindow.SetInputMode</seealso>
|
||||
public int GetInputMode(GlfwInputMode mode) => Glfw.PInvoke.GetInputMode(this, (int)mode);
|
||||
|
||||
/// <summary>
|
||||
/// Sets an input option for the specified window.
|
||||
/// </summary>
|
||||
/// <param name="mode">The input mode to set.</param>
|
||||
/// <param name="value">The new value of the specified input mode.</param>
|
||||
/// <remarks>
|
||||
/// This function sets the value of an input option for the specified window.
|
||||
/// <para>
|
||||
/// If the mode is <see cref="GlfwInputMode.Cursor"/>, the value must be one of the following cursor modes:
|
||||
/// </para>
|
||||
/// <list type="bullet">
|
||||
/// <item><see cref="GLFW_CURSOR_NORMAL"/> makes the cursor visible and behave normally</item>
|
||||
/// <item><see cref="GLFW_CURSOR_HIDDEN"/> makes the cursor invisible when it is over the content
|
||||
/// area of the window.Handle but does not restrict the cursor from leaving.</item>
|
||||
/// <item><see cref="GLFW_CURSOR_DISABLED"/> hides and grabs the cursor, providing virtual and
|
||||
/// unlimited cursor movement. This is useful for implementing for example 3D camera controls</item>
|
||||
/// </list>
|
||||
/// <para>
|
||||
/// If the mode is <see cref="GlfwInputMode.StickyKeys"/>, the value must be either <see cref="GLFW_TRUE"/>
|
||||
/// to enable stick keys, or <see cref="GLFW_FALSE"/> to disable it. If sticky keys are enabled, a key press
|
||||
/// will ensure that <see cref="GetKey(GlfwKey)">GlfwWindow.GetKey</see> returns
|
||||
/// <see cref="GlfwKeyAction.Press"/> the next time it is called even if the key had been released before
|
||||
/// the call. This is useful when you are only interested in whether keys have been pressed but not when or
|
||||
/// in which order.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the mode is <see cref="GlfwInputMode.StickyMouseButtons"/>, the value must be either
|
||||
/// <see cref="GLFW_TRUE"/> to enable stick mouse buttons, or <see cref="GLFW_FALSE"/> to disable it. If
|
||||
/// sticky mouse buttons are enabled, a key press will ensure that
|
||||
/// <see cref="GetKey(GlfwKey)">GlfwWindow.GetKey</see> returns <see cref="GlfwKeyAction.Press"/> the next
|
||||
/// time it is called even if the mouse button had been released before the call. This is useful when you
|
||||
/// are only interested in whether mouse buttons have been pressed but not when or in which order.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the mode is <see cref="GlfwInputMode.LockKeyMods"/>, the value must be either <see cref="GLFW_TRUE"/>
|
||||
/// to enable lock key modifier bits, or <see cref="GLFW_FALSE"/> to disable them. If enabled, callbacks
|
||||
/// that receive modifier bits will also have the <see cref="GLFW_MOD_CAPS_LOCK"/> bit set when the event
|
||||
/// was generated with Caps Lock on, and the <see cref="GLFW_MOD_NUM_LOCK"/> bit when Num Lock was on.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the mode is <see cref="GlfwInputMode.RawMouseMotion"/>, the value must be either
|
||||
/// <see cref="GLFW_TRUE"/> to enable raw (unscaled and unaccelerated) mouse motion when the cursor is
|
||||
/// disabled, or <see cref="GLFW_FALSE"/> to disable it. If raw motion is not supported, attempting to set
|
||||
/// this will emit a <see cref="GlfwErrorCode.PlatformError"/>. Call <see cref="Glfw.RawMotionSupported"/>
|
||||
/// to check for support.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="GetInputMode">GlfwWindow.GetInputMode</seealso>
|
||||
public void SetInputMode(GlfwInputMode mode, int value) => Glfw.PInvoke.SetInputMode(this, (int)mode, value);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the last reported state of a keyboard key for the specified window.
|
||||
/// </summary>
|
||||
/// <param name="key">The desired keyboard key. <see cref="GlfwKey.Unknown"/> is not a valid key for
|
||||
/// this function.</param>
|
||||
/// <returns>One of <see cref="GlfwKeyAction.Press"/> or <see cref="GlfwKeyAction.Release"/>.</returns>
|
||||
/// <remarks>
|
||||
/// This function returns the last state reported for the specified key to the specified window. The returned
|
||||
/// state is one of <see cref="GlfwKeyAction.Press"/> or <see cref="GlfwKeyAction.Release"/>. The action
|
||||
/// <see cref="GlfwKeyAction.Repeat"/> is only reported to the key callback.
|
||||
/// <para>
|
||||
/// If the <see cref="GlfwInputMode.StickyKeys"/> input mode is enabled, this function returns
|
||||
/// <see cref="GlfwKeyAction.Press"/> the first time you call it for a key that was pressed, even if that
|
||||
/// key has already been released.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The key functions deal with physical keys, with
|
||||
/// <see href="https://www.glfw.org/docs/latest/group__keys.html">key tokens</see> named after their use on
|
||||
/// the standard US keyboard layout. If you want to input text, use the Unicode character callback instead.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The <see href="https://www.glfw.org/docs/latest/group__mods.html">modifier key bit masks</see> are not
|
||||
/// key tokens and cannot be used with this function.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Do not use this function</b> to implement
|
||||
/// <see href="https://www.glfw.org/docs/latest/input_guide.html#input_char">text input</see>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#input_key">Key input</seealso>
|
||||
public GlfwKeyAction GetKey(GlfwKey key) => (GlfwKeyAction)Glfw.PInvoke.GetKey(this, (int)key);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the last reported state of a mouse button for the specified window.
|
||||
/// </summary>
|
||||
/// <param name="button">The desired mouse button.</param>
|
||||
/// <remarks>
|
||||
/// This function returns the last state reported for the specified mouse button to the specified window. The
|
||||
/// returned state is one of <see cref="GlfwButtonAction.Press"/> or <see cref="GlfwButtonAction.Release"/>.
|
||||
/// <para>
|
||||
/// If the <see cref="GlfwInputMode.StickyKeys"/> input mode is enabled, this function returns
|
||||
/// <see cref="GlfwButtonAction.Press"/> the first time you call it for a mouse button that was pressed,
|
||||
/// even if that mouse button has already been released.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.InvalidEnum"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#input_mouse_button">Mouse button
|
||||
/// input</seealso>
|
||||
public GlfwButtonAction GetMouseButton(GlfwMouseButton button) =>
|
||||
(GlfwButtonAction)Glfw.PInvoke.GetMouseButton(this, (int)button);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the cursor for the window
|
||||
/// </summary>
|
||||
/// <param name="cursor">The cursor to set, or <c>null</c> to revert to the default cursor.</param>
|
||||
/// <remarks>
|
||||
/// This function sets the cursor image to be used when the cursor is over the content area of the specified
|
||||
/// window. The set cursor will only be visible when the
|
||||
/// <see href="https://www.glfw.org/docs/latest/input_guide.html#cursor_mode">cursor mode</see> is
|
||||
/// <see cref="GlfwCursorMode.Normal"/>.
|
||||
/// <para>
|
||||
/// On some platforms, the set cursor may not be visible unless the window also has input focus.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function must only be called from the main thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/> <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/input_guide.html#cursor_object">Cursor objects</seealso>
|
||||
public void SetCursor(GlfwCursor cursor) => Glfw.PInvoke.SetCursor(this, cursor);
|
||||
|
||||
/// <summary>
|
||||
/// Makes the context of the specified window current for the calling thread.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function makes the OpenGL or OpenGL ES context of the specified window current on the calling thread.
|
||||
/// It can also detach the current context from the calling thread without making a new one current by passing
|
||||
/// in <c>null</c>.
|
||||
/// <para>
|
||||
/// A context must only be made current on a single thread at a time and each thread can have only a single
|
||||
/// current context at a time. Making a context current detaches any previously current context on the
|
||||
/// calling thread.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// When moving a context between threads, you must detach it (make it non-current) on the old thread before
|
||||
/// making it current on the new one.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// By default, making a context non-current implicitly forces a pipeline flush. On machines that support
|
||||
/// <c>GL_KHR_context_flush_control</c>, you can control whether a context performs this flush by setting
|
||||
/// the GLFW_CONTEXT_RELEASE_BEHAVIOR hint.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The specified window must have an OpenGL or OpenGL ES context. Specifying a window without a context
|
||||
/// will generate a <see cref="GlfwErrorCode.NoCurrentContext"/> error.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the previously current context was created via a different context creation API than the one passed
|
||||
/// to this function, GLFW will still detach the previous one from its API before making the new one
|
||||
/// current.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>,
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/context_guide.html#context_current">Current
|
||||
/// context</seealso>
|
||||
public void MakeContextCurrent() => Glfw.PInvoke.MakeContextCurrent(this);
|
||||
|
||||
/// <summary>
|
||||
/// Swaps the front and back buffers of the window
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This function swaps the front and back buffers of the window when rendering with OpenGL or OpenGL ES. If
|
||||
/// the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before
|
||||
/// swapping the buffers.
|
||||
/// <para>
|
||||
/// The window must have an OpenGL or OpenGL ES context. Specifying a window without a context will generate
|
||||
/// a <see cref="GlfwErrorCode.NoWindowContext"/> error.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This function does not apply to Vulkan.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <threadSafety>
|
||||
/// This function may be called from any thread.
|
||||
/// </threadSafety>
|
||||
/// <possibleErrors>
|
||||
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>,
|
||||
/// <see cref="GlfwErrorCode.PlatformError"/>
|
||||
/// </possibleErrors>
|
||||
/// <seealso cref="Glfw.SwapInterval">GlfwWindow.SwapInterval</seealso>
|
||||
/// <seealso href="https://www.glfw.org/docs/latest/window_guide.html#buffer_swap">Buffer swapping</seealso>
|
||||
public void SwapBuffers() => Glfw.PInvoke.SwapBuffers(this);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue