diff --git a/src/Lab/CLMultiplication/Program.cs b/src/Lab/CLMultiplication/Program.cs
index af6da823b8..6d964a11e0 100644
--- a/src/Lab/CLMultiplication/Program.cs
+++ b/src/Lab/CLMultiplication/Program.cs
@@ -6,6 +6,10 @@ namespace CLMultiplication
{
internal class Program
{
+ private static int Factorial(int n)
+ {
+ return n <= 1 ? 1 : n * Factorial(n - 1);
+ }
private static unsafe void Main(string[] args)
{
string[] kernelCode =
@@ -15,12 +19,6 @@ private static unsafe void Main(string[] args)
"}"
};
-
- int Factorial(int n)
- {
- return n <= 1 ? 1 : n * Factorial(n - 1);
- }
-
// OpenCL related declarations
int err;
IntPtr platform;
diff --git a/src/Windowing/Silk.NET.GLFW/Glfw.cs b/src/Windowing/Silk.NET.GLFW/Glfw.cs
index 80d421eb81..67be6472a5 100644
--- a/src/Windowing/Silk.NET.GLFW/Glfw.cs
+++ b/src/Windowing/Silk.NET.GLFW/Glfw.cs
@@ -38,395 +38,3806 @@ protected Glfw(ref NativeApiContext ctx)
public override SearchPathContainer SearchPaths { get; } = new GlfwLibraryNameContainer();
- ///
+ ///
+ ///
+ /// This function initializes the GLFW library. Before most GLFW functions can be used,
+ /// GLFW must be initialized, and before an application terminates GLFW should be terminated in order to
+ /// free any resources allocated during or after initialization.
+ ///
+ ///
+ /// If this function fails, it calls before returning.
+ ///
+ ///
+ /// If it succeeds, you should call before the application exits.
+ ///
+ ///
+ /// Additional calls to this function after successful initialization
+ /// but before termination will return true immediately.
+ ///
+ ///
+ /// true if successful, or false if an error occurred.
+ ///
+ ///
+ /// OS X: This function will change the current directory of the application
+ /// to the Contents/Resources subdirectory of the application's bundle, if present.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract bool Init();
- ///
+ ///
+ ///
+ /// This function destroys all remaining windows and cursors, restores any modified gamma ramps
+ /// and frees any other allocated resources. Once this function is called,
+ /// you must again call successfully before you will be able to use most GLFW functions.
+ ///
+ ///
+ /// If GLFW has been successfully initialized, this function should be called before the application exits.
+ ///
+ ///
+ /// If initialization fails, there is no need to call this function,
+ /// as it is called by before it returns failure.
+ ///
+ ///
+ ///
+ ///
+ /// The contexts of any remaining windows must not be current on any other thread when this function is called.
+ ///
+ ///
+ /// This function may be called before .
+ ///
+ ///
+ /// This function must not be called from a callback.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract void Terminate();
- ///
+ ///
+ ///
+ /// This function sets hints for the next initialization of GLFW.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// The to set.
+ /// The new value of the .
+ ///
+ ///
+ /// This function may be called before .
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract void InitHint(InitHint hint, bool value);
- ///
+ ///
+ ///
+ /// This function retrieves the major, minor and revision numbers of the GLFW library.
+ /// It is intended for when you are using GLFW
+ /// as a shared library and want to ensure that you are using the minimum required version.
+ ///
+ ///
+ /// Any or all of the version arguments may be out _.
+ ///
+ ///
+ /// Where to store the major version number, or out _.
+ /// Where to store the minor version number, or out _.
+ /// Where to store the revision number, or out _.
+ ///
+ ///
+ /// This function may be called before .
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
public abstract void GetVersion(out int major, out int minor, out int revision);
- ///
+ ///
+ ///
+ /// This function returns the compile-time generated version string of the GLFW library binary.
+ /// It describes the version, platform, compiler and any platform-specific compile-time options.
+ /// It should not be confused with the OpenGL or OpenGL ES version string, queried with glGetString.
+ ///
+ ///
+ /// Do not use the version string to parse the GLFW library version.
+ /// The function provides the version of the running library binary in numerical format.
+ ///
+ ///
+ /// The ASCII-encoded GLFW version string.
+ ///
+ ///
+ /// This function may be called before .
+ ///
+ ///
+ /// The returned string is static and compile-time generated.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ ///
public abstract string GetVersionString();
- ///
+ ///
+ ///
+ /// This function returns and clears the error code of the last error that occurred on the calling thread,
+ /// and optionally a UTF-8 encoded human-readable description of it.
+ ///
+ ///
+ /// If no error has occurred since the last call,
+ /// it returns (zero) and the description pointer is set to null.
+ ///
+ ///
+ /// Where to store the error description pointer, or out _"/>.
+ /// The last error code for the calling thread, or (zero).
+ ///
+ ///
+ /// The returned string is allocated and freed by GLFW. You should not free it yourself.
+ /// It is only guaranteed to be valid until the next error occurs or the library is terminated.
+ ///
+ ///
+ /// This function may be called before .
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ ///
public abstract unsafe ErrorCode GetError(out char* description);
- ///
+ ///
+ ///
+ /// 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 null.
+ ///
+ ///
+ ///
+ /// Where to store the number of monitors in the returned array. This is set to zero if an error occurred.
+ ///
+ ///
+ /// An array of monitor handles, or null if no monitors were found or if an error occurred.
+ ///
+ ///
+ ///
+ /// The returned array is allocated and freed by GLFW. You should not free it yourself.
+ /// It is only guaranteed to be valid until the monitor configuration changes or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ ///
public abstract unsafe Monitor** GetMonitors(out int count);
- ///
+ ///
+ ///
+ /// This function returns the position, in screen coordinates, of the upper-left corner of the specified monitor.
+ ///
+ ///
+ /// The monitor to query.
+ /// Where to store the monitor x-coordinate, or out _.
+ /// Where to store the monitor y-coordinate, or out _.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void GetMonitorPos(Monitor* monitor, out int x, out int y);
- ///
+ ///
+ ///
+ /// This function returns the size, in millimetres, of the display area of the specified monitor.
+ ///
+ ///
+ /// Some systems do not provide accurate monitor size information,
+ /// either because the monitor EDID(Extended Display Identification Data) data is incorrect
+ /// or because the driver does not report it accurately.
+ ///
+ ///
+ /// Any or all of the size arguments may be out _.
+ /// If an error occurs, all non-out _ size arguments will be set to zero.
+ ///
+ ///
+ /// The monitor to query.
+ ///
+ /// Where to store the width, in millimetres, of the monitor's display area, or out _.
+ ///
+ ///
+ /// Where to store the height, in millimetres, of the monitor's display area, or out _.
+ ///
+ ///
+ ///
+ /// Windows: calculates the returned physical size from the current resolution
+ /// and system DPI instead of querying the monitor EDID data.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract unsafe void GetMonitorPhysicalSize(Monitor* monitor, out int width, out int height);
- ///
+ ///
+ ///
+ /// This function retrieves the content scale for the specified monitor.
+ ///
+ ///
+ /// The content scale is the ratio between the current DPI and the platform's default DPI.
+ ///
+ ///
+ /// If you scale all pixel dimensions by this scale then your content should appear at an appropriate size.
+ /// This is especially important for text and any UI elements.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// The monitor to query.
+ /// Where to store the x-axis content scale, or out _.
+ /// Where to store the y-axis content scale, or out _.
public abstract unsafe void GetMonitorContentScale(Monitor* monitor, out float xscale, out float yscale);
- ///
+ ///
+ ///
+ /// This function returns a human-readable name, encoded as UTF-8, of the specified monitor.
+ /// The name typically reflects the make and model of the monitor
+ /// and is not guaranteed to be unique among the connected monitors.
+ ///
+ ///
+ /// The monitor to query.
+ /// The UTF-8 encoded name of the monitor, or null if an error occurred.
+ ///
+ ///
+ /// The returned string is allocated and freed by GLFW. You should not free it yourself.
+ /// It is valid until the specified monitor is disconnected or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract unsafe string GetMonitorName(Monitor* monitor);
- ///
+ ///
+ ///
+ /// This function sets the user-defined pointer of the specified monitor.
+ /// The current value is retained until the monitor is disconnected.
+ /// The initial value is .
+ ///
+ ///
+ /// This function may be called from the monitor callback, even for a monitor that is being disconnected.
+ ///
+ ///
+ /// The monitor whose pointer to set.
+ /// The new value.
+ ///
+ ///
+ /// This function may be called from any thread. Access is not synchronized.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract unsafe void SetMonitorUserPointer(Monitor* monitor, IntPtr pointer);
- ///
+ ///
+ ///
+ /// This function returns the current value of the user-defined pointer of the specified monitor.
+ /// The initial value is .
+ ///
+ ///
+ /// This function may be called from the monitor callback, even for a monitor that is being disconnected.
+ ///
+ ///
+ /// The monitor whose pointer to return.
+ /// The user-defined pointer of the given .
+ ///
+ ///
+ /// This function may be called from any thread. Access is not synchronized.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract unsafe IntPtr GetMonitorUserPointer(Monitor* monitor);
- ///
+ ///
+ ///
+ /// This function returns an array of all video modes supported by the specified monitor.
+ /// The returned array is sorted in ascending order, first by color bit depth (the sum of all channel depths)
+ /// and then by resolution area (the product of width and height).
+ ///
+ ///
+ /// The monitor to query.
+ ///
+ /// Where to store the number of video modes in the returned array.
+ /// This is set to zero if an error occurred.
+ ///
+ /// An array of video modes, or null if an error occurred.
+ ///
+ ///
+ /// The returned array is allocated and freed by GLFW. You should not free it yourself.
+ /// It is valid until the specified monitor is disconnected,
+ /// this function is called again for that monitor, or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe VideoMode* GetVideoModes(Monitor* monitor, out int count);
- ///
+ ///
+ ///
+ /// This function generates a 256-element gamma ramp from the specified exponent and then calls
+ /// with it. The value must be a finite number greater than zero.
+ ///
+ ///
+ /// The monitor whose gamma ramp to set.
+ /// The desired exponent.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract unsafe void SetGamma(Monitor* monitor, float gamma);
- ///
+ ///
+ ///
+ /// This function returns the current gamma ramp of the specified monitor.
+ ///
+ ///
+ /// The monitor to query.
+ /// The current gamma ramp, or null if an error occurred.
+ ///
+ ///
+ /// The returned structure and its arrays are allocated and freed by GLFW.
+ /// You should not free them yourself. They are valid until the specified monitor is disconnected,
+ /// this function is called again for that monitor or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe GammaRamp* GetGammaRamp(Monitor* monitor);
- ///
+ ///
+ ///
+ /// This function sets the current gamma ramp for the specified monitor.
+ ///
+ ///
+ /// The original gamma ramp for that monitor
+ /// is saved by GLFW the first time this function is called and is restored by .
+ ///
+ ///
+ /// The monitor whose gamma ramp to set.
+ /// The gamma ramp to use.
+ ///
+ ///
+ /// Gamma ramp sizes other than 256 are not supported by all platforms or graphics hardware.
+ ///
+ ///
+ /// Windows: The gamma ramp size must be 256.
+ ///
+ ///
+ /// The specified gamma ramp is copied before this function returns.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void SetGammaRamp(Monitor* monitor, ref GammaRamp ramp);
- ///
+ ///
+ ///
+ /// This function resets all window hints to their default values.
+ ///
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
public abstract void DefaultWindowHints();
- ///
+ ///
+ ///
+ /// Sets the specified window hint to the desired value.
+ ///
+ ///
+ /// This function sets hints for the next call to @ref glfwCreateWindow. The
+ /// hints, once set, retain their values until changed by a call to this
+ /// function or , or until the library is terminated.
+ ///
+ ///
+ /// This function does not check whether the specified hint values are valid.
+ /// If you set hints to invalid values this will instead be reported by the next
+ /// call to .
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// The window hint to set.
+ /// The new value of the set hint.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ /// The string is copied before this function returns.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
public abstract void WindowHintString(int hint, string value);
- ///
- public abstract unsafe void SetWindowSizeLimits(WindowHandle* window, int minwidth, int minheight, int maxwidth,
- int maxheight);
+ ///
+ ///
+ /// This function sets the size limits of the client area of the specified window.
+ ///
+ ///
+ /// If the window is full screen, the size limits only take effect once it is made windowed.
+ ///
+ ///
+ /// If the window is not resizable, this function does nothing.
+ ///
+ ///
+ /// The size limits are applied immediately to a windowed mode window and may cause it to be resized.
+ ///
+ ///
+ /// The maximum dimensions must be greater than or equal to the minimum dimensions
+ /// and all must be greater than or equal to zero.
+ ///
+ ///
+ /// The window to set limits for.
+ ///
+ /// The minimum width, in screen coordinates, of the client area, or .
+ ///
+ ///
+ /// The minimum height, in screen coordinates, of the client area, or .
+ ///
+ ///
+ /// The maximum width, in screen coordinates, of the client area, or .
+ ///
+ ///
+ /// The maximum height, in screen coordinates, of the client area, or .
+ ///
+ ///
+ ///
+ /// If you set size limits and an aspect ratio that conflict, the results are undefined.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
+ public abstract unsafe void SetWindowSizeLimits
+ (
+ WindowHandle* window,
+ int minwidth,
+ int minheight,
+ int maxwidth,
+ int maxheight
+ );
- ///
+ ///
+ ///
+ /// This function sets the required aspect ratio of the client area of the specified window.
+ ///
+ ///
+ /// If the window is full screen, the aspect ratio only takes effect once it is made windowed.
+ ///
+ ///
+ /// If the window is not resizable, this function does nothing.
+ ///
+ ///
+ /// The aspect ratio is specified as a numerator and a denominator and both values must be greater than zero.
+ /// For example, the common 16:9 aspect ratio is specified as 16 and 9, respectively.
+ ///
+ ///
+ /// If the numerator and denominator is set to then the aspect ratio limit is disabled.
+ ///
+ ///
+ /// The aspect ratio is applied immediately to a windowed mode window and may cause it to be resized.
+ ///
+ ///
+ /// The window to set limits for.
+ /// The numerator of the desired aspect ratio, or .
+ /// The denominator of the desired aspect ratio, or .
+ ///
+ ///
+ /// If you set size limits and an aspect ratio that conflict, the results are undefined.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract unsafe void SetWindowAspectRatio(WindowHandle* window, int numer, int denom);
- ///
- public abstract unsafe void GetWindowFrameSize(WindowHandle* window, out int left, out int top, out int right,
- out int bottom);
+ ///
+ ///
+ /// This function retrieves the size, in screen coordinates, of each edge of the frame of the specified window.
+ ///
+ ///
+ /// This size includes the title bar, if the window has one.
+ /// The size of the frame may vary depending on the window-related hints used to create it.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// Any or all of the size arguments may be out _.
+ /// If an error occurs, all non-out _ size arguments will be set to zero.
+ ///
+ ///
+ /// The window whose frame size to query.
+ ///
+ /// Where to store the size, in screen coordinates, of the left edge of the window frame, or out _.
+ ///
+ ///
+ /// Where to store the size, in screen coordinates, of the top edge of the window frame, or out _.
+ ///
+ ///
+ /// Where to store the size, in screen coordinates, of the right edge of the window frame, or out _.
+ ///
+ ///
+ /// Where to store the size, in screen coordinates, of the bottom edge of the window frame, or out _.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ public abstract unsafe void GetWindowFrameSize
+ (
+ WindowHandle* window,
+ out int left,
+ out int top,
+ out int right,
+ out int bottom
+ );
- ///
+ ///
+ ///
+ /// This function returns the opacity of the window, including any decorations.
+ ///
+ ///
+ /// The opacity (or alpha) value is a positive finite number between zero and one,
+ /// where zero is fully transparent and one is fully opaque.
+ ///
+ ///
+ /// If the system does not support whole window transparency, this function always returns one.
+ ///
+ ///
+ /// The initial opacity value for newly created windows is one.
+ ///
+ ///
+ /// The window to query.
+ /// The opacity value of the specified window.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe float GetWindowOpacity(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function sets the opacity of the window, including any decorations.
+ ///
+ ///
+ /// The opacity (or alpha) value is a positive finite number between zero and one,
+ /// where zero is fully transparent and one is fully opaque.
+ ///
+ ///
+ /// The initial opacity value for newly created windows is one.
+ ///
+ ///
+ /// A window created with framebuffer transparency may not use whole window transparency.
+ /// The results of doing this are undefined.
+ ///
+ ///
+ /// The window to set the opacity for.
+ /// The desired opacity of the specified window.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe void SetWindowOpacity(WindowHandle* window, float opacity);
- ///
+ ///
+ ///
+ /// This function requests user attention to the specified window.
+ /// On platforms where this is not supported, attention is requested to the application as a whole.
+ ///
+ ///
+ /// Once the user has given attention, usually by focusing the window or application,
+ /// the system will end the request automatically.
+ ///
+ ///
+ /// The window to request attention to.
+ ///
+ ///
+ /// macOS: Attention is requested to the application as a whole, not the specific window.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void RequestWindowAttention(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function sets the value of an attribute of the specified window.
+ ///
+ ///
+ /// The supported attributes are ,
+ /// , ,
+ /// and .
+ ///
+ ///
+ /// Some of these attributes are ignored for full screen windows.
+ /// The new value will take effect if the window is later made windowed.
+ ///
+ ///
+ /// Some of these attributes are ignored for windowed mode windows.
+ /// The new value will take effect if the window is later made full screen.
+ ///
+ ///
+ /// The window to set the attribute for.
+ /// A supported window attribute.
+ /// true or false.
+ ///
+ ///
+ /// Calling will always return the latest value,
+ /// even if that value is ignored by the current mode of the window.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , ,
+ /// and .
+ ///
+ ///
public abstract unsafe void SetWindowAttrib(WindowHandle* window, WindowAttributeSetter attrib, bool value);
- ///
+ ///
+ ///
+ /// 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,
+ /// will be emitted.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ /// true if raw mouse motion is supported on the current machine, or false otherwise.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract bool RawMouseMotionSupported();
- ///
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// Do not use this function for text input.
+ /// You will break text input for many languages even if it happens to work for yours.
+ ///
+ ///
+ /// If the key is , the scancode is used to identify the key, otherwise the scancode is ignored.
+ /// If you specify a non-printable key, or and a scancode that maps to a non-printable key,
+ /// this function returns null but does not emit an error.
+ ///
+ ///
+ /// This behavior allows you to always pass in the arguments in the key callback without modification.
+ ///
+ ///
+ /// The printable keys are:
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ /// to
+ ///
+ /// -
+ /// to
+ ///
+ /// -
+ /// to
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ /// -
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Names for printable keys depend on 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.
+ ///
+ ///
+ /// The key to query, or .
+ /// The scancode of the key to query.
+ /// The UTF-8 encoded, layout-specific name of the key, or null.
+ ///
+ ///
+ /// The returned string is allocated and freed by GLFW. You should not free it yourself.
+ /// It is valid until the next call to , or until the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract string GetKeyName(int key, int scancode);
- ///
+ ///
+ ///
+ /// This function returns the platform-specific scancode of the specified key.
+ ///
+ ///
+ /// If the key is or does not exist on the keyboard this method will return -1.
+ ///
+ ///
+ /// Any named key.
+ /// The platform-specific scancode for the key, or -1 if an error occurred.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract int GetKeyScancode(int key);
- ///
+ ///
+ ///
+ /// This function returns the last state reported for the specified key to the specified window.
+ /// The returned state is one of or .
+ /// The higher-level action is only reported to the key callback.
+ ///
+ ///
+ /// If the input mode is enabled, this function returns
+ /// the first time you call it for a key that was pressed,
+ /// even if that key has already been released.
+ ///
+ ///
+ /// The key functions deal with physical keys,
+ /// with key tokens named after their use on the standard US keyboard layout.
+ /// If you want to input text, use the Unicode character callback instead.
+ ///
+ ///
+ /// The modifier key bit masks are not key tokens and cannot be used with this function.
+ ///
+ ///
+ /// Do not use this function to implement text input.
+ ///
+ ///
+ /// The desired window.
+ ///
+ /// The desired keyboard key. is not a valid key for this function.
+ ///
+ /// One of or .
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe int GetKey(WindowHandle* window, Keys key);
- ///
+ ///
+ ///
+ /// This function returns the last state reported for the specified mouse button to the specified window.
+ /// The returned state is one of or .
+ ///
+ ///
+ /// If the input mode is enabled, this function returns
+ /// the first time you call it for a mouse button that was pressed,
+ /// even if that mouse button has already been released.
+ ///
+ ///
+ /// The desired window.
+ /// The desired mouse button.
+ /// One of or .
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe int GetMouseButton(WindowHandle* window, int button);
- ///
+ ///
+ ///
+ /// This function returns the position of the cursor,
+ /// in screen coordinates, relative to the upper-left corner of the client area of the specified window.
+ ///
+ ///
+ /// If the cursor is disabled (with ) then the cursor position
+ /// is unbounded and limited only by the minimum and maximum values of a double.
+ ///
+ ///
+ /// The coordinate can be converted to their integer equivalents with the floor function.
+ /// Casting directly to an integer type works for positive coordinates, but fails for negative ones.
+ ///
+ ///
+ /// Any or all of the position arguments may be out _.
+ /// If an error occurs, all non-out _ position arguments will be set to zero.
+ ///
+ ///
+ /// The desired window.
+ ///
+ /// Where to store the cursor x-coordinate, relative to the left edge of the client area, or out _.
+ ///
+ ///
+ /// Where to store the cursor y-coordinate, relative to the to top edge of the client area, or out _.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void GetCursorPos(WindowHandle* window, out double xpos, out double ypos);
- ///
+ ///
+ ///
+ /// This function sets the position, in screen coordinates,
+ /// of the cursor relative to the upper-left corner of the client area of the specified window.
+ ///
+ ///
+ /// The window must have input focus.
+ /// If the window does not have input focus when this function is called, it fails silently.
+ ///
+ ///
+ /// Do not use this function to implement things like camera controls.
+ /// GLFW already provides the cursor mode that hides the cursor,
+ /// transparently re-centers it and provides unconstrained cursor motion.
+ /// See for more information.
+ ///
+ ///
+ /// If the cursor mode is then the cursor position is unconstrained
+ /// and limited only by the minimum and maximum values of a double.
+ ///
+ ///
+ /// The desired window.
+ /// The desired x-coordinate, relative to the left edge of the client area.
+ /// The desired y-coordinate, relative to the top edge of the client area.
+ ///
+ ///
+ /// Wayland: This function will only work when the cursor mode is ,
+ /// otherwise it will do nothing.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void SetCursorPos(WindowHandle* window, double xpos, double ypos);
- ///
+ ///
+ ///
+ /// Creates a new custom cursor image that can be set for a window with .
+ ///
+ ///
+ /// The cursor can be destroyed with .
+ /// Any remaining cursors are destroyed by .
+ ///
+ ///
+ /// The pixels are 32-bit, little-endian, non-premultiplied RGBA,
+ /// i.e. eight bits per channel with the red channel first.
+ /// They are arranged canonically as packed sequential rows, starting from the top-left corner.
+ ///
+ ///
+ /// The cursor hotspot is specified in pixels, relative to the upper-left corner of the cursor image.
+ /// Like all other coordinate systems in GLFW, the X-axis points to the right and the Y-axis points down.
+ ///
+ ///
+ /// The desired cursor image.
+ /// The desired x-coordinate, in pixels, of the cursor hotspot.
+ /// The desired y-coordinate, in pixels, of the cursor hotspot.
+ /// The handle of the created cursor, or null if an error occurred.
+ ///
+ ///
+ /// The specified image data is copied before this function returns.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe Cursor* CreateCursor(Image* image, int xhot, int yhot);
- ///
+ ///
+ ///
+ /// Returns a cursor with a standard shape, that can be set for a window with .
+ ///
+ ///
+ /// One of the standard shapes.
+ /// A new cursor ready to use or null if an error occurred.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract unsafe Cursor* CreateStandardCursor(CursorShape shape);
- ///
+ ///
+ ///
+ /// This function destroys a cursor previously created with .
+ /// Any remaining cursors will be destroyed by .
+ ///
+ ///
+ /// If the specified cursor is current for any window, that window will be reverted to the default cursor.
+ /// This does not affect the cursor mode.
+ ///
+ ///
+ /// The cursor object to destroy.
+ ///
+ ///
+ /// This function must not be called from a callback.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void DestroyCursor(Cursor* cursor);
- ///
+ ///
+ ///
+ /// This function sets the cursor image to be used when the cursor is over the client area
+ /// of the specified window.
+ ///
+ ///
+ /// The set cursor will only be visible
+ /// when the cursor mode of the window is .
+ ///
+ ///
+ /// On some platforms, the set cursor may not be visible unless the window also has input focus.
+ ///
+ ///
+ /// The window to set the cursor for.
+ /// The cursor to set, or null to switch back to the default arrow cursor.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void SetCursor(WindowHandle* window, Cursor* cursor);
- ///
+ ///
+ ///
+ /// This function returns whether the specified joystick is present.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// The joystick to query.
+ /// true if the joystick is present, or false otherwise.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract bool JoystickPresent(int jid);
- ///
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// 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 .
+ ///
+ ///
+ /// The joystick to query.
+ ///
+ /// Where to store the number of axis values in the returned array.
+ /// This is set to zero if the joystick is not present or an error occurred.
+ ///
+ ///
+ /// An array of axis values, or null if the joystick is not present or an error occurred.
+ ///
+ ///
+ ///
+ /// The returned array is allocated and freed by GLFW.
+ /// You should not free it yourself.
+ /// It is valid until the specified joystick is disconnected or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract unsafe float* GetJoystickAxes(int jid, out int count);
- ///
+ ///
+ ///
+ /// This function returns the state of all buttons of the specified joystick.
+ /// Each element in the array is either or .
+ ///
+ ///
+ /// For backward compatibility with earlier versions that did not have ,
+ /// the button array also includes all hats, each represented as four buttons.
+ ///
+ ///
+ /// The hats are in the same order as returned by and are in the order
+ /// up, right, down and left.
+ ///
+ ///
+ /// To disable these extra buttons, set the
+ /// init hint before initialization.
+ ///
+ ///
+ /// 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 .
+ ///
+ ///
+ /// The joystick to query.
+ ///
+ /// Where to store the number of button states in the returned array.
+ /// This is set to zero if the joystick is not present or an error occurred.
+ ///
+ ///
+ /// An array of button states, or null if the joystick is not present or an error occurred.
+ ///
+ ///
+ ///
+ /// The returned array is allocated and freed by GLFW. You should not free it yourself.
+ /// It is valid until the specified joystick is disconnected or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract unsafe byte* GetJoystickButtons(int jid, out int count);
- ///
+ ///
+ ///
+ /// This function returns the state of all hats of the specified joystick.
+ /// Each element in the array is one of the .
+ ///
+ ///
+ /// The diagonal directions are bitwise combinations of the primary (up, right, down and left) directions
+ /// and you can test for these individually by ANDing it with the corresponding direction.
+ ///
+ /// if (hats[2].HasFlag(JoystickHats.Right))
+ /// {
+ /// // State of hat 2 could be right-up, right or right-down
+ /// }
+ ///
+ ///
+ ///
+ /// 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 .
+ ///
+ ///
+ /// The joystick to query.
+ ///
+ /// Where to store the number of hat states in the returned array.
+ /// This is set to zero if the joystick is not present or an error occurred.
+ ///
+ ///
+ /// An array of hat states, or null if the joystick is not present or an error occurred.
+ ///
+ ///
+ ///
+ /// The returned array is allocated and freed by GLFW. You should not free it yourself
+ /// It is valid until the specified joystick is disconnected,
+ /// this function is called again for that joystick or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract unsafe JoystickHats* GetJoystickHats(int jid, out int count);
- ///
+ ///
+ ///
+ /// This function returns the name, encoded as UTF-8, of the specified joystick.
+ ///
+ ///
+ /// 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 .
+ ///
+ ///
+ /// The joystick to query.
+ ///
+ /// The UTF-8 encoded name of the joystick, or null if the joystick is not present or an error occurred.
+ ///
+ ///
+ ///
+ /// The returned string is allocated and freed by GLFW. You should not free it yourself.
+ /// It is valid until the specified joystick is disconnected or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract string GetJoystickName(int jid);
- ///
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// 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 .
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// The joystick to query.
+ ///
+ /// The UTF-8 encoded GUID of the joystick, or null if the joystick is not present or an error occurred.
+ ///
+ ///
+ ///
+ /// The returned string is allocated and freed by GLFW. You should not free it yourself.
+ /// It is valid until the specified joystick is disconnected or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract string GetJoystickGUID(int jid);
- ///
+ ///
+ ///
+ /// 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 .
+ ///
+ ///
+ /// This function may be called from the joystick callback, even for a joystick that is being disconnected.
+ ///
+ ///
+ /// The joystick whose pointer to set.
+ /// The new value.
+ ///
+ ///
+ /// This function may be called from any thread. Access is not synchronized.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract void SetJoystickUserPointer(int jid, IntPtr ptr);
- ///
+ ///
+ ///
+ /// This function returns the current value of the user-defined pointer of the specified joystick.
+ /// The initial value is .
+ ///
+ ///
+ /// This function may be called from the joystick callback, even for a joystick that is being disconnected.
+ ///
+ ///
+ /// The joystick whose pointer to return.
+ /// The user-defined pointer of the given .
+ ///
+ ///
+ /// This function may be called from any thread. Access is not synchronized.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract IntPtr GetJoystickUserPointer(int jid);
- ///
+ ///
+ ///
+ /// This function returns whether the specified joystick is both present and has a gamepad mapping.
+ ///
+ ///
+ /// If the specified joystick is present but does not have a gamepad mapping
+ /// this function will return false but will not generate an error.
+ ///
+ ///
+ /// The joystick to query.
+ ///
+ /// true if a joystick is both present and has a gamepad mapping, or false otherwise.
+ ///
+ ///
+ ///
+ /// Call to check if a joystick is present regardless of whether it has a mapping.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract bool JoystickIsGamepad(int jid);
- ///
+ ///
+ ///
+ /// 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 gamecontrollerdb.txt source file
+ /// including empty lines and comments.
+ ///
+ ///
+ /// See Gamepad mappings
+ /// for a description of the format.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// The string containing the gamepad mappings.
+ /// true if successful, or false if an error occurred.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract bool UpdateGamepadMappings(string newMapping);
- ///
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// The joystick to query.
+ ///
+ /// The UTF-8 encoded name of the gamepad, or null if the joystick is not present,
+ /// does not have a mapping or an error occurred.
+ ///
+ ///
+ ///
+ /// Call to check whether it is present regardless of whether it has a mapping.
+ ///
+ ///
+ /// The returned string is allocated and freed by GLFW. You should not free it yourself.
+ /// It is valid until the specified joystick is disconnected,
+ /// the gamepad mappings are updated or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
public abstract string GetGamepadName(int jid);
- ///
+ ///
+ ///
+ /// This function retrieves the state of the specified joystick remapped to an Xbox-like gamepad.
+ ///
+ ///
+ /// If the specified joystick is not present or does not have a gamepad mapping
+ /// this function will return false but will not generate an error.
+ /// Call to check whether it is present regardless of whether it has a mapping.
+ ///
+ ///
+ /// The Guide button may not be available for input as it is often hooked by the system or the Steam client.
+ ///
+ ///
+ /// Not all devices have all the buttons or axes provided by .
+ /// Unavailable buttons and axes will always report and 0.0 respectively.
+ ///
+ ///
+ /// The joystick to query.
+ /// The gamepad input state of the joystick.
+ ///
+ /// true if successful, or false if no joystick is connected,
+ /// it has no gamepad mapping or an error occurred.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract bool GetGamepadState(int jid, out GamepadState state);
- ///
+ ///
+ ///
+ /// This function returns the value of the GLFW timer.
+ ///
+ ///
+ /// Unless the timer has been set using ,
+ /// the timer measures time elapsed since GLFW was initialized.
+ ///
+ ///
+ /// The resolution of the timer is system dependent, but is usually on the order of a few micro- or nanoseconds.
+ /// It uses the highest-resolution monotonic time source on each supported platform.
+ ///
+ ///
+ /// The current value, in seconds, or zero if an error occurred.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ /// Reading and writing of the internal timer offset is not atomic,
+ /// so it needs to be externally synchronized with calls to .
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract double GetTime();
- ///
+ ///
+ ///
+ /// This function sets the value of the GLFW timer. It then continues to count up from that value.
+ /// The value must be a positive finite number less than or equal to 18446744073.0,
+ /// which is approximately 584.5 years.
+ ///
+ ///
+ /// The new value, in seconds.
+ ///
+ ///
+ /// The upper limit of the timer is calculated as floor((2^64 - 1) / 109) and is due to implementations
+ /// storing nanoseconds in 64 bits. The limit may be increased in the future.
+ ///
+ ///
+ /// This function may be called from any thread.
+ /// Reading and writing of the internal timer offset is not atomic,
+ /// so it needs to be externally synchronized with calls to .
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract void SetTime(double time);
- ///
+ ///
+ ///
+ /// This function returns the current value of the raw timer, measured in 1 / frequency seconds.
+ /// To get the frequency, call .
+ ///
+ ///
+ /// The value of the timer, or zero if an error occurred.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract long GetTimerValue();
- ///
+ ///
+ ///
+ /// This function returns the frequency, in Hz, of the raw timer.
+ ///
+ ///
+ /// he frequency of the timer, in Hz, or zero if an error occurred.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract long GetTimerFrequency();
- ///
+ ///
+ ///
+ /// This function returns the window whose OpenGL or OpenGL ES context is current on the calling thread.
+ ///
+ ///
+ /// The window whose context is current, or null if no window's context is current.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract unsafe WindowHandle* GetCurrentContext();
- ///
+ ///
+ ///
+ /// This function swaps the front and back buffers of the specified 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.
+ ///
+ ///
+ /// The specified window must have an OpenGL or OpenGL ES context.
+ /// Specifying a window without a context will generate a error.
+ ///
+ ///
+ /// The window whose buffers to swap.
+ ///
+ ///
+ /// EGL: The context of the specified window must be current on the calling thread.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract unsafe void SwapBuffers(WindowHandle* window);
- ///
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// A context must be current on the calling thread.
+ /// Calling this function without a current context will cause a error.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// The ASCII encoded name of the extension.
+ /// true if the extension is available, or false otherwise.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ /// Possible errors include , ,
+ /// and .
+ ///
+ ///
public abstract bool ExtensionSupported(string extensionName);
- ///
- public abstract unsafe WindowHandle* CreateWindow(int width, int height, string title, Monitor* monitor,
- WindowHandle* share);
+ ///
+ ///
+ /// This function creates a window and its associated OpenGL or OpenGL ES context.
+ /// Most of the options controlling how the window and its context should be created
+ /// are specified with window hints.
+ ///
+ ///
+ /// Successful creation does not change which context is current.
+ /// Before you can use the newly created context, you need to make it current.
+ /// For information about the share parameter, see
+ /// Context object sharing.
+ ///
+ ///
+ /// The created window, framebuffer and context may differ from what you requested,
+ /// as not all parameters and hints are
+ /// hard constraints.
+ /// This includes the size of the window, especially for full screen windows.
+ /// To query the actual attributes of the created window, framebuffer and context,
+ /// see , and .
+ ///
+ ///
+ /// To create a full screen window, you need to specify the monitor the window will cover.
+ /// If no monitor is specified, the window will be windowed mode.
+ /// Unless you have a way for the user to choose a specific monitor,
+ /// it is recommended that you pick the primary monitor.
+ /// For more information on how to query connected monitors, see
+ /// Retrieving monitors.
+ ///
+ ///
+ /// For full screen windows, the specified size becomes the resolution of the window's desired video mode.
+ /// As long as a full screen window is not iconified,
+ /// the supported video mode most closely matching the desired video mode is set for the specified monitor.
+ /// For more information about full screen windows, including the creation of so called windowed full screen
+ /// or borderless full screen windows, see
+ ///
+ /// "Windowed full screen" windows
+ ///
+ /// .
+ ///
+ ///
+ /// Once you have created the window, you can switch it between windowed and full screen mode
+ /// with . If the window has an OpenGL or OpenGL ES context, it will be unaffected.
+ ///
+ ///
+ /// By default, newly created windows use the placement recommended by the window system.
+ /// To create the window at a specific position,
+ /// make it initially invisible using the window hint,
+ /// set its position(see ) and then show it
+ /// (see ).
+ ///
+ ///
+ /// As long as at least one full screen window is not iconified, the screensaver is prohibited from starting.
+ ///
+ ///
+ /// Window systems put limits on window sizes.
+ /// Very large or very small window dimensions may be overridden by the window system on creation.
+ /// Check the actual size after creation(see or .
+ ///
+ ///
+ /// The swap interval
+ /// is not set during window creation and the initial value may vary
+ /// depending on driver settings and defaults.
+ ///
+ ///
+ ///
+ /// The desired width, in screen coordinates, of the window. This must be greater than zero.
+ ///
+ ///
+ /// The desired height, in screen coordinates, of the window. This must be greater than zero.
+ ///
+ /// The initial, UTF-8 encoded window title.
+ /// The monitor to use for full screen mode, or null for windowed mode.
+ ///
+ /// The window whose context to share resources with, or null to not share resources.
+ ///
+ /// The handle of the created window, or null if an error occurred.
+ ///
+ ///
+ /// Windows: Window creation will fail if the Microsoft GDI software OpenGL implementation is the only one available.
+ ///
+ ///
+ /// Windows: If the executable has an icon resource named GLFW_ICON, it will be set as the initial icon for the window.
+ /// If no such icon is present, the IDI_WINLOGO icon will be used instead. To set a different icon, see
+ /// .
+ ///
+ ///
+ /// Windows: The context to share resources with must not be current on any other thread.
+ ///
+ ///
+ /// OS X: The GLFW window has no icon, as it is not a document window, but the dock icon will be the same as the
+ /// application bundle's icon.
+ /// For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.
+ ///
+ ///
+ /// OS X: The first time a window is created the menu bar is populated with common commands like Hide, Quit and About.
+ /// The About entry opens a minimal about dialog with information from the application's bundle.
+ /// The menu bar can be disabled with a compile-time option.
+ ///
+ ///
+ /// OS X: On OS X 10.10 and later the window frame will not be rendered at full resolution on Retina displays
+ /// unless the NSHighResolutionCapable key is enabled in the application bundle's Info.plist.
+ /// For more information, see High Resolution Guidelines for OS X in the Mac Developer Library.
+ /// The GLFW test and example programs use a custom Info.plist template for this, which can be found as
+ /// CMake/MacOSXBundleInfo.plist.in in the source tree.
+ ///
+ ///
+ /// X11: Some window managers will not respect the placement of initially hidden windows.
+ /// X11: Due to the asynchronous nature of X11, it may take a moment for a window to reach its requested state.
+ /// This means you may not be able to query the final size, position or other attributes directly after window
+ /// creation.
+ ///
+ ///
+ /// This function must not be called from a callback.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , ,
+ /// , ,
+ /// , and
+ /// .
+ ///
+ ///
+ public abstract unsafe WindowHandle* CreateWindow
+ (
+ int width,
+ int height,
+ string title,
+ Monitor* monitor,
+ WindowHandle* share
+ );
- ///
+ ///
+ ///
+ /// This function returns the primary monitor.
+ ///
+ ///
+ /// This is usually the monitor where elements like the task bar or global menu bar are located.
+ ///
+ ///
+ /// The primary monitor, or null if no monitors were found or if an error occurred.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// The primary monitor is always first in the array returned by .
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract unsafe Monitor* GetPrimaryMonitor();
- ///
+ ///
+ ///
+ /// This function destroys the specified window and its context. On calling this function,
+ /// no further callbacks will be called for that window.
+ ///
+ ///
+ /// If the context of the specified window is current on the main thread, it is detached before being destroyed.
+ ///
+ ///
+ /// The window to destroy.
+ ///
+ ///
+ /// The context of the specified window must not be current on any other thread when this function is called.
+ ///
+ ///
+ /// This function must not be called from a callback.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe void DestroyWindow(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function brings the specified window to front and sets input focus.
+ /// The window should already be visible and not iconified.
+ ///
+ ///
+ /// By default, both windowed and full screen mode windows are focused when initially created.
+ /// Set the to disable this behavior.
+ ///
+ ///
+ /// Do not use this function to steal focus from other applications unless you are certain
+ /// that is what the user wants.
+ /// Focus stealing can be extremely disruptive.
+ ///
+ ///
+ /// The window to give input focus.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void FocusWindow(WindowHandle* window);
- ///
+ /// ///
+ ///
+ /// This function retrieves the size, in pixels, of the framebuffer of the specified window.
+ /// If you wish to retrieve the size of the window in screen coordinates, see .
+ ///
+ ///
+ /// Any or all of the size arguments may be out _.
+ /// If an error occurs, all non-out _ size arguments will be set to zero.
+ ///
+ ///
+ /// The window whose framebuffer to query.
+ /// Where to store the width, in pixels, of the framebuffer.
+ /// Where to store the height, in pixels, of the framebuffer.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void GetFramebufferSize(WindowHandle* window, out int width, out int height);
- ///
+ ///
+ ///
+ /// This function returns the value of an input option for the specified window.
+ /// The mode must be or .
+ ///
+ ///
+ /// The window to query.
+ ///
+ /// Either or .
+ ///
+ /// TODO: return value is either InputModeValue or bool dependant on .
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe CursorModeValue GetInputMode(WindowHandle* window, CursorStateAttribute mode);
- ///
+ ///
+ ///
+ /// This function returns the value of an input option for the specified window.
+ /// The mode must be .
+ ///
+ ///
+ /// The window to query.
+ ///
+ /// .
+ ///
+ /// TODO: return value is either InputModeValue or bool dependant on .
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe bool GetInputMode(WindowHandle* window, StickyAttributes mode);
- ///
+ ///
+ ///
+ /// This function restores the specified window if it was previously iconified (minimized) or maximized.
+ /// If the window is already restored, this function does nothing.
+ ///
+ ///
+ /// If the specified window is a full screen window, the resolution chosen for the window is restored on the selected
+ /// monitor.
+ ///
+ ///
+ /// The window to restore.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void RestoreWindow(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function returns the current video mode of the specified monitor.
+ ///
+ ///
+ /// If you have created a full screen window for that monitor,
+ /// the return value will depend on whether that window is iconified.
+ ///
+ ///
+ /// The monitor to query.
+ /// The current mode of the monitor, or null if an error occurred.
+ ///
+ ///
+ /// The returned array is allocated and freed by GLFW
+ /// You should not free it yourself.
+ /// It is valid until the specified monitor is disconnected or the library is terminated.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe VideoMode* GetVideoMode(Monitor* monitor);
- ///
+ ///
+ ///
+ /// This function returns the value of an attribute of the specified window or its OpenGL or OpenGL ES context.
+ ///
+ ///
+ /// The window to query.
+ /// The window attribute whose value to return.
+ /// The value of the attribute, or zero if an error occurred.
+ ///
+ ///
+ /// Framebuffer-related hints are not window attributes. See
+ ///
+ /// Framebuffer related attributes
+ ///
+ /// for more information.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract unsafe bool GetWindowAttrib(WindowHandle* window, WindowAttributeGetter attribute);
- ///
+ ///
+ ///
+ /// This function retrieves the size, in screen coordinates, of the client area of the specified window.
+ /// If you wish to retrieve the size of the framebuffer of the window in pixels, see .
+ ///
+ ///
+ /// Any or all of the size arguments may be out _.
+ /// If an error occurs, all non-out _ size arguments will be set to zero.
+ ///
+ ///
+ /// The window whose size to retrieve.
+ /// Where to store the width, in screen coordinates, of the client area.
+ /// Where to store the height, in screen coordinates, of the client area.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe void GetWindowSize(WindowHandle* window, out int width, out int height);
- ///
+ ///
+ ///
+ /// This function retrieves the position, in screen coordinates,
+ /// of the upper-left corner of the client area of the specified window.
+ ///
+ ///
+ /// Any or all of the position arguments may be out _.
+ /// If an error occurs, all non-out _ position arguments will be set to zero.
+ ///
+ ///
+ /// The window to query.
+ /// Where to store the x-coordinate of the upper-left corner of the client area.
+ /// Where to store the y-coordinate of the upper-left corner of the client area.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe void GetWindowPos(WindowHandle* window, out int x, out int y);
- ///
+ ///
+ ///
+ /// This function returns the handle of the monitor that the specified window is in full screen on.
+ ///
+ ///
+ /// The window to query.
+ /// The monitor, or null if the window is in windowed mode or an error occurred.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ ///
public abstract unsafe Monitor* GetWindowMonitor(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function hides the specified window if it was previously visible.
+ /// If the window is already hidden or is in full screen mode, this function does nothing.
+ ///
+ ///
+ /// The window to hide.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void HideWindow(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function iconifies (minimizes) the specified window if it was previously restored.
+ /// If the window is already iconified, this function does nothing.
+ ///
+ ///
+ /// If the specified window is a full screen window,
+ /// the original monitor resolution is restored until the window is restored.
+ ///
+ ///
+ /// The window to iconify.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void IconifyWindow(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function makes the OpenGL or OpenGL ES context of the specified window current on the calling thread.
+ ///
+ ///
+ /// A context can only be made current on a single thread at a time
+ /// and each thread can have only a single current context at a time.
+ ///
+ ///
+ /// By default, making a context non-current implicitly forces a pipeline flush.
+ ///
+ ///
+ /// On machines that support GL_KHR_context_flush_control,
+ /// you can control whether a context performs this flush
+ /// by setting the window hint.
+ ///
+ ///
+ /// The specified window must have an OpenGL or OpenGL ES context.
+ /// Specifying a window without a context will generate a error.
+ ///
+ ///
+ ///
+ /// The window whose context to make current, or null to detach the current context.
+ ///
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
+ ///
public abstract unsafe void MakeContextCurrent(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function maximizes the specified window if it was previously not maximized.
+ /// If the window is already maximized, this function does nothing.
+ ///
+ ///
+ /// If the specified window is a full screen window, this function does nothing.
+ ///
+ ///
+ /// The window to maximize.
+ ///
+ ///
+ /// This function may only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void MaximizeWindow(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function processes only those events that are already in the event queue and then returns immediately.
+ /// Processing events will cause the window and input callbacks associated with those events to be called.
+ ///
+ ///
+ /// 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
+ /// window refresh callback
+ /// to redraw the contents of your window when necessary during such operations.
+ ///
+ ///
+ /// On some platforms, certain events are sent directly to the application without going through the event queue,
+ /// causing callbacks to be called outside of a call to one of the event processing functions.
+ ///
+ ///
+ /// Event processing is not required for joystick input to work.
+ ///
+ ///
+ ///
+ ///
+ /// This function must not be called from a callback.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract void PollEvents();
- ///
+ ///
+ ///
+ /// This function posts an empty event from the current thread to the event queue,
+ /// causing or to return.
+ ///
+ ///
+ /// If no windows exist, this function returns immediately.
+ /// For synchronization of threads in applications that do not create windows, use your threading library of choice.
+ ///
+ ///
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract void PostEmptyEvent();
- ///
+ ///
+ ///
+ /// This function sets hints for the next call to .
+ /// The hints, once set, retain their values
+ /// until changed by a call to
+ /// or , or until the library is terminated.
+ ///
+ ///
+ /// This function does not check whether the specified hint values are valid.
+ /// If you set hints to invalid values this will instead be reported
+ /// by the next call to .
+ ///
+ ///
+ /// The to set.
+ /// The new value of the framebuffer attribute hint.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract void WindowHint(WindowHintInt hint, int value);
- ///
+ ///
+ ///
+ /// This function sets hints for the next call to .
+ /// The hints, once set, retain their values
+ /// until changed by a call to
+ /// or , or until the library is terminated.
+ ///
+ ///
+ /// This function does not check whether the specified hint values are valid.
+ /// If you set hints to invalid values this will instead be reported
+ /// by the next call to .
+ ///
+ ///
+ /// The to set.
+ /// The new value of the framebuffer attribute hint.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract void WindowHint(WindowHintBool hint, bool value);
- ///
+ ///
+ ///
+ /// This function sets hints for the next call to .
+ /// The hints, once set, retain their values
+ /// until changed by a call to
+ /// or , or until the library is terminated.
+ ///
+ ///
+ /// This function does not check whether the specified hint values are valid.
+ /// If you set hints to invalid values this will instead be reported
+ /// by the next call to .
+ ///
+ ///
+ /// .
+ /// The new value of the window hint.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract void WindowHint(WindowHintClientApi hint, ClientApi value);
- ///
+ ///
+ ///
+ /// This function sets hints for the next call to .
+ /// The hints, once set, retain their values
+ /// until changed by a call to
+ /// or , or until the library is terminated.
+ ///
+ ///
+ /// This function does not check whether the specified hint values are valid.
+ /// If you set hints to invalid values this will instead be reported
+ /// by the next call to .
+ ///
+ ///
+ /// .
+ /// The new value of the window hint.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract void WindowHint(WindowHintReleaseBehavior hint, ReleaseBehavior value);
- ///
+ ///
+ ///
+ /// This function sets hints for the next call to .
+ /// The hints, once set, retain their values
+ /// until changed by a call to
+ /// or , or until the library is terminated.
+ ///
+ ///
+ /// This function does not check whether the specified hint values are valid.
+ /// If you set hints to invalid values this will instead be reported
+ /// by the next call to .
+ ///
+ ///
+ /// .
+ /// The new value of the window hint.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract void WindowHint(WindowHintContextApi hint, ContextApi value);
- ///
+ ///
+ ///
+ /// This function sets hints for the next call to .
+ /// The hints, once set, retain their values
+ /// until changed by a call to
+ /// or , or until the library is terminated.
+ ///
+ ///
+ /// This function does not check whether the specified hint values are valid.
+ /// If you set hints to invalid values this will instead be reported
+ /// by the next call to .
+ ///
+ ///
+ /// .
+ /// The new value of the window hint.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract void WindowHint(WindowHintRobustness hint, Robustness value);
- ///
+ ///
+ ///
+ /// This function sets hints for the next call to .
+ /// The hints, once set, retain their values
+ /// until changed by a call to
+ /// or , or until the library is terminated.
+ ///
+ ///
+ /// This function does not check whether the specified hint values are valid.
+ /// If you set hints to invalid values this will instead be reported
+ /// by the next call to .
+ ///
+ ///
+ /// .
+ /// The new value of the window hint.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract void WindowHint(WindowHintOpenGlProfile hint, OpenGlProfile value);
- ///
+ ///
+ ///
+ /// This function returns the value of the close flag of the specified window.
+ ///
+ ///
+ /// The window to query.
+ /// The value of the close flag.
+ ///
+ ///
+ /// This function may be called from any thread. Access is not synchronized.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract unsafe bool WindowShouldClose(WindowHandle* window);
- ///
- public abstract unsafe GlfwCallbacks.CharCallback SetCharCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.CharCallback callback);
+ ///
+ ///
+ /// This function sets the character callback of the specified window, which is called when a Unicode character is input.
+ ///
+ ///
+ /// The character callback is intended for Unicode text input. As it deals with characters,
+ /// it is keyboard layout dependent, whereas the key callback is not. Characters do not map 1:1 to physical keys
+ /// as a key may produce zero, one, or more characters.
+ ///
+ ///
+ /// If you want to know whether a specific physical key was pressed or released, see the key callback instead.
+ ///
+ ///
+ /// The character callback behaves as system text input normally does
+ /// and will not be called if modifier keys are held down that would prevent normal text input on that platform,
+ /// for example a Super (Command) key on OS X or Alt key on Windows.
+ ///
+ ///
+ /// There is a character with modifiers callback() that receives these events.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.CharCallback SetCharCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.CharCallback callback
+ );
- ///
- public abstract unsafe GlfwCallbacks.CharModsCallback SetCharModsCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.CharModsCallback callback);
+ ///
+ ///
+ /// This function sets the character with modifiers callback of the specified window,
+ /// which is called when a Unicode character is input regardless of what modifier keys are used.
+ ///
+ ///
+ /// The character with modifiers callback is intended for implementing custom Unicode character input.
+ /// For regular Unicode text input, see the character callback.
+ ///
+ ///
+ /// Like the character callback(),
+ /// the character with modifiers callback deals with characters and is keyboard layout dependent.
+ /// Characters do not map 1:1 to physical keys, as a key may produce zero, one, or more characters.
+ ///
+ ///
+ /// If you want to know whether a specific physical key was pressed or released,
+ /// see the key callback() instead.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ /// The previously set callback, or null if no callback was set or an error occurred.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.CharModsCallback SetCharModsCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.CharModsCallback callback
+ );
- ///
- public abstract unsafe GlfwCallbacks.CursorEnterCallback SetCursorEnterCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.CursorEnterCallback callback);
+ ///
+ ///
+ /// This function sets the cursor boundary crossing callback of the specified window
+ /// which is called when the cursor enters or leaves the client area of the window.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.CursorEnterCallback SetCursorEnterCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.CursorEnterCallback callback
+ );
- ///
- public abstract unsafe GlfwCallbacks.CursorPosCallback SetCursorPosCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.CursorPosCallback callback);
+ ///
+ ///
+ /// This function sets the cursor position callback of the specified window,
+ /// which is called when the cursor is moved.
+ ///
+ ///
+ /// The callback is provided with the position, in screen coordinates,
+ /// relative to the upper-left corner of the client area of the window.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.CursorPosCallback SetCursorPosCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.CursorPosCallback callback
+ );
- ///
- public abstract unsafe GlfwCallbacks.DropCallback SetDropCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.DropCallback callback);
+ ///
+ ///
+ /// This function sets the file drop callback of the specified window,
+ /// which is called when one or more dragged files are dropped on the window.
+ ///
+ ///
+ /// Because the path array and its strings may have been generated specifically for that event,
+ /// they are not guaranteed to be valid after the callback has returned.
+ /// If you wish to use them after the callback returns, you need to make a deep copy.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new file drop callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.DropCallback SetDropCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.DropCallback callback
+ );
- ///
+ ///
+ ///
+ /// This function sets the error callback, which is called with an error code
+ /// and a human-readable description each time a GLFW error occurs.
+ ///
+ ///
+ /// The error callback is called on the thread where the error occurred.
+ /// If you are using GLFW from multiple threads, your error callback needs to be written accordingly.
+ ///
+ ///
+ /// Because the description string may have been generated specifically for that error,
+ /// it is not guaranteed to be valid after the callback has returned.
+ /// If you wish to use it after the callback returns, you need to make a deep copy.
+ ///
+ ///
+ /// Once set, the error callback remains set even after the library has been terminated.
+ ///
+ ///
+ /// The new callback, or null to remove the currently set callback.
+ /// The previously set callback, or null if no callback was set.
+ ///
+ ///
+ /// This function may be called before .
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
public abstract GlfwCallbacks.ErrorCallback SetErrorCallback
([PinObject(PinMode.UntilNextCall)] GlfwCallbacks.ErrorCallback callback);
- ///
- public abstract unsafe void SetInputMode(WindowHandle* window, CursorStateAttribute mode,
- CursorModeValue value);
+ ///
+ ///
+ /// This function sets an input mode option for the specified window.
+ /// The mode must be .
+ ///
+ ///
+ /// If the mode is , the value must be one of the following cursor modes:
+ /// - makes the cursor visible and behaving normally.
+ /// - makes the cursor invisible when it is over the client area of
+ /// the window but does not restrict the cursor from leaving.
+ /// - hides and grabs the cursor, providing virtual
+ /// and unlimited cursor movement. This is useful for implementing for example 3D camera controls.
+ ///
+ ///
+ /// The window whose input mode to set.
+ /// .
+ /// The new value of the specified input mode.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
+ public abstract unsafe void SetInputMode
+ (
+ WindowHandle* window,
+ CursorStateAttribute mode,
+ CursorModeValue value
+ );
- ///
+ ///
+ ///
+ /// This function sets an input mode option for the specified window.
+ /// The mode must be
+ /// or .
+ ///
+ ///
+ /// If the mode is , the value must be either true
+ /// to enable sticky keys, or false to disable it.
+ ///
+ ///
+ /// If sticky keys are enabled, a key press will ensure that
+ /// returns 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.
+ ///
+ ///
+ /// If the mode is , the value must be either true
+ /// to enable sticky mouse buttons, or false to disable it.
+ /// If sticky mouse buttons are enabled, a mouse button press will ensure that
+ /// returns 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.
+ ///
+ ///
+ /// The window whose input mode to set.
+ ///
+ /// Either or .
+ ///
+ /// The new value of the specified input mode.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
public abstract unsafe void SetInputMode(WindowHandle* window, StickyAttributes mode, bool value);
- ///
+ ///
+ ///
+ /// This function sets the joystick configuration callback, or removes the currently set callback.
+ /// This is called when a joystick is connected to or disconnected from the system.
+ ///
+ ///
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract GlfwCallbacks.JoystickCallback SetJoystickCallback
([PinObject(PinMode.UntilNextCall)] GlfwCallbacks.JoystickCallback callback);
- ///
- public abstract unsafe GlfwCallbacks.KeyCallback SetKeyCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.KeyCallback callback);
+ ///
+ ///
+ /// This function sets the key callback of the specified window, which is called when a key is pressed, repeated or
+ /// released.
+ ///
+ ///
+ /// The key functions deal with physical keys, with layout independent
+ /// key tokens() named after their values in the standard US keyboard layout.
+ /// If you want to input text, use the character callback() instead.
+ ///
+ ///
+ /// When a window loses input focus, it will generate synthetic key release events for all pressed keys.
+ /// You can tell these events from user-generated events by the fact that the synthetic ones are generated
+ /// after the focus loss event has been processed,
+ /// i.e. after the window focus callback() has been called.
+ ///
+ ///
+ /// The scancode of a key is specific to that platform or sometimes even to that machine.
+ /// Scancodes are intended to allow users to bind keys that don't have a GLFW key token.
+ /// Such keys have key set to , their state is not saved
+ /// and so it cannot be queried with .
+ ///
+ ///
+ /// Sometimes GLFW needs to generate synthetic key events, in which case the scancode may be zero.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new key callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.KeyCallback SetKeyCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.KeyCallback callback
+ );
- ///
- public abstract unsafe GlfwCallbacks.ScrollCallback SetScrollCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.ScrollCallback callback);
+ ///
+ ///
+ /// This function sets the scroll callback of the specified window,
+ /// which is called when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.
+ ///
+ ///
+ /// The scroll callback receives all scrolling input, like that from a mouse wheel or a touchpad scrolling area.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new scroll callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.ScrollCallback SetScrollCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.ScrollCallback callback
+ );
- ///
+ ///
+ ///
+ /// This function sets the monitor configuration callback, or removes the currently set callback.
+ /// This is called when a monitor is connected to or disconnected from the system.
+ ///
+ ///
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract GlfwCallbacks.MonitorCallback SetMonitorCallback
([PinObject(PinMode.UntilNextCall)] GlfwCallbacks.MonitorCallback callback);
- ///
- public abstract unsafe GlfwCallbacks.MouseButtonCallback SetMouseButtonCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.MouseButtonCallback callback);
+ ///
+ ///
+ /// This function sets the mouse button callback of the specified window,
+ /// which is called when a mouse button is pressed or released.
+ ///
+ ///
+ /// When a window loses input focus,
+ /// it will generate synthetic mouse button release events for all pressed mouse buttons.
+ /// You can tell these events from user-generated events by the fact that the synthetic ones are generated after
+ /// the focus loss event has been processed,
+ /// i.e. after the window focus callback() has been called.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.MouseButtonCallback SetMouseButtonCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.MouseButtonCallback callback
+ );
- ///
- public abstract unsafe GlfwCallbacks.WindowCloseCallback SetWindowCloseCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowCloseCallback callback);
+ ///
+ ///
+ /// This function sets the close callback of the specified window,
+ /// which is called when the user attempts to close the window,
+ /// for example by clicking the close widget in the title bar.
+ ///
+ ///
+ /// The close flag is set before this callback is called,
+ /// but you can modify it at any time with .
+ ///
+ ///
+ /// The close callback is not triggered by .
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// OS X: Selecting Quit from the application menu will trigger the close callback for all windows.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.WindowCloseCallback SetWindowCloseCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowCloseCallback callback
+ );
- ///
- public abstract unsafe GlfwCallbacks.WindowFocusCallback SetWindowFocusCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowFocusCallback callback);
+ ///
+ ///
+ /// This function sets the focus callback of the specified window,
+ /// which is called when the window gains or loses input focus.
+ ///
+ ///
+ /// After the focus callback is called for a window that lost input focus,
+ /// synthetic key and mouse button release events will be generated for all such that had been pressed.
+ /// For more information, see and .
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.WindowFocusCallback SetWindowFocusCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowFocusCallback callback
+ );
- ///
+ ///
+ ///
+ /// This function sets the icon of the specified window.
+ ///
+ ///
+ /// If passed an array of candidate images, those of or closest to the sizes desired by the system are selected.
+ ///
+ ///
+ /// If no images are specified, the window reverts to its default icon.
+ ///
+ ///
+ /// The desired image sizes varies depending on platform and system settings.
+ /// The selected images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.
+ ///
+ ///
+ /// The window whose icon to set.
+ /// The number of images in the specified array, or zero to revert to the default window icon.
+ /// The images to create the icon from. This is ignored if count is zero.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// The specified image data is copied before this function returns.
+ ///
+ ///
+ /// OS X: The GLFW window has no icon, as it is not a document window, so this function does nothing.
+ /// The dock icon will be the same as the application bundle's icon. For more information on bundles,
+ /// see the Bundle Programming Guide in the Mac Developer Library.
+ ///
+ ///
public abstract unsafe void SetWindowIcon(WindowHandle* window, int count, Image* images);
- ///
- public abstract unsafe GlfwCallbacks.WindowIconifyCallback SetWindowIconifyCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowIconifyCallback callback);
+ ///
+ ///
+ /// This function sets the iconification callback of the specified window,
+ /// which is called when the window is iconified or restored.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.WindowIconifyCallback SetWindowIconifyCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowIconifyCallback callback
+ );
- ///
- public abstract unsafe GlfwCallbacks.WindowMaximizeCallback SetWindowMaximizeCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowMaximizeCallback callback);
+ ///
+ ///
+ /// This function sets the maximizing callback of the specified window,
+ /// which is called when the window is maximized or restored.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.WindowMaximizeCallback SetWindowMaximizeCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowMaximizeCallback callback
+ );
- ///
+ ///
+ ///
+ /// This function sets the window title, encoded as UTF-8, of the specified window.
+ ///
+ ///
+ /// The window whose title to change.
+ /// The UTF-8 encoded window title.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// OS X: The window title will not be updated until the next time you process events.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
public abstract unsafe void SetWindowTitle(WindowHandle* window, string title);
- ///
+ ///
+ ///
+ /// This function makes the specified window visible if it was previously hidden.
+ ///
+ ///
+ /// If the window is already visible or is in full screen mode, this function does nothing.
+ ///
+ ///
+ /// The window to make visible.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe void ShowWindow(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function sets the size, in screen coordinates, of the client area of the specified window.
+ ///
+ ///
+ /// For full screen windows, this function updates the resolution of its desired video mode
+ /// and switches to the video mode closest to it, without affecting the window's context.
+ ///
+ ///
+ /// As the context is unaffected, the bit depths of the framebuffer remain unchanged.
+ ///
+ ///
+ /// If you wish to update the refresh rate of the desired video mode in addition to its resolution,
+ /// see .
+ ///
+ ///
+ /// The window manager may put limits on what sizes are allowed.
+ /// GLFW cannot and should not override these limits.
+ ///
+ ///
+ /// The window to resize.
+ /// The desired width, in screen coordinates, of the window client area.
+ /// The desired height, in screen coordinates, of the window client area.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
+ ///
public abstract unsafe void SetWindowSize(WindowHandle* window, int width, int height);
- ///
- public abstract unsafe GlfwCallbacks.WindowSizeCallback SetWindowSizeCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowSizeCallback callback);
+ ///
+ ///
+ /// This function sets the monitor that the window uses for full screen mode or,
+ /// if the monitor is null, makes it windowed mode.
+ ///
+ ///
+ /// When setting a monitor, this function updates the width, height and refresh rate
+ /// of the desired video mode and switches to the video mode closest to it.
+ ///
+ ///
+ /// The window position is ignored when setting a monitor.
+ ///
+ ///
+ /// When the monitor is null, the position, width and height are used to place the window client area.
+ /// The refresh rate is ignored when no monitor is specified.
+ ///
+ ///
+ /// If you only wish to update the resolution of a full screen window or the size of a windowed mode window,
+ /// see .
+ ///
+ ///
+ /// When a window transitions from full screen to windowed mode,
+ /// this function restores any previous window settings such as whether it is decorated,
+ /// floating, resizable, has size or aspect ratio limits, etc..
+ ///
+ ///
+ /// The window whose monitor, size or video mode to set.
+ /// The desired monitor, or null to set windowed mode.
+ /// The desired x-coordinate of the upper-left corner of the client area.
+ /// The desired y-coordinate of the upper-left corner of the client area.
+ /// The desired with, in screen coordinates, of the client area or video mode.
+ /// The desired height, in screen coordinates, of the client area or video mode.
+ /// The desired refresh rate, in Hz, of the video mode, or .
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.WindowSizeCallback SetWindowSizeCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowSizeCallback callback
+ );
- ///
+ ///
+ ///
+ /// This function sets the value of the close flag of the specified window.
+ ///
+ ///
+ /// This can be used to override the user's attempt to close the window, or to signal that it should be closed.
+ ///
+ ///
+ /// The window whose flag to change.
+ /// The new value.
+ ///
+ ///
+ /// This function may be called from any thread. Access is not synchronized.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
public abstract unsafe void SetWindowShouldClose(WindowHandle* window, bool value);
- ///
- public abstract unsafe void SetWindowMonitor(WindowHandle* window, Monitor* monitor, int x, int y, int width,
- int height, int refreshRate);
+ ///
+ ///
+ /// This function sets the monitor that the window uses for full screen mode or,
+ /// if the monitor is null, makes it windowed mode.
+ ///
+ ///
+ /// When setting a monitor, this function updates the width, height and refresh rate
+ /// of the desired video mode and switches to the video mode closest to it.
+ ///
+ ///
+ /// The window position is ignored when setting a monitor.
+ ///
+ ///
+ /// When the monitor is null, the position, width and height are used to place the window client area.
+ /// The refresh rate is ignored when no monitor is specified.
+ ///
+ ///
+ /// If you only wish to update the resolution of a full screen window or the size of a windowed mode window,
+ /// see .
+ ///
+ ///
+ /// When a window transitions from full screen to windowed mode,
+ /// this function restores any previous window settings such as whether it is decorated,
+ /// floating, resizable, has size or aspect ratio limits, etc..
+ ///
+ ///
+ /// The window whose monitor, size or video mode to set.
+ /// The desired monitor, or null to set windowed mode.
+ /// The desired x-coordinate of the upper-left corner of the client area.
+ /// The desired y-coordinate of the upper-left corner of the client area.
+ /// The desired with, in screen coordinates, of the client area or video mode.
+ /// The desired height, in screen coordinates, of the client area or video mode.
+ /// The desired refresh rate, in Hz, of the video mode, or .
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
+ ///
+ public abstract unsafe void SetWindowMonitor
+ (
+ WindowHandle* window,
+ Monitor* monitor,
+ int x,
+ int y,
+ int width,
+ int height,
+ int refreshRate
+ );
- ///
+ ///
+ ///
+ /// This function sets the position, in screen coordinates,
+ /// of the upper-left corner of the client area of the specified windowed mode window.
+ ///
+ ///
+ /// If the window is a full screen window, this function does nothing.
+ ///
+ ///
+ /// Do not use this function to move an already visible window
+ /// unless you have very good reasons for doing so, as it will confuse and annoy the user.
+ ///
+ ///
+ /// The window manager may put limits on what positions are allowed.
+ /// GLFW cannot and should not override these limits.
+ ///
+ ///
+ /// The window to query.
+ /// The x-coordinate of the upper-left corner of the client area.
+ /// The y-coordinate of the upper-left corner of the client area.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe void SetWindowPos(WindowHandle* window, int x, int y);
- ///
- public abstract unsafe GlfwCallbacks.WindowPosCallback SetWindowPosCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowPosCallback callback);
+ ///
+ ///
+ /// This function sets the position callback of the specified window, which is called when the window is moved.
+ ///
+ ///
+ /// The callback is provided with the screen position of the upper-left corner of the client area of the window.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.WindowPosCallback SetWindowPosCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowPosCallback callback
+ );
- ///
- public abstract unsafe GlfwCallbacks.WindowRefreshCallback SetWindowRefreshCallback(WindowHandle* window,
- [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowRefreshCallback callback);
+ ///
+ ///
+ /// Sets the refresh callback for the specified window.
+ ///
+ ///
+ /// This function sets the refresh callback of the specified window, which is
+ /// called when the content area of the window needs to be redrawn, for example
+ /// if the window has been exposed after having been covered by another window.
+ ///
+ ///
+ /// On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
+ /// the window contents are saved off-screen, this callback may be called only
+ /// very infrequently or never at all.
+ ///
+ ///
+ /// The window whose callback to set.
+ /// The new callback, or null to remove the currently set callback.
+ ///
+ /// The previously set callback, or null if no callback was set or the library had not been initialized.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ public abstract unsafe GlfwCallbacks.WindowRefreshCallback SetWindowRefreshCallback
+ (
+ WindowHandle* window,
+ [PinObject(PinMode.UntilNextCall)] GlfwCallbacks.WindowRefreshCallback callback
+ );
- ///
+ ///
+ ///
+ /// 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 was called
+ /// before swapping the buffers and returning.
+ /// This is sometimes called vertical synchronization, vertical retrace synchronization or just vsync.
+ ///
+ ///
+ /// A context that supports either of the WGL_EXT_swap_control_tear
+ /// and GLX_EXT_swap_control_tear 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 .
+ ///
+ ///
+ /// A context must be current on the calling thread.
+ /// Calling this function without a current context will cause a error.
+ ///
+ ///
+ ///
+ /// The minimum number of screen updates to wait for until the buffers are swapped by .
+ ///
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
+ ///
public abstract void SwapInterval(int interval);
- ///
+ ///
+ ///
+ /// 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 ,
+ /// 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.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// 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 window refresh callback ()
+ /// to redraw the contents of your window when necessary during such operations.
+ ///
+ ///
+ /// On some platforms,
+ /// certain callbacks may be called outside of a call to one of the event processing functions.
+ ///
+ ///
+ /// If no windows exist, this function returns immediately.
+ /// For synchronization of threads in applications that do not create windows,
+ /// use your threading library of choice.
+ ///
+ ///
+ /// Event processing is not required for joystick input to work.
+ ///
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ /// This function must not be called from a callback.
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract void WaitEvents();
- ///
+ ///
+ ///
+ /// 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 are available, it behaves exactly like ,
+ /// 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.
+ ///
+ ///
+ /// The timeout value must be a positive finite number.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// 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 window refresh callback ()
+ /// to redraw the contents of your window when necessary during such operations.
+ ///
+ ///
+ /// On some platforms,
+ /// certain callbacks may be called outside of a call to one of the event processing functions.
+ ///
+ ///
+ /// If no windows exist, this function returns immediately.
+ ///
+ ///
+ /// For synchronization of threads in applications that do not create windows,
+ /// use your threading library of choice.
+ ///
+ ///
+ /// Event processing is not required for joystick input to work.
+ ///
+ ///
+ /// The maximum amount of time, in seconds, to wait.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// This function must not be called from a callback.
+ ///
+ ///
+ ///
+ ///
public abstract void WaitEventsTimeout(double timeout);
- ///
+ ///
+ ///
+ /// This function returns the contents of the system clipboard,
+ /// if it contains or is convertible to a UTF-8 encoded string.
+ ///
+ ///
+ /// The window that will request the clipboard contents.
+ ///
+ /// The contents of the clipboard as a UTF-8 encoded string, or null if an error occurred.
+ ///
+ ///
+ ///
+ /// This function may only be called from the main thread.
+ ///
+ ///
+ /// The returned string is allocated and freed by GLFW. You should not free it yourself.
+ /// The returned string is valid only until the next call to or
+ /// .
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe string GetClipboardString(WindowHandle* window);
- ///
+ ///
+ ///
+ /// This function sets the system clipboard to the specified, UTF-8 encoded string.
+ ///
+ ///
+ /// The window that will own the clipboard contents.
+ /// A UTF-8 encoded string.
+ ///
+ ///
+ /// The specified string is copied before this function returns.
+ ///
+ ///
+ /// This function must only be called from the main thread.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ ///
public abstract unsafe void SetClipboardString(WindowHandle* window, string data);
- ///
+ ///
+ /// Returns whether the Vulkan loader and an ICD have been found.
+ ///
+ ///
+ ///
+ /// This function returns whether the Vulkan loader and any minimally functional ICD have been found.
+ ///
+ ///
+ /// The availability of a Vulkan loader and even an ICD does not by itself
+ /// guarantee that surface creation or even instance creation is possible.
+ /// For example, on Fermi systems Nvidia will install an ICD that provides no actual Vulkan support.
+ /// Call to check whether the extensions necessary
+ /// for Vulkan surface creation are available and
+ /// to check whether a queue family of a physical device supports image presentation.
+ ///
+ ///
+ /// Possible errors include .
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ ///
+ /// true if Vulkan is minimally available, or false otherwise.
+ ///
public abstract bool VulkanSupported();
- ///
+ ///
+ /// Returns the Vulkan instance extensions required by GLFW.
+ ///
+ ///
+ ///
+ /// 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 contains
+ /// VK_KHR_surface, so if you don't require any additional extensions you can
+ /// pass this list directly to the VkInstanceCreateInfo struct.
+ ///
+ ///
+ /// If Vulkan is not available on the machine, this function returns null and generates
+ /// a error. Call to check
+ /// whether Vulkan is at least minimally available.
+ ///
+ ///
+ /// If Vulkan is available but no set of extensions allowing window surface creation was found,
+ /// this function returns null. You may still use Vulkan for off-screen rendering and compute work.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// macOS: This function currently only supports the VK_MVK_macos_surface extension from MoltenVK.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ ///
+ /// Where to store the number of extensions in the returned array.
+ /// This is set to zero if an error occurred.
+ ///
+ ///
+ /// An array of ASCII encoded extension names, or null if an error occurred.
+ ///
public abstract unsafe byte** GetRequiredInstanceExtensions(out uint count);
- ///
+ ///
+ /// Returns the address of the specified Vulkan instance function.
+ ///
+ ///
+ ///
+ /// This function returns the address of the specified Vulkan core or extension function for
+ /// the specified instance. If instance is set to null it can return any function exported
+ /// from the Vulkan loader, including at least the following functions:
+ ///
+ ///
+ /// -
+ ///
+ /// vkEnumerateInstanceExtensionProperties
+ ///
+ ///
+ /// vkEnumerateInstanceLayerProperties
+ ///
+ ///
+ /// vkCreateInstance
+ ///
+ ///
+ /// vkGetInstanceProcAddr
+ ///
+ ///
+ ///
+ ///
+ /// If Vulkan is not available on the machine, this function returns null and generates
+ /// a error. Call to check
+ /// whether Vulkan is at least minimally available.
+ ///
+ ///
+ /// This function is equivalent to calling vkGetInstanceProcAddr with a platform-specific
+ /// query of the Vulkan loader as a fallback.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ /// The returned function pointer is valid until the library is terminated.
+ ///
+ ///
+ ///
+ /// The Vulkan instance to query, or null to retrieve functions related to instance creation.
+ ///
+ /// The ASCII encoded name of the function.
+ /// The address of the function, or null if an error occurred.
public abstract unsafe IntPtr GetInstanceProcAddress(VkHandle instance, byte* procName);
- ///
+ ///
+ /// Returns whether the specified queue family can present images.
+ ///
+ ///
+ ///
+ /// This function returns whether the specified queue family of the specified physical device
+ /// supports presentation to the platform GLFW was built for.
+ ///
+ ///
+ /// 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 false and generates a error.
+ /// Call to check whether Vulkan is at least minimally available and
+ /// to check what instance extensions are required.
+ ///
+ ///
+ /// Possible errors include and .
+ ///
+ ///
+ /// macOS: This function currently always returns true, as the VK_MVK_macos_surface
+ /// extension does not provide a vkGetPhysicalDevice*PresentationSupport type function.
+ ///
+ ///
+ /// This function may be called from any thread.
+ /// For synchronization details of Vulkan objects, see the Vulkan specification.
+ ///
+ ///
+ /// The instance that the physical device belongs to.
+ /// The physical device that the queue family belongs to.
+ /// The index of the queue family to query.
+ /// true if the queue family supports presentation, or false otherwise.
public abstract bool GetPhysicalDevicePresentationSupport(VkHandle instance, VkHandle device, int queueFamily);
- ///
- public abstract unsafe int CreateWindowSurface(VkHandle instance, WindowHandle* window, void* allocator,
- VkHandle* surface);
+ ///
+ /// Creates a Vulkan surface for the specified window.
+ ///
+ ///
+ ///
+ /// This function creates a Vulkan surface for the specified window.
+ ///
+ ///
+ /// If the Vulkan loader or at least one minimally functional ICD were not found,
+ /// this function returns VK_ERROR_INITIALIZATION_FAILED and generates a
+ /// error.
+ /// Call to check whether Vulkan is at least minimally available.
+ ///
+ ///
+ /// If the required window surface creation instance extensions are not available or
+ /// if the specified instance was not created with these extensions enabled,
+ /// this function returns VK_ERROR_EXTENSION_NOT_PRESENT and generates a
+ /// error.
+ /// Call to check what instance extensions are required.
+ ///
+ ///
+ /// The window surface cannot be shared with another API so the window must have been created with
+ /// the client api hint set to otherwise it generates a
+ /// error and returns VK_ERROR_NATIVE_WINDOW_IN_USE_KHR.
+ ///
+ ///
+ /// The window surface must be destroyed before the specified Vulkan instance.
+ /// It is the responsibility of the caller to destroy the window surface.
+ /// GLFW does not destroy it for you. Call vkDestroySurfaceKHR to destroy the surface.
+ ///
+ ///
+ /// Possible errors include , ,
+ /// and .
+ ///
+ ///
+ /// If an error occurs before the creation call is made, GLFW returns the Vulkan error code most
+ /// appropriate for the error. Appropriate use of and
+ /// should eliminate almost all occurrences of these errors.
+ ///
+ ///
+ /// macOS: This function currently only supports the VK_MVK_macos_surface extension from MoltenVK.
+ ///
+ ///
+ /// macOS: This function creates and sets a CAMetalLayer instance for the window content view,
+ /// which is required for MoltenVK to function.
+ ///
+ ///
+ /// This function may be called from any thread.
+ /// For synchronization details of Vulkan objects, see the Vulkan specification.
+ ///
+ ///
+ /// The Vulkan instance to create the surface in.
+ /// The window to create the surface for.
+ /// The allocator to use, or null to use the default allocator.
+ ///
+ /// Where to store the handle of the surface.
+ /// This is set to VK_NULL_HANDLE if an error occurred.
+ ///
+ ///
+ /// VK_SUCCESS if successful, or a Vulkan error code if an error occurred.
+ ///
+ public abstract unsafe int CreateWindowSurface
+ (
+ VkHandle instance,
+ WindowHandle* window,
+ void* allocator,
+ VkHandle* surface
+ );
- ///
+ ///
+ ///
+ /// Returns the address of the specified function for the current context.
+ ///
+ ///
+ /// This function returns the address of the specified OpenGL or OpenGL ES core
+ /// or extension function, if it is supported by the current context.
+ ///
+ ///
+ /// A context must be current on the calling thread. Calling this function without a current context will
+ /// cause a error. This function does not apply to Vulkan. If you are rendering
+ /// with Vulkan, see , and
+ /// instead.
+ ///
+ ///
+ /// Possible errors include , and
+ /// .
+ ///
+ ///
+ ///
+ /// The address of a given function is not guaranteed to be the same between contexts.
+ ///
+ ///
+ /// This function may return a non- address despite the associated version or extension not being
+ /// available. Always check the context version or extension string first.
+ ///
+ ///
+ /// The returned function pointer is valid until the context is destroyed or the library is terminated.
+ ///
+ ///
+ /// This function may be called from any thread.
+ ///
+ ///
+ ///
+ /// The ASCII encoded name of the function.
+ /// The address of the function, or IntPtr.Zero if an error occurred.
public abstract IntPtr GetProcAddress(string name);
- ///
- public abstract unsafe void GetMonitorWorkarea(Monitor* monitor, out int x, out int y, out int width, out int height);
+ /// Retrieves the work area of the monitor.
+ ///
+ ///
+ /// This function returns the position, in screen coordinates, of the upper-left
+ /// corner of the work area of the specified monitor along with the work area
+ /// size in screen coordinates. The work area is defined as the area of the
+ /// monitor not occluded by the operating system task bar where present. If no
+ /// task bar exists then the work area is the monitor resolution in screen
+ /// coordinates.
+ ///
+ ///
+ /// Any or all of the position and size arguments may be null. If an error
+ /// occurs, all non-null position and size arguments will be set to zero.
+ ///
+ ///
+ /// The monitor to query.
+ /// Where to store the monitor x-coordinate, or null.
+ /// Where to store the monitor y-coordinate, or null.
+ /// Where to store the monitor width, or null.
+ /// Where to store the monitor height, or null.
+ public abstract unsafe void GetMonitorWorkarea
+ (Monitor* monitor, out int x, out int y, out int width, out int height);
///
/// Gets an instance of the API.
@@ -442,4 +3853,4 @@ public override bool IsExtensionPresent(string name)
throw new NotSupportedException("Extensions are invalid for GLFW");
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Windowing/Silk.NET.GLFW/Interfaces/IGlfw.cs b/src/Windowing/Silk.NET.GLFW/Interfaces/IGlfw.cs
deleted file mode 100644
index 2eacfe5709..0000000000
--- a/src/Windowing/Silk.NET.GLFW/Interfaces/IGlfw.cs
+++ /dev/null
@@ -1,3711 +0,0 @@
-// File preserved for documentation purposes.
-#if false
-// This file is part of Silk.NET.
-//
-// You may modify and distribute Silk.NET under the terms
-// of the MIT license. See the LICENSE file for details.
-
-using System;
-namespace Silk.NET.GLFW
-{
- // TODO: Enums for GLFW keys/mouse buttons
-
- ///
- /// Defines the public interface of the GLFW library.
- ///
- [NativeSymbols(Prefix = "glfw")]
- public interface IGlfw
- {
- // XML-documentation is from https://www.glfw.org/docs/latest/
- // Still missing in documentation
-
- ///
- ///
- /// This function initializes the GLFW library. Before most GLFW functions can be used,
- /// GLFW must be initialized, and before an application terminates GLFW should be terminated in order to
- /// free any resources allocated during or after initialization.
- ///
- ///
- /// If this function fails, it calls before returning.
- ///
- ///
- /// If it succeeds, you should call before the application exits.
- ///
- ///
- /// Additional calls to this function after successful initialization
- /// but before termination will return true immediately.
- ///
- ///
- /// true if successful, or false if an error occurred.
- ///
- ///
- /// OS X: This function will change the current directory of the application
- /// to the Contents/Resources subdirectory of the application's bundle, if present.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- bool Init();
-
- ///
- ///
- /// This function destroys all remaining windows and cursors, restores any modified gamma ramps
- /// and frees any other allocated resources. Once this function is called,
- /// you must again call successfully before you will be able to use most GLFW functions.
- ///
- ///
- /// If GLFW has been successfully initialized, this function should be called before the application exits.
- ///
- ///
- /// If initialization fails, there is no need to call this function,
- /// as it is called by before it returns failure.
- ///
- ///
- ///
- ///
- /// The contexts of any remaining windows must not be current on any other thread when this function is called.
- ///
- ///
- /// This function may be called before .
- ///
- ///
- /// This function must not be called from a callback.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- void Terminate();
-
- ///
- ///
- /// This function sets hints for the next initialization of GLFW.
- ///
- ///
- /// 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.
- ///
- ///
- /// 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.
- ///
- ///
- /// The to set.
- /// The new value of the .
- ///
- ///
- /// This function may be called before .
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- void InitHint(InitHint hint, bool value);
-
- ///
- ///
- /// This function retrieves the major, minor and revision numbers of the GLFW library.
- /// It is intended for when you are using GLFW
- /// as a shared library and want to ensure that you are using the minimum required version.
- ///
- ///
- /// Any or all of the version arguments may be out _.
- ///
- ///
- /// Where to store the major version number, or out _.
- /// Where to store the minor version number, or out _.
- /// Where to store the revision number, or out _.
- ///
- ///
- /// This function may be called before .
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- void GetVersion(out int major, out int minor, out int revision);
-
- ///
- ///
- /// This function returns the compile-time generated version string of the GLFW library binary.
- /// It describes the version, platform, compiler and any platform-specific compile-time options.
- /// It should not be confused with the OpenGL or OpenGL ES version string, queried with glGetString.
- ///
- ///
- /// Do not use the version string to parse the GLFW library version.
- /// The function provides the version of the running library binary in numerical format.
- ///
- ///
- /// The ASCII-encoded GLFW version string.
- ///
- ///
- /// This function may be called before .
- ///
- ///
- /// The returned string is static and compile-time generated.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- ///
- string GetVersionString();
-
- ///
- ///
- /// This function returns and clears the error code of the last error that occurred on the calling thread,
- /// and optionally a UTF-8 encoded human-readable description of it.
- ///
- ///
- /// If no error has occurred since the last call,
- /// it returns (zero) and the description pointer is set to null.
- ///
- ///
- /// Where to store the error description pointer, or out _"/>.
- /// The last error code for the calling thread, or (zero).
- ///
- ///
- /// The returned string is allocated and freed by GLFW. You should not free it yourself.
- /// It is only guaranteed to be valid until the next error occurs or the library is terminated.
- ///
- ///
- /// This function may be called before .
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- ///
- unsafe ErrorCode GetError(out char* description);
-
- ///
- ///
- /// 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 null.
- ///
- ///
- ///
- /// Where to store the number of monitors in the returned array. This is set to zero if an error occurred.
- ///
- ///
- /// An array of monitor handles, or null if no monitors were found or if an error occurred.
- ///
- ///
- ///
- /// The returned array is allocated and freed by GLFW. You should not free it yourself.
- /// It is only guaranteed to be valid until the monitor configuration changes or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- ///
- unsafe Monitor** GetMonitors(out int count);
-
- ///
- ///
- /// This function returns the position, in screen coordinates, of the upper-left corner of the specified monitor.
- ///
- ///
- /// The monitor to query.
- /// Where to store the monitor x-coordinate, or out _.
- /// Where to store the monitor y-coordinate, or out _.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void GetMonitorPos(Monitor* monitor, out int x, out int y);
-
- ///
- ///
- /// This function returns the size, in millimetres, of the display area of the specified monitor.
- ///
- ///
- /// Some systems do not provide accurate monitor size information,
- /// either because the monitor EDID(Extended Display Identification Data) data is incorrect
- /// or because the driver does not report it accurately.
- ///
- ///
- /// Any or all of the size arguments may be out _.
- /// If an error occurs, all non-out _ size arguments will be set to zero.
- ///
- ///
- /// The monitor to query.
- ///
- /// Where to store the width, in millimetres, of the monitor's display area, or out _.
- ///
- ///
- /// Where to store the height, in millimetres, of the monitor's display area, or out _.
- ///
- ///
- ///
- /// Windows: calculates the returned physical size from the current resolution
- /// and system DPI instead of querying the monitor EDID data.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe void GetMonitorPhysicalSize(Monitor* monitor, out int width, out int height);
-
- ///
- ///
- /// This function retrieves the content scale for the specified monitor.
- ///
- ///
- /// The content scale is the ratio between the current DPI and the platform's default DPI.
- ///
- ///
- /// If you scale all pixel dimensions by this scale then your content should appear at an appropriate size.
- /// This is especially important for text and any UI elements.
- ///
- ///
- /// 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.
- ///
- ///
- /// The monitor to query.
- /// Where to store the x-axis content scale, or out _.
- /// Where to store the y-axis content scale, or out _.
- unsafe void GetMonitorContentScale(Monitor* monitor, out float xscale, out float yscale);
-
- ///
- ///
- /// This function returns a human-readable name, encoded as UTF-8, of the specified monitor.
- /// The name typically reflects the make and model of the monitor
- /// and is not guaranteed to be unique among the connected monitors.
- ///
- ///
- /// The monitor to query.
- /// The UTF-8 encoded name of the monitor, or null if an error occurred.
- ///
- ///
- /// The returned string is allocated and freed by GLFW. You should not free it yourself.
- /// It is valid until the specified monitor is disconnected or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe string GetMonitorName(Monitor* monitor);
-
- ///
- ///
- /// This function sets the user-defined pointer of the specified monitor.
- /// The current value is retained until the monitor is disconnected.
- /// The initial value is .
- ///
- ///
- /// This function may be called from the monitor callback, even for a monitor that is being disconnected.
- ///
- ///
- /// The monitor whose pointer to set.
- /// The new value.
- ///
- ///
- /// This function may be called from any thread. Access is not synchronized.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe void SetMonitorUserPointer(Monitor* monitor, IntPtr pointer);
-
- ///
- ///
- /// This function returns the current value of the user-defined pointer of the specified monitor.
- /// The initial value is .
- ///
- ///
- /// This function may be called from the monitor callback, even for a monitor that is being disconnected.
- ///
- ///
- /// The monitor whose pointer to return.
- /// The user-defined pointer of the given .
- ///
- ///
- /// This function may be called from any thread. Access is not synchronized.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe IntPtr GetMonitorUserPointer(Monitor* monitor);
-
- ///
- ///
- /// This function returns an array of all video modes supported by the specified monitor.
- /// The returned array is sorted in ascending order, first by color bit depth (the sum of all channel depths)
- /// and then by resolution area (the product of width and height).
- ///
- ///
- /// The monitor to query.
- ///
- /// Where to store the number of video modes in the returned array.
- /// This is set to zero if an error occurred.
- ///
- /// An array of video modes, or null if an error occurred.
- ///
- ///
- /// The returned array is allocated and freed by GLFW. You should not free it yourself.
- /// It is valid until the specified monitor is disconnected,
- /// this function is called again for that monitor, or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe VideoMode* GetVideoModes(Monitor* monitor, out int count);
-
- ///
- ///
- /// This function generates a 256-element gamma ramp from the specified exponent and then calls
- /// with it. The value must be a finite number greater than zero.
- ///
- ///
- /// The monitor whose gamma ramp to set.
- /// The desired exponent.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe void SetGamma(Monitor* monitor, float gamma);
-
- ///
- ///
- /// This function returns the current gamma ramp of the specified monitor.
- ///
- ///
- /// The monitor to query.
- /// The current gamma ramp, or null if an error occurred.
- ///
- ///
- /// The returned structure and its arrays are allocated and freed by GLFW.
- /// You should not free them yourself. They are valid until the specified monitor is disconnected,
- /// this function is called again for that monitor or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe GammaRamp* GetGammaRamp(Monitor* monitor);
-
- ///
- ///
- /// This function sets the current gamma ramp for the specified monitor.
- ///
- ///
- /// The original gamma ramp for that monitor
- /// is saved by GLFW the first time this function is called and is restored by .
- ///
- ///
- /// The monitor whose gamma ramp to set.
- /// The gamma ramp to use.
- ///
- ///
- /// Gamma ramp sizes other than 256 are not supported by all platforms or graphics hardware.
- ///
- ///
- /// Windows: The gamma ramp size must be 256.
- ///
- ///
- /// The specified gamma ramp is copied before this function returns.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void SetGammaRamp(Monitor* monitor, ref GammaRamp ramp);
-
- ///
- ///
- /// This function resets all window hints to their default values.
- ///
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- void DefaultWindowHints();
-
- ///
- ///
- /// Sets the specified window hint to the desired value.
- ///
- ///
- /// This function sets hints for the next call to @ref glfwCreateWindow. The
- /// hints, once set, retain their values until changed by a call to this
- /// function or , or until the library is terminated.
- ///
- ///
- /// This function does not check whether the specified hint values are valid.
- /// If you set hints to invalid values this will instead be reported by the next
- /// call to .
- ///
- ///
- /// 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.
- ///
- ///
- /// The window hint to set.
- /// The new value of the set hint.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- /// The string is copied before this function returns.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- void WindowHintString(int hint, string value);
-
- ///
- ///
- /// This function sets the size limits of the client area of the specified window.
- ///
- ///
- /// If the window is full screen, the size limits only take effect once it is made windowed.
- ///
- ///
- /// If the window is not resizable, this function does nothing.
- ///
- ///
- /// The size limits are applied immediately to a windowed mode window and may cause it to be resized.
- ///
- ///
- /// The maximum dimensions must be greater than or equal to the minimum dimensions
- /// and all must be greater than or equal to zero.
- ///
- ///
- /// The window to set limits for.
- ///
- /// The minimum width, in screen coordinates, of the client area, or .
- ///
- ///
- /// The minimum height, in screen coordinates, of the client area, or .
- ///
- ///
- /// The maximum width, in screen coordinates, of the client area, or .
- ///
- ///
- /// The maximum height, in screen coordinates, of the client area, or .
- ///
- ///
- ///
- /// If you set size limits and an aspect ratio that conflict, the results are undefined.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe void SetWindowSizeLimits(WindowHandle* window, int minwidth, int minheight, int maxwidth, int maxheight);
-
- ///
- ///
- /// This function sets the required aspect ratio of the client area of the specified window.
- ///
- ///
- /// If the window is full screen, the aspect ratio only takes effect once it is made windowed.
- ///
- ///
- /// If the window is not resizable, this function does nothing.
- ///
- ///
- /// The aspect ratio is specified as a numerator and a denominator and both values must be greater than zero.
- /// For example, the common 16:9 aspect ratio is specified as 16 and 9, respectively.
- ///
- ///
- /// If the numerator and denominator is set to then the aspect ratio limit is disabled.
- ///
- ///
- /// The aspect ratio is applied immediately to a windowed mode window and may cause it to be resized.
- ///
- ///
- /// The window to set limits for.
- /// The numerator of the desired aspect ratio, or .
- /// The denominator of the desired aspect ratio, or .
- ///
- ///
- /// If you set size limits and an aspect ratio that conflict, the results are undefined.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe void SetWindowAspectRatio(WindowHandle* window, int numer, int denom);
-
- ///
- ///
- /// This function retrieves the size, in screen coordinates, of each edge of the frame of the specified window.
- ///
- ///
- /// This size includes the title bar, if the window has one.
- /// The size of the frame may vary depending on the window-related hints used to create it.
- ///
- ///
- /// 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.
- ///
- ///
- /// Any or all of the size arguments may be out _.
- /// If an error occurs, all non-out _ size arguments will be set to zero.
- ///
- ///
- /// The window whose frame size to query.
- ///
- /// Where to store the size, in screen coordinates, of the left edge of the window frame, or out _.
- ///
- ///
- /// Where to store the size, in screen coordinates, of the top edge of the window frame, or out _.
- ///
- ///
- /// Where to store the size, in screen coordinates, of the right edge of the window frame, or out _.
- ///
- ///
- /// Where to store the size, in screen coordinates, of the bottom edge of the window frame, or out _.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void GetWindowFrameSize(WindowHandle* window, out int left, out int top, out int right, out int bottom);
-
- ///
- ///
- /// This function returns the opacity of the window, including any decorations.
- ///
- ///
- /// The opacity (or alpha) value is a positive finite number between zero and one,
- /// where zero is fully transparent and one is fully opaque.
- ///
- ///
- /// If the system does not support whole window transparency, this function always returns one.
- ///
- ///
- /// The initial opacity value for newly created windows is one.
- ///
- ///
- /// The window to query.
- /// The opacity value of the specified window.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe float GetWindowOpacity(WindowHandle* window);
-
- ///
- ///
- /// This function sets the opacity of the window, including any decorations.
- ///
- ///
- /// The opacity (or alpha) value is a positive finite number between zero and one,
- /// where zero is fully transparent and one is fully opaque.
- ///
- ///
- /// The initial opacity value for newly created windows is one.
- ///
- ///
- /// A window created with framebuffer transparency may not use whole window transparency.
- /// The results of doing this are undefined.
- ///
- ///
- /// The window to set the opacity for.
- /// The desired opacity of the specified window.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe void SetWindowOpacity(WindowHandle* window, float opacity);
-
- ///
- ///
- /// This function requests user attention to the specified window.
- /// On platforms where this is not supported, attention is requested to the application as a whole.
- ///
- ///
- /// Once the user has given attention, usually by focusing the window or application,
- /// the system will end the request automatically.
- ///
- ///
- /// The window to request attention to.
- ///
- ///
- /// macOS: Attention is requested to the application as a whole, not the specific window.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void RequestWindowAttention(WindowHandle* window);
-
- ///
- ///
- /// This function sets the value of an attribute of the specified window.
- ///
- ///
- /// The supported attributes are ,
- /// , ,
- /// and .
- ///
- ///
- /// Some of these attributes are ignored for full screen windows.
- /// The new value will take effect if the window is later made windowed.
- ///
- ///
- /// Some of these attributes are ignored for windowed mode windows.
- /// The new value will take effect if the window is later made full screen.
- ///
- ///
- /// The window to set the attribute for.
- /// A supported window attribute.
- /// true or false.
- ///
- ///
- /// Calling will always return the latest value,
- /// even if that value is ignored by the current mode of the window.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , ,
- /// and .
- ///
- ///
- unsafe void SetWindowAttrib(WindowHandle* window, WindowAttributeSetter attribute, bool value);
-
- ///
- ///
- /// 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,
- /// will be emitted.
- ///
- ///
- /// 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.
- ///
- ///
- ///
- /// true if raw mouse motion is supported on the current machine, or false otherwise.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- bool RawMouseMotionSupported();
-
- ///
- ///
- /// 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.
- ///
- ///
- /// Do not use this function for text input.
- /// You will break text input for many languages even if it happens to work for yours.
- ///
- ///
- /// If the key is , the scancode is used to identify the key, otherwise the scancode is ignored.
- /// If you specify a non-printable key, or and a scancode that maps to a non-printable key,
- /// this function returns null but does not emit an error.
- ///
- ///
- /// This behavior allows you to always pass in the arguments in the key callback without modification.
- ///
- ///
- /// The printable keys are:
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- /// to
- ///
- /// -
- /// to
- ///
- /// -
- /// to
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- /// -
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- /// Names for printable keys depend on 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.
- ///
- ///
- /// The key to query, or .
- /// The scancode of the key to query.
- /// The UTF-8 encoded, layout-specific name of the key, or null.
- ///
- ///
- /// The returned string is allocated and freed by GLFW. You should not free it yourself.
- /// It is valid until the next call to , or until the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- string GetKeyName(int key, int scancode);
-
- ///
- ///
- /// This function returns the platform-specific scancode of the specified key.
- ///
- ///
- /// If the key is or does not exist on the keyboard this method will return -1.
- ///
- ///
- /// Any named key.
- /// The platform-specific scancode for the key, or -1 if an error occurred.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- int GetKeyScancode(int key);
-
- ///
- ///
- /// This function returns the last state reported for the specified key to the specified window.
- /// The returned state is one of or .
- /// The higher-level action is only reported to the key callback.
- ///
- ///
- /// If the input mode is enabled, this function returns
- /// the first time you call it for a key that was pressed,
- /// even if that key has already been released.
- ///
- ///
- /// The key functions deal with physical keys,
- /// with key tokens named after their use on the standard US keyboard layout.
- /// If you want to input text, use the Unicode character callback instead.
- ///
- ///
- /// The modifier key bit masks are not key tokens and cannot be used with this function.
- ///
- ///
- /// Do not use this function to implement text input.
- ///
- ///
- /// The desired window.
- ///
- /// The desired keyboard key. is not a valid key for this function.
- ///
- /// One of or .
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe int GetKey(WindowHandle* window, Keys key);
-
- ///
- ///
- /// This function returns the last state reported for the specified mouse button to the specified window.
- /// The returned state is one of or .
- ///
- ///
- /// If the input mode is enabled, this function returns
- /// the first time you call it for a mouse button that was pressed,
- /// even if that mouse button has already been released.
- ///
- ///
- /// The desired window.
- /// The desired mouse button.
- /// One of or .
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe int GetMouseButton(WindowHandle* window, int button);
-
- ///
- ///
- /// This function returns the position of the cursor,
- /// in screen coordinates, relative to the upper-left corner of the client area of the specified window.
- ///
- ///
- /// If the cursor is disabled (with ) then the cursor position
- /// is unbounded and limited only by the minimum and maximum values of a double.
- ///
- ///
- /// The coordinate can be converted to their integer equivalents with the floor function.
- /// Casting directly to an integer type works for positive coordinates, but fails for negative ones.
- ///
- ///
- /// Any or all of the position arguments may be out _.
- /// If an error occurs, all non-out _ position arguments will be set to zero.
- ///
- ///
- /// The desired window.
- ///
- /// Where to store the cursor x-coordinate, relative to the left edge of the client area, or out _.
- ///
- ///
- /// Where to store the cursor y-coordinate, relative to the to top edge of the client area, or out _.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void GetCursorPos(WindowHandle* window, out double xpos, out double ypos);
-
- ///
- ///
- /// This function sets the position, in screen coordinates,
- /// of the cursor relative to the upper-left corner of the client area of the specified window.
- ///
- ///
- /// The window must have input focus.
- /// If the window does not have input focus when this function is called, it fails silently.
- ///
- ///
- /// Do not use this function to implement things like camera controls.
- /// GLFW already provides the cursor mode that hides the cursor,
- /// transparently re-centers it and provides unconstrained cursor motion.
- /// See for more information.
- ///
- ///
- /// If the cursor mode is then the cursor position is unconstrained
- /// and limited only by the minimum and maximum values of a double.
- ///
- ///
- /// The desired window.
- /// The desired x-coordinate, relative to the left edge of the client area.
- /// The desired y-coordinate, relative to the top edge of the client area.
- ///
- ///
- /// Wayland: This function will only work when the cursor mode is ,
- /// otherwise it will do nothing.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void SetCursorPos(WindowHandle* window, double xpos, double ypos);
-
- ///
- ///
- /// Creates a new custom cursor image that can be set for a window with .
- ///
- ///
- /// The cursor can be destroyed with .
- /// Any remaining cursors are destroyed by .
- ///
- ///
- /// The pixels are 32-bit, little-endian, non-premultiplied RGBA,
- /// i.e. eight bits per channel with the red channel first.
- /// They are arranged canonically as packed sequential rows, starting from the top-left corner.
- ///
- ///
- /// The cursor hotspot is specified in pixels, relative to the upper-left corner of the cursor image.
- /// Like all other coordinate systems in GLFW, the X-axis points to the right and the Y-axis points down.
- ///
- ///
- /// The desired cursor image.
- /// The desired x-coordinate, in pixels, of the cursor hotspot.
- /// The desired y-coordinate, in pixels, of the cursor hotspot.
- /// The handle of the created cursor, or null if an error occurred.
- ///
- ///
- /// The specified image data is copied before this function returns.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe Cursor* CreateCursor(Image* image, int xhot, int yhot);
-
- ///
- ///
- /// Returns a cursor with a standard shape, that can be set for a window with .
- ///
- ///
- /// One of the standard shapes.
- /// A new cursor ready to use or null if an error occurred.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe Cursor* CreateStandardCursor(CursorShape shape);
-
- ///
- ///
- /// This function destroys a cursor previously created with .
- /// Any remaining cursors will be destroyed by .
- ///
- ///
- /// If the specified cursor is current for any window, that window will be reverted to the default cursor.
- /// This does not affect the cursor mode.
- ///
- ///
- /// The cursor object to destroy.
- ///
- ///
- /// This function must not be called from a callback.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void DestroyCursor(Cursor* cursor);
-
- ///
- ///
- /// This function sets the cursor image to be used when the cursor is over the client area
- /// of the specified window.
- ///
- ///
- /// The set cursor will only be visible
- /// when the cursor mode of the window is .
- ///
- ///
- /// On some platforms, the set cursor may not be visible unless the window also has input focus.
- ///
- ///
- /// The window to set the cursor for.
- /// The cursor to set, or null to switch back to the default arrow cursor.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void SetCursor(WindowHandle* window, Cursor* cursor);
-
- ///
- ///
- /// This function returns whether the specified joystick is present.
- ///
- ///
- /// 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.
- ///
- ///
- /// The joystick to query.
- /// true if the joystick is present, or false otherwise.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- bool JoystickPresent(int jid);
-
- ///
- ///
- /// 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.
- ///
- ///
- /// 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 .
- ///
- ///
- /// The joystick to query.
- ///
- /// Where to store the number of axis values in the returned array.
- /// This is set to zero if the joystick is not present or an error occurred.
- ///
- ///
- /// An array of axis values, or null if the joystick is not present or an error occurred.
- ///
- ///
- ///
- /// The returned array is allocated and freed by GLFW.
- /// You should not free it yourself.
- /// It is valid until the specified joystick is disconnected or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe float* GetJoystickAxes(int jid, out int count);
-
- ///
- ///
- /// This function returns the state of all buttons of the specified joystick.
- /// Each element in the array is either or .
- ///
- ///
- /// For backward compatibility with earlier versions that did not have ,
- /// the button array also includes all hats, each represented as four buttons.
- ///
- ///
- /// The hats are in the same order as returned by and are in the order
- /// up, right, down and left.
- ///
- ///
- /// To disable these extra buttons, set the
- /// init hint before initialization.
- ///
- ///
- /// 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 .
- ///
- ///
- /// The joystick to query.
- ///
- /// Where to store the number of button states in the returned array.
- /// This is set to zero if the joystick is not present or an error occurred.
- ///
- ///
- /// An array of button states, or null if the joystick is not present or an error occurred.
- ///
- ///
- ///
- /// The returned array is allocated and freed by GLFW. You should not free it yourself.
- /// It is valid until the specified joystick is disconnected or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe byte* GetJoystickButtons(int jid, out int count);
-
- ///
- ///
- /// This function returns the state of all hats of the specified joystick.
- /// Each element in the array is one of the .
- ///
- ///
- /// The diagonal directions are bitwise combinations of the primary (up, right, down and left) directions
- /// and you can test for these individually by ANDing it with the corresponding direction.
- ///
- /// if (hats[2].HasFlag(JoystickHats.Right))
- /// {
- /// // State of hat 2 could be right-up, right or right-down
- /// }
- ///
- ///
- ///
- /// 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 .
- ///
- ///
- /// The joystick to query.
- ///
- /// Where to store the number of hat states in the returned array.
- /// This is set to zero if the joystick is not present or an error occurred.
- ///
- ///
- /// An array of hat states, or null if the joystick is not present or an error occurred.
- ///
- ///
- ///
- /// The returned array is allocated and freed by GLFW. You should not free it yourself
- /// It is valid until the specified joystick is disconnected,
- /// this function is called again for that joystick or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe JoystickHats* GetJoystickHats(int jid, out int count);
-
- ///
- ///
- /// This function returns the name, encoded as UTF-8, of the specified joystick.
- ///
- ///
- /// 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 .
- ///
- ///
- /// The joystick to query.
- ///
- /// The UTF-8 encoded name of the joystick, or null if the joystick is not present or an error occurred.
- ///
- ///
- ///
- /// The returned string is allocated and freed by GLFW. You should not free it yourself.
- /// It is valid until the specified joystick is disconnected or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- string GetJoystickName(int jid);
-
- ///
- ///
- /// 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.
- ///
- ///
- /// 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.
- ///
- ///
- /// 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 .
- ///
- ///
- /// 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.
- ///
- ///
- /// The joystick to query.
- ///
- /// The UTF-8 encoded GUID of the joystick, or null if the joystick is not present or an error occurred.
- ///
- ///
- ///
- /// The returned string is allocated and freed by GLFW. You should not free it yourself.
- /// It is valid until the specified joystick is disconnected or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- string GetJoystickGUID(int jid);
-
- ///
- ///
- /// 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 .
- ///
- ///
- /// This function may be called from the joystick callback, even for a joystick that is being disconnected.
- ///
- ///
- /// The joystick whose pointer to set.
- /// The new value.
- ///
- ///
- /// This function may be called from any thread. Access is not synchronized.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- void SetJoystickUserPointer(int jid, IntPtr ptr);
-
- ///
- ///
- /// This function returns the current value of the user-defined pointer of the specified joystick.
- /// The initial value is .
- ///
- ///
- /// This function may be called from the joystick callback, even for a joystick that is being disconnected.
- ///
- ///
- /// The joystick whose pointer to return.
- /// The user-defined pointer of the given .
- ///
- ///
- /// This function may be called from any thread. Access is not synchronized.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- IntPtr GetJoystickUserPointer(int jid);
-
- ///
- ///
- /// This function returns whether the specified joystick is both present and has a gamepad mapping.
- ///
- ///
- /// If the specified joystick is present but does not have a gamepad mapping
- /// this function will return false but will not generate an error.
- ///
- ///
- /// The joystick to query.
- ///
- /// true if a joystick is both present and has a gamepad mapping, or false otherwise.
- ///
- ///
- ///
- /// Call to check if a joystick is present regardless of whether it has a mapping.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- bool JoystickIsGamepad(int jid);
-
- ///
- ///
- /// 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 gamecontrollerdb.txt source file
- /// including empty lines and comments.
- ///
- ///
- /// See Gamepad mappings
- /// for a description of the format.
- ///
- ///
- /// 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.
- ///
- ///
- /// The string containing the gamepad mappings.
- /// true if successful, or false if an error occurred.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- bool UpdateGamepadMappings(string newMapping);
-
- ///
- ///
- /// 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.
- ///
- ///
- /// The joystick to query.
- ///
- /// The UTF-8 encoded name of the gamepad, or null if the joystick is not present,
- /// does not have a mapping or an error occurred.
- ///
- ///
- ///
- /// Call to check whether it is present regardless of whether it has a mapping.
- ///
- ///
- /// The returned string is allocated and freed by GLFW. You should not free it yourself.
- /// It is valid until the specified joystick is disconnected,
- /// the gamepad mappings are updated or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- string GetGamepadName(int jid);
-
- ///
- ///
- /// This function retrieves the state of the specified joystick remapped to an Xbox-like gamepad.
- ///
- ///
- /// If the specified joystick is not present or does not have a gamepad mapping
- /// this function will return false but will not generate an error.
- /// Call to check whether it is present regardless of whether it has a mapping.
- ///
- ///
- /// The Guide button may not be available for input as it is often hooked by the system or the Steam client.
- ///
- ///
- /// Not all devices have all the buttons or axes provided by .
- /// Unavailable buttons and axes will always report and 0.0 respectively.
- ///
- ///
- /// The joystick to query.
- /// The gamepad input state of the joystick.
- ///
- /// true if successful, or false if no joystick is connected,
- /// it has no gamepad mapping or an error occurred.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- bool GetGamepadState(int jid, out GamepadState state);
-
- ///
- ///
- /// This function returns the value of the GLFW timer.
- ///
- ///
- /// Unless the timer has been set using ,
- /// the timer measures time elapsed since GLFW was initialized.
- ///
- ///
- /// The resolution of the timer is system dependent, but is usually on the order of a few micro- or nanoseconds.
- /// It uses the highest-resolution monotonic time source on each supported platform.
- ///
- ///
- /// The current value, in seconds, or zero if an error occurred.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- /// Reading and writing of the internal timer offset is not atomic,
- /// so it needs to be externally synchronized with calls to .
- ///
- ///
- /// Possible errors include .
- ///
- ///
- double GetTime();
-
- ///
- ///
- /// This function sets the value of the GLFW timer. It then continues to count up from that value.
- /// The value must be a positive finite number less than or equal to 18446744073.0,
- /// which is approximately 584.5 years.
- ///
- ///
- /// The new value, in seconds.
- ///
- ///
- /// The upper limit of the timer is calculated as floor((2^64 - 1) / 109) and is due to implementations
- /// storing nanoseconds in 64 bits. The limit may be increased in the future.
- ///
- ///
- /// This function may be called from any thread.
- /// Reading and writing of the internal timer offset is not atomic,
- /// so it needs to be externally synchronized with calls to .
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- void SetTime(double time);
-
- ///
- ///
- /// This function returns the current value of the raw timer, measured in 1 / frequency seconds.
- /// To get the frequency, call .
- ///
- ///
- /// The value of the timer, or zero if an error occurred.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- long GetTimerValue();
-
- ///
- ///
- /// This function returns the frequency, in Hz, of the raw timer.
- ///
- ///
- /// he frequency of the timer, in Hz, or zero if an error occurred.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- long GetTimerFrequency();
-
- ///
- ///
- /// This function returns the window whose OpenGL or OpenGL ES context is current on the calling thread.
- ///
- ///
- /// The window whose context is current, or null if no window's context is current.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe WindowHandle* GetCurrentContext();
-
- ///
- ///
- /// This function swaps the front and back buffers of the specified 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.
- ///
- ///
- /// The specified window must have an OpenGL or OpenGL ES context.
- /// Specifying a window without a context will generate a error.
- ///
- ///
- /// The window whose buffers to swap.
- ///
- ///
- /// EGL: The context of the specified window must be current on the calling thread.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe void SwapBuffers(WindowHandle* window);
-
- ///
- ///
- /// 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.
- ///
- ///
- /// A context must be current on the calling thread.
- /// Calling this function without a current context will cause a error.
- ///
- ///
- /// 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.
- ///
- ///
- /// The ASCII encoded name of the extension.
- /// true if the extension is available, or false otherwise.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- /// Possible errors include , ,
- /// and .
- ///
- ///
- bool ExtensionSupported(string extensionName);
-
- ///
- ///
- /// This function creates a window and its associated OpenGL or OpenGL ES context.
- /// Most of the options controlling how the window and its context should be created
- /// are specified with window hints.
- ///
- ///
- /// Successful creation does not change which context is current.
- /// Before you can use the newly created context, you need to make it current.
- /// For information about the share parameter, see
- /// Context object sharing.
- ///
- ///
- /// The created window, framebuffer and context may differ from what you requested,
- /// as not all parameters and hints are
- /// hard constraints.
- /// This includes the size of the window, especially for full screen windows.
- /// To query the actual attributes of the created window, framebuffer and context,
- /// see , and .
- ///
- ///
- /// To create a full screen window, you need to specify the monitor the window will cover.
- /// If no monitor is specified, the window will be windowed mode.
- /// Unless you have a way for the user to choose a specific monitor,
- /// it is recommended that you pick the primary monitor.
- /// For more information on how to query connected monitors, see
- /// Retrieving monitors.
- ///
- ///
- /// For full screen windows, the specified size becomes the resolution of the window's desired video mode.
- /// As long as a full screen window is not iconified,
- /// the supported video mode most closely matching the desired video mode is set for the specified monitor.
- /// For more information about full screen windows, including the creation of so called windowed full screen
- /// or borderless full screen windows, see
- ///
- /// "Windowed full screen" windows
- ///
- /// .
- ///
- ///
- /// Once you have created the window, you can switch it between windowed and full screen mode
- /// with . If the window has an OpenGL or OpenGL ES context, it will be unaffected.
- ///
- ///
- /// By default, newly created windows use the placement recommended by the window system.
- /// To create the window at a specific position,
- /// make it initially invisible using the window hint,
- /// set its position(see ) and then show it
- /// (see ).
- ///
- ///
- /// As long as at least one full screen window is not iconified, the screensaver is prohibited from starting.
- ///
- ///
- /// Window systems put limits on window sizes.
- /// Very large or very small window dimensions may be overridden by the window system on creation.
- /// Check the actual size after creation(see or .
- ///
- ///
- /// The swap interval
- /// is not set during window creation and the initial value may vary
- /// depending on driver settings and defaults.
- ///
- ///
- ///
- /// The desired width, in screen coordinates, of the window. This must be greater than zero.
- ///
- ///
- /// The desired height, in screen coordinates, of the window. This must be greater than zero.
- ///
- /// The initial, UTF-8 encoded window title.
- /// The monitor to use for full screen mode, or null for windowed mode.
- ///
- /// The window whose context to share resources with, or null to not share resources.
- ///
- /// The handle of the created window, or null if an error occurred.
- ///
- ///
- /// Windows: Window creation will fail if the Microsoft GDI software OpenGL implementation is the only one available.
- ///
- ///
- /// Windows: If the executable has an icon resource named GLFW_ICON, it will be set as the initial icon for the window.
- /// If no such icon is present, the IDI_WINLOGO icon will be used instead. To set a different icon, see
- /// .
- ///
- ///
- /// Windows: The context to share resources with must not be current on any other thread.
- ///
- ///
- /// OS X: The GLFW window has no icon, as it is not a document window, but the dock icon will be the same as the
- /// application bundle's icon.
- /// For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.
- ///
- ///
- /// OS X: The first time a window is created the menu bar is populated with common commands like Hide, Quit and About.
- /// The About entry opens a minimal about dialog with information from the application's bundle.
- /// The menu bar can be disabled with a compile-time option.
- ///
- ///
- /// OS X: On OS X 10.10 and later the window frame will not be rendered at full resolution on Retina displays
- /// unless the NSHighResolutionCapable key is enabled in the application bundle's Info.plist.
- /// For more information, see High Resolution Guidelines for OS X in the Mac Developer Library.
- /// The GLFW test and example programs use a custom Info.plist template for this, which can be found as
- /// CMake/MacOSXBundleInfo.plist.in in the source tree.
- ///
- ///
- /// X11: Some window managers will not respect the placement of initially hidden windows.
- /// X11: Due to the asynchronous nature of X11, it may take a moment for a window to reach its requested state.
- /// This means you may not be able to query the final size, position or other attributes directly after window
- /// creation.
- ///
- ///
- /// This function must not be called from a callback.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , ,
- /// , ,
- /// , and
- /// .
- ///
- ///
- unsafe WindowHandle* CreateWindow(int width, int height, string title, Monitor* monitor, WindowHandle* share);
-
- ///
- ///
- /// This function destroys the specified window and its context. On calling this function,
- /// no further callbacks will be called for that window.
- ///
- ///
- /// If the context of the specified window is current on the main thread, it is detached before being destroyed.
- ///
- ///
- /// The window to destroy.
- ///
- ///
- /// The context of the specified window must not be current on any other thread when this function is called.
- ///
- ///
- /// This function must not be called from a callback.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe void DestroyWindow(WindowHandle* window);
-
- ///
- ///
- /// This function brings the specified window to front and sets input focus.
- /// The window should already be visible and not iconified.
- ///
- ///
- /// By default, both windowed and full screen mode windows are focused when initially created.
- /// Set the to disable this behavior.
- ///
- ///
- /// Do not use this function to steal focus from other applications unless you are certain
- /// that is what the user wants.
- /// Focus stealing can be extremely disruptive.
- ///
- ///
- /// The window to give input focus.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void FocusWindow(WindowHandle* window);
-
- ///
- ///
- /// This function returns the contents of the system clipboard,
- /// if it contains or is convertible to a UTF-8 encoded string.
- ///
- ///
- /// The window that will request the clipboard contents.
- ///
- /// The contents of the clipboard as a UTF-8 encoded string, or null if an error occurred.
- ///
- ///
- ///
- /// This function may only be called from the main thread.
- ///
- ///
- /// The returned string is allocated and freed by GLFW. You should not free it yourself.
- /// The returned string is valid only until the next call to or
- /// .
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe string GetClipboardString(WindowHandle* window);
-
- ///
- ///
- /// This function retrieves the size, in pixels, of the framebuffer of the specified window.
- /// If you wish to retrieve the size of the window in screen coordinates, see .
- ///
- ///
- /// Any or all of the size arguments may be out _.
- /// If an error occurs, all non-out _ size arguments will be set to zero.
- ///
- ///
- /// The window whose framebuffer to query.
- /// Where to store the width, in pixels, of the framebuffer.
- /// Where to store the height, in pixels, of the framebuffer.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void GetFramebufferSize(WindowHandle* window, out int width, out int height);
-
- ///
- ///
- /// This function returns the value of an input option for the specified window.
- /// The mode must be or .
- ///
- ///
- /// The window to query.
- ///
- /// Either or .
- ///
- /// TODO: return value is either InputModeValue or bool dependant on .
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe bool GetInputMode(WindowHandle* window, StickyAttributes mode);
-
- ///
- ///
- /// This function returns the value of an input option for the specified window.
- /// The mode must be .
- ///
- ///
- /// The window to query.
- ///
- /// .
- ///
- /// TODO: return value is either InputModeValue or bool dependant on .
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe CursorModeValue GetInputMode(WindowHandle* window, CursorStateAttribute mode);
-
- ///
- ///
- /// This function returns the primary monitor.
- ///
- ///
- /// This is usually the monitor where elements like the task bar or global menu bar are located.
- ///
- ///
- /// The primary monitor, or null if no monitors were found or if an error occurred.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// The primary monitor is always first in the array returned by .
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe Monitor* GetPrimaryMonitor();
-
- ///
- ///
- /// This function returns the current video mode of the specified monitor.
- ///
- ///
- /// If you have created a full screen window for that monitor,
- /// the return value will depend on whether that window is iconified.
- ///
- ///
- /// The monitor to query.
- /// The current mode of the monitor, or null if an error occurred.
- ///
- ///
- /// The returned array is allocated and freed by GLFW
- /// You should not free it yourself.
- /// It is valid until the specified monitor is disconnected or the library is terminated.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe VideoMode* GetVideoMode(Monitor* monitor);
-
- ///
- ///
- /// This function returns the value of an attribute of the specified window or its OpenGL or OpenGL ES context.
- ///
- ///
- /// The window to query.
- /// The window attribute whose value to return.
- /// The value of the attribute, or zero if an error occurred.
- ///
- ///
- /// Framebuffer-related hints are not window attributes. See
- ///
- /// Framebuffer related attributes
- ///
- /// for more information.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe bool GetWindowAttrib(WindowHandle* window, WindowAttributeGetter attribute);
-
- ///
- ///
- /// This function retrieves the size, in screen coordinates, of the client area of the specified window.
- /// If you wish to retrieve the size of the framebuffer of the window in pixels, see .
- ///
- ///
- /// Any or all of the size arguments may be out _.
- /// If an error occurs, all non-out _ size arguments will be set to zero.
- ///
- ///
- /// The window whose size to retrieve.
- /// Where to store the width, in screen coordinates, of the client area.
- /// Where to store the height, in screen coordinates, of the client area.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe void GetWindowSize(WindowHandle* window, out int width, out int height);
-
- ///
- ///
- /// This function retrieves the position, in screen coordinates,
- /// of the upper-left corner of the client area of the specified window.
- ///
- ///
- /// Any or all of the position arguments may be out _.
- /// If an error occurs, all non-out _ position arguments will be set to zero.
- ///
- ///
- /// The window to query.
- /// Where to store the x-coordinate of the upper-left corner of the client area.
- /// Where to store the y-coordinate of the upper-left corner of the client area.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe void GetWindowPos(WindowHandle* window, out int x, out int y);
-
- ///
- ///
- /// This function returns the handle of the monitor that the specified window is in full screen on.
- ///
- ///
- /// The window to query.
- /// The monitor, or null if the window is in windowed mode or an error occurred.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- ///
- unsafe Monitor* GetWindowMonitor(WindowHandle* window);
-
- ///
- ///
- /// This function hides the specified window if it was previously visible.
- /// If the window is already hidden or is in full screen mode, this function does nothing.
- ///
- ///
- /// The window to hide.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void HideWindow(WindowHandle* window);
-
- ///
- ///
- /// This function iconifies (minimizes) the specified window if it was previously restored.
- /// If the window is already iconified, this function does nothing.
- ///
- ///
- /// If the specified window is a full screen window,
- /// the original monitor resolution is restored until the window is restored.
- ///
- ///
- /// The window to iconify.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void IconifyWindow(WindowHandle* window);
-
- ///
- ///
- /// This function makes the OpenGL or OpenGL ES context of the specified window current on the calling thread.
- ///
- ///
- /// A context can only be made current on a single thread at a time
- /// and each thread can have only a single current context at a time.
- ///
- ///
- /// By default, making a context non-current implicitly forces a pipeline flush.
- ///
- ///
- /// On machines that support GL_KHR_context_flush_control,
- /// you can control whether a context performs this flush
- /// by setting the window hint.
- ///
- ///
- /// The specified window must have an OpenGL or OpenGL ES context.
- /// Specifying a window without a context will generate a error.
- ///
- ///
- ///
- /// The window whose context to make current, or null to detach the current context.
- ///
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- ///
- unsafe void MakeContextCurrent(WindowHandle* window);
-
- ///
- ///
- /// This function maximizes the specified window if it was previously not maximized.
- /// If the window is already maximized, this function does nothing.
- ///
- ///
- /// If the specified window is a full screen window, this function does nothing.
- ///
- ///
- /// The window to maximize.
- ///
- ///
- /// This function may only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void MaximizeWindow(WindowHandle* window);
-
- ///
- ///
- /// This function processes only those events that are already in the event queue and then returns immediately.
- /// Processing events will cause the window and input callbacks associated with those events to be called.
- ///
- ///
- /// 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
- /// window refresh callback
- /// to redraw the contents of your window when necessary during such operations.
- ///
- ///
- /// On some platforms, certain events are sent directly to the application without going through the event queue,
- /// causing callbacks to be called outside of a call to one of the event processing functions.
- ///
- ///
- /// Event processing is not required for joystick input to work.
- ///
- ///
- ///
- ///
- /// This function must not be called from a callback.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- void PollEvents();
-
- ///
- ///
- /// This function posts an empty event from the current thread to the event queue,
- /// causing or to return.
- ///
- ///
- /// If no windows exist, this function returns immediately.
- /// For synchronization of threads in applications that do not create windows, use your threading library of choice.
- ///
- ///
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- void PostEmptyEvent();
-
- ///
- ///
- /// This function restores the specified window if it was previously iconified (minimized) or maximized.
- /// If the window is already restored, this function does nothing.
- ///
- ///
- /// If the specified window is a full screen window, the resolution chosen for the window is restored on the selected
- /// monitor.
- ///
- ///
- /// The window to restore.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void RestoreWindow(WindowHandle* window);
-
- ///
- ///
- /// This function sets the character callback of the specified window, which is called when a Unicode character is input.
- ///
- ///
- /// The character callback is intended for Unicode text input. As it deals with characters,
- /// it is keyboard layout dependent, whereas the key callback is not. Characters do not map 1:1 to physical keys
- /// as a key may produce zero, one, or more characters.
- ///
- ///
- /// If you want to know whether a specific physical key was pressed or released, see the key callback instead.
- ///
- ///
- /// The character callback behaves as system text input normally does
- /// and will not be called if modifier keys are held down that would prevent normal text input on that platform,
- /// for example a Super (Command) key on OS X or Alt key on Windows.
- ///
- ///
- /// There is a character with modifiers callback() that receives these events.
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.CharCallback SetCharCallback(WindowHandle* window, [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.CharCallback callback);
-
- ///
- ///
- /// This function sets the character with modifiers callback of the specified window,
- /// which is called when a Unicode character is input regardless of what modifier keys are used.
- ///
- ///
- /// The character with modifiers callback is intended for implementing custom Unicode character input.
- /// For regular Unicode text input, see the character callback.
- ///
- ///
- /// Like the character callback(),
- /// the character with modifiers callback deals with characters and is keyboard layout dependent.
- /// Characters do not map 1:1 to physical keys, as a key may produce zero, one, or more characters.
- ///
- ///
- /// If you want to know whether a specific physical key was pressed or released,
- /// see the key callback() instead.
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- /// The previously set callback, or null if no callback was set or an error occurred.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.CharModsCallback SetCharModsCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.CharModsCallback callback);
-
- ///
- ///
- /// This function sets the system clipboard to the specified, UTF-8 encoded string.
- ///
- ///
- /// The window that will own the clipboard contents.
- /// A UTF-8 encoded string.
- ///
- ///
- /// The specified string is copied before this function returns.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe void SetClipboardString(WindowHandle* window, string data);
-
- ///
- ///
- /// This function sets the cursor boundary crossing callback of the specified window
- /// which is called when the cursor enters or leaves the client area of the window.
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.CursorEnterCallback SetCursorEnterCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.CursorEnterCallback callback);
-
- ///
- ///
- /// This function sets the cursor position callback of the specified window,
- /// which is called when the cursor is moved.
- ///
- ///
- /// The callback is provided with the position, in screen coordinates,
- /// relative to the upper-left corner of the client area of the window.
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.CursorPosCallback SetCursorPosCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.CursorPosCallback callback);
-
- ///
- ///
- /// This function sets the file drop callback of the specified window,
- /// which is called when one or more dragged files are dropped on the window.
- ///
- ///
- /// Because the path array and its strings may have been generated specifically for that event,
- /// they are not guaranteed to be valid after the callback has returned.
- /// If you wish to use them after the callback returns, you need to make a deep copy.
- ///
- ///
- /// The window whose callback to set.
- /// The new file drop callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.DropCallback SetDropCallback(WindowHandle* window, [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.DropCallback callback);
-
- ///
- ///
- /// This function sets the error callback, which is called with an error code
- /// and a human-readable description each time a GLFW error occurs.
- ///
- ///
- /// The error callback is called on the thread where the error occurred.
- /// If you are using GLFW from multiple threads, your error callback needs to be written accordingly.
- ///
- ///
- /// Because the description string may have been generated specifically for that error,
- /// it is not guaranteed to be valid after the callback has returned.
- /// If you wish to use it after the callback returns, you need to make a deep copy.
- ///
- ///
- /// Once set, the error callback remains set even after the library has been terminated.
- ///
- ///
- /// The new callback, or null to remove the currently set callback.
- /// The previously set callback, or null if no callback was set.
- ///
- ///
- /// This function may be called before .
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- GlfwCallbacks.ErrorCallback SetErrorCallback([DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.ErrorCallback callback);
-
- ///
- ///
- /// This function sets an input mode option for the specified window.
- /// The mode must be .
- ///
- ///
- /// If the mode is , the value must be one of the following cursor modes:
- /// - makes the cursor visible and behaving normally.
- /// - makes the cursor invisible when it is over the client area of
- /// the window but does not restrict the cursor from leaving.
- /// - hides and grabs the cursor, providing virtual
- /// and unlimited cursor movement. This is useful for implementing for example 3D camera controls.
- ///
- ///
- /// The window whose input mode to set.
- /// .
- /// The new value of the specified input mode.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe void SetInputMode(WindowHandle* window, CursorStateAttribute mode, CursorModeValue value);
-
- ///
- ///
- /// This function sets an input mode option for the specified window.
- /// The mode must be
- /// or .
- ///
- ///
- /// If the mode is , the value must be either true
- /// to enable sticky keys, or false to disable it.
- ///
- ///
- /// If sticky keys are enabled, a key press will ensure that
- /// returns 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.
- ///
- ///
- /// If the mode is , the value must be either true
- /// to enable sticky mouse buttons, or false to disable it.
- /// If sticky mouse buttons are enabled, a mouse button press will ensure that
- /// returns 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.
- ///
- ///
- /// The window whose input mode to set.
- ///
- /// Either or .
- ///
- /// The new value of the specified input mode.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- unsafe void SetInputMode(WindowHandle* window, StickyAttributes mode, bool value);
-
- ///
- ///
- /// This function sets the joystick configuration callback, or removes the currently set callback.
- /// This is called when a joystick is connected to or disconnected from the system.
- ///
- ///
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- GlfwCallbacks.JoystickCallback SetJoystickCallback([DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.JoystickCallback callback);
-
- ///
- ///
- /// This function sets the key callback of the specified window, which is called when a key is pressed, repeated or
- /// released.
- ///
- ///
- /// The key functions deal with physical keys, with layout independent
- /// key tokens() named after their values in the standard US keyboard layout.
- /// If you want to input text, use the character callback() instead.
- ///
- ///
- /// When a window loses input focus, it will generate synthetic key release events for all pressed keys.
- /// You can tell these events from user-generated events by the fact that the synthetic ones are generated
- /// after the focus loss event has been processed,
- /// i.e. after the window focus callback() has been called.
- ///
- ///
- /// The scancode of a key is specific to that platform or sometimes even to that machine.
- /// Scancodes are intended to allow users to bind keys that don't have a GLFW key token.
- /// Such keys have key set to , their state is not saved
- /// and so it cannot be queried with .
- ///
- ///
- /// Sometimes GLFW needs to generate synthetic key events, in which case the scancode may be zero.
- ///
- ///
- /// The window whose callback to set.
- /// The new key callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.KeyCallback SetKeyCallback(WindowHandle* window, [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.KeyCallback callback);
-
- ///
- ///
- /// This function sets the scroll callback of the specified window,
- /// which is called when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.
- ///
- ///
- /// The scroll callback receives all scrolling input, like that from a mouse wheel or a touchpad scrolling area.
- ///
- ///
- /// The window whose callback to set.
- /// The new scroll callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.ScrollCallback SetScrollCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.ScrollCallback callback);
-
- ///
- ///
- /// This function sets the monitor configuration callback, or removes the currently set callback.
- /// This is called when a monitor is connected to or disconnected from the system.
- ///
- ///
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- GlfwCallbacks.MonitorCallback SetMonitorCallback([DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.MonitorCallback callback);
-
- ///
- ///
- /// This function sets the mouse button callback of the specified window,
- /// which is called when a mouse button is pressed or released.
- ///
- ///
- /// When a window loses input focus,
- /// it will generate synthetic mouse button release events for all pressed mouse buttons.
- /// You can tell these events from user-generated events by the fact that the synthetic ones are generated after
- /// the focus loss event has been processed,
- /// i.e. after the window focus callback() has been called.
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.MouseButtonCallback SetMouseButtonCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.MouseButtonCallback callback);
-
- ///
- ///
- /// This function sets the close callback of the specified window,
- /// which is called when the user attempts to close the window,
- /// for example by clicking the close widget in the title bar.
- ///
- ///
- /// The close flag is set before this callback is called,
- /// but you can modify it at any time with .
- ///
- ///
- /// The close callback is not triggered by .
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// OS X: Selecting Quit from the application menu will trigger the close callback for all windows.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.WindowCloseCallback SetWindowCloseCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.WindowCloseCallback callback);
-
- ///
- ///
- /// This function sets the focus callback of the specified window,
- /// which is called when the window gains or loses input focus.
- ///
- ///
- /// After the focus callback is called for a window that lost input focus,
- /// synthetic key and mouse button release events will be generated for all such that had been pressed.
- /// For more information, see and .
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.WindowFocusCallback SetWindowFocusCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.WindowFocusCallback callback);
-
- ///
- ///
- /// This function sets the icon of the specified window.
- ///
- ///
- /// If passed an array of candidate images, those of or closest to the sizes desired by the system are selected.
- ///
- ///
- /// If no images are specified, the window reverts to its default icon.
- ///
- ///
- /// The desired image sizes varies depending on platform and system settings.
- /// The selected images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.
- ///
- ///
- /// The window whose icon to set.
- /// The number of images in the specified array, or zero to revert to the default window icon.
- /// The images to create the icon from. This is ignored if count is zero.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// The specified image data is copied before this function returns.
- ///
- ///
- /// OS X: The GLFW window has no icon, as it is not a document window, so this function does nothing.
- /// The dock icon will be the same as the application bundle's icon. For more information on bundles,
- /// see the Bundle Programming Guide in the Mac Developer Library.
- ///
- ///
- unsafe void SetWindowIcon(WindowHandle* window, int count, Image* images);
-
- ///
- ///
- /// This function sets the iconification callback of the specified window,
- /// which is called when the window is iconified or restored.
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.WindowIconifyCallback SetWindowIconifyCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.WindowIconifyCallback callback);
-
- ///
- ///
- /// This function sets the maximizing callback of the specified window,
- /// which is called when the window is maximized or restored.
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.WindowMaximizeCallback SetWindowMaximizeCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.WindowMaximizeCallback callback);
-
- ///
- ///
- /// This function sets the monitor that the window uses for full screen mode or,
- /// if the monitor is null, makes it windowed mode.
- ///
- ///
- /// When setting a monitor, this function updates the width, height and refresh rate
- /// of the desired video mode and switches to the video mode closest to it.
- ///
- ///
- /// The window position is ignored when setting a monitor.
- ///
- ///
- /// When the monitor is null, the position, width and height are used to place the window client area.
- /// The refresh rate is ignored when no monitor is specified.
- ///
- ///
- /// If you only wish to update the resolution of a full screen window or the size of a windowed mode window,
- /// see .
- ///
- ///
- /// When a window transitions from full screen to windowed mode,
- /// this function restores any previous window settings such as whether it is decorated,
- /// floating, resizable, has size or aspect ratio limits, etc..
- ///
- ///
- /// The window whose monitor, size or video mode to set.
- /// The desired monitor, or null to set windowed mode.
- /// The desired x-coordinate of the upper-left corner of the client area.
- /// The desired y-coordinate of the upper-left corner of the client area.
- /// The desired with, in screen coordinates, of the client area or video mode.
- /// The desired height, in screen coordinates, of the client area or video mode.
- /// The desired refresh rate, in Hz, of the video mode, or .
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- ///
- unsafe void SetWindowMonitor(WindowHandle* window, Monitor* monitor, int x, int y, int width, int height,
- int refreshRate);
-
- ///
- ///
- /// This function sets the position, in screen coordinates,
- /// of the upper-left corner of the client area of the specified windowed mode window.
- ///
- ///
- /// If the window is a full screen window, this function does nothing.
- ///
- ///
- /// Do not use this function to move an already visible window
- /// unless you have very good reasons for doing so, as it will confuse and annoy the user.
- ///
- ///
- /// The window manager may put limits on what positions are allowed.
- /// GLFW cannot and should not override these limits.
- ///
- ///
- /// The window to query.
- /// The x-coordinate of the upper-left corner of the client area.
- /// The y-coordinate of the upper-left corner of the client area.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe void SetWindowPos(WindowHandle* window, int x, int y);
-
- ///
- ///
- /// This function sets the position callback of the specified window, which is called when the window is moved.
- ///
- ///
- /// The callback is provided with the screen position of the upper-left corner of the client area of the window.
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.WindowPosCallback SetWindowPosCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.WindowPosCallback callback);
-
- ///
- ///
- /// Sets the refresh callback for the specified window.
- ///
- ///
- /// This function sets the refresh callback of the specified window, which is
- /// called when the content area of the window needs to be redrawn, for example
- /// if the window has been exposed after having been covered by another window.
- ///
- ///
- /// On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
- /// the window contents are saved off-screen, this callback may be called only
- /// very infrequently or never at all.
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.WindowRefreshCallback SetWindowRefreshCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.WindowRefreshCallback callback);
-
- ///
- ///
- /// This function sets the size, in screen coordinates, of the client area of the specified window.
- ///
- ///
- /// For full screen windows, this function updates the resolution of its desired video mode
- /// and switches to the video mode closest to it, without affecting the window's context.
- ///
- ///
- /// As the context is unaffected, the bit depths of the framebuffer remain unchanged.
- ///
- ///
- /// If you wish to update the refresh rate of the desired video mode in addition to its resolution,
- /// see .
- ///
- ///
- /// The window manager may put limits on what sizes are allowed.
- /// GLFW cannot and should not override these limits.
- ///
- ///
- /// The window to resize.
- /// The desired width, in screen coordinates, of the window client area.
- /// The desired height, in screen coordinates, of the window client area.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- ///
- unsafe void SetWindowSize(WindowHandle* window, int width, int height);
-
- ///
- ///
- /// This function sets the size callback of the specified window, which is called when the window is resized.
- ///
- ///
- /// The callback is provided with the size, in screen coordinates, of the client area of the window.
- ///
- ///
- /// The window whose callback to set.
- /// The new callback, or null to remove the currently set callback.
- ///
- /// The previously set callback, or null if no callback was set or the library had not been initialized.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe GlfwCallbacks.WindowSizeCallback SetWindowSizeCallback(WindowHandle* window,
- [DelegateLifetime(DelegateLifetime.Persistent)]GlfwCallbacks.WindowSizeCallback callback);
-
- ///
- ///
- /// This function sets the value of the close flag of the specified window.
- ///
- ///
- /// This can be used to override the user's attempt to close the window, or to signal that it should be closed.
- ///
- ///
- /// The window whose flag to change.
- /// The new value.
- ///
- ///
- /// This function may be called from any thread. Access is not synchronized.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe void SetWindowShouldClose(WindowHandle* window, bool value);
-
- ///
- ///
- /// This function sets the window title, encoded as UTF-8, of the specified window.
- ///
- ///
- /// The window whose title to change.
- /// The UTF-8 encoded window title.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// OS X: The window title will not be updated until the next time you process events.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- unsafe void SetWindowTitle(WindowHandle* window, string title);
-
- ///
- ///
- /// This function makes the specified window visible if it was previously hidden.
- ///
- ///
- /// If the window is already visible or is in full screen mode, this function does nothing.
- ///
- ///
- /// The window to make visible.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- unsafe void ShowWindow(WindowHandle* window);
-
- ///
- ///
- /// 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 was called
- /// before swapping the buffers and returning.
- /// This is sometimes called vertical synchronization, vertical retrace synchronization or just vsync.
- ///
- ///
- /// A context that supports either of the WGL_EXT_swap_control_tear
- /// and GLX_EXT_swap_control_tear 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 .
- ///
- ///
- /// A context must be current on the calling thread.
- /// Calling this function without a current context will cause a error.
- ///
- ///
- ///
- /// The minimum number of screen updates to wait for until the buffers are swapped by .
- ///
- ///
- ///
- /// 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.
- ///
- ///
- /// 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.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- ///
- void SwapInterval(int interval);
-
- ///
- ///
- /// 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 ,
- /// 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.
- ///
- ///
- /// 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.
- ///
- ///
- /// 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 window refresh callback ()
- /// to redraw the contents of your window when necessary during such operations.
- ///
- ///
- /// On some platforms,
- /// certain callbacks may be called outside of a call to one of the event processing functions.
- ///
- ///
- /// If no windows exist, this function returns immediately.
- /// For synchronization of threads in applications that do not create windows,
- /// use your threading library of choice.
- ///
- ///
- /// Event processing is not required for joystick input to work.
- ///
- ///
- ///
- /// This function must only be called from the main thread.
- /// This function must not be called from a callback.
- /// Possible errors include and .
- ///
- ///
- ///
- void WaitEvents();
-
- ///
- ///
- /// 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 are available, it behaves exactly like ,
- /// 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.
- ///
- ///
- /// The timeout value must be a positive finite number.
- ///
- ///
- /// 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.
- ///
- ///
- /// 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 window refresh callback ()
- /// to redraw the contents of your window when necessary during such operations.
- ///
- ///
- /// On some platforms,
- /// certain callbacks may be called outside of a call to one of the event processing functions.
- ///
- ///
- /// If no windows exist, this function returns immediately.
- ///
- ///
- /// For synchronization of threads in applications that do not create windows,
- /// use your threading library of choice.
- ///
- ///
- /// Event processing is not required for joystick input to work.
- ///
- ///
- /// The maximum amount of time, in seconds, to wait.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// This function must not be called from a callback.
- ///
- ///
- ///
- ///
- void WaitEventsTimeout(double timeout);
-
- ///
- ///
- /// This function sets hints for the next call to .
- /// The hints, once set, retain their values
- /// until changed by a call to
- /// or , or until the library is terminated.
- ///
- ///
- /// This function does not check whether the specified hint values are valid.
- /// If you set hints to invalid values this will instead be reported
- /// by the next call to .
- ///
- ///
- /// The to set.
- /// The new value of the framebuffer attribute hint.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- void WindowHint(WindowHintInt hint, int value);
-
- ///
- ///
- /// This function sets hints for the next call to .
- /// The hints, once set, retain their values
- /// until changed by a call to
- /// or , or until the library is terminated.
- ///
- ///
- /// This function does not check whether the specified hint values are valid.
- /// If you set hints to invalid values this will instead be reported
- /// by the next call to .
- ///
- ///
- /// The to set.
- /// The new value of the framebuffer attribute hint.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- void WindowHint(WindowHintBool hint, bool value);
-
- ///
- ///
- /// This function sets hints for the next call to .
- /// The hints, once set, retain their values
- /// until changed by a call to
- /// or , or until the library is terminated.
- ///
- ///
- /// This function does not check whether the specified hint values are valid.
- /// If you set hints to invalid values this will instead be reported
- /// by the next call to .
- ///
- ///
- /// .
- /// The new value of the window hint.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- void WindowHint(WindowHintClientApi hint, ClientApi value);
-
- ///
- ///
- /// This function sets hints for the next call to .
- /// The hints, once set, retain their values
- /// until changed by a call to
- /// or , or until the library is terminated.
- ///
- ///
- /// This function does not check whether the specified hint values are valid.
- /// If you set hints to invalid values this will instead be reported
- /// by the next call to .
- ///
- ///
- /// .
- /// The new value of the window hint.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- void WindowHint(WindowHintReleaseBehavior hint, ReleaseBehavior value);
-
- ///
- ///
- /// This function sets hints for the next call to .
- /// The hints, once set, retain their values
- /// until changed by a call to
- /// or , or until the library is terminated.
- ///
- ///
- /// This function does not check whether the specified hint values are valid.
- /// If you set hints to invalid values this will instead be reported
- /// by the next call to .
- ///
- ///
- /// .
- /// The new value of the window hint.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- void WindowHint(WindowHintContextApi hint, ContextApi value);
-
- ///
- ///
- /// This function sets hints for the next call to .
- /// The hints, once set, retain their values
- /// until changed by a call to
- /// or , or until the library is terminated.
- ///
- ///
- /// This function does not check whether the specified hint values are valid.
- /// If you set hints to invalid values this will instead be reported
- /// by the next call to .
- ///
- ///
- /// .
- /// The new value of the window hint.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- void WindowHint(WindowHintRobustness hint, Robustness value);
-
- ///
- ///
- /// This function sets hints for the next call to .
- /// The hints, once set, retain their values
- /// until changed by a call to
- /// or , or until the library is terminated.
- ///
- ///
- /// This function does not check whether the specified hint values are valid.
- /// If you set hints to invalid values this will instead be reported
- /// by the next call to .
- ///
- ///
- /// .
- /// The new value of the window hint.
- ///
- ///
- /// This function must only be called from the main thread.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- ///
- void WindowHint(WindowHintOpenGlProfile hint, OpenGlProfile value);
-
- ///
- ///
- /// This function returns the value of the close flag of the specified window.
- ///
- ///
- /// The window to query.
- /// The value of the close flag.
- ///
- ///
- /// This function may be called from any thread. Access is not synchronized.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- unsafe bool WindowShouldClose(WindowHandle* window);
-
- ///
- /// Returns whether the Vulkan loader and an ICD have been found.
- ///
- ///
- ///
- /// This function returns whether the Vulkan loader and any minimally functional ICD have been found.
- ///
- ///
- /// The availability of a Vulkan loader and even an ICD does not by itself
- /// guarantee that surface creation or even instance creation is possible.
- /// For example, on Fermi systems Nvidia will install an ICD that provides no actual Vulkan support.
- /// Call to check whether the extensions necessary
- /// for Vulkan surface creation are available and
- /// to check whether a queue family of a physical device supports image presentation.
- ///
- ///
- /// Possible errors include .
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- ///
- /// true if Vulkan is minimally available, or false otherwise.
- ///
- bool VulkanSupported();
-
- ///
- /// Returns the Vulkan instance extensions required by GLFW.
- ///
- ///
- ///
- /// 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 contains
- /// VK_KHR_surface, so if you don't require any additional extensions you can
- /// pass this list directly to the VkInstanceCreateInfo struct.
- ///
- ///
- /// If Vulkan is not available on the machine, this function returns null and generates
- /// a error. Call to check
- /// whether Vulkan is at least minimally available.
- ///
- ///
- /// If Vulkan is available but no set of extensions allowing window surface creation was found,
- /// this function returns null. You may still use Vulkan for off-screen rendering and compute work.
- ///
- ///
- /// 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.
- ///
- ///
- /// macOS: This function currently only supports the VK_MVK_macos_surface extension from MoltenVK.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- /// 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.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- ///
- /// Where to store the number of extensions in the returned array.
- /// This is set to zero if an error occurred.
- ///
- ///
- /// An array of ASCII encoded extension names, or null if an error occurred.
- ///
- unsafe byte** GetRequiredInstanceExtensions(out uint count);
-
- ///
- /// Returns the address of the specified Vulkan instance function.
- ///
- ///
- ///
- /// This function returns the address of the specified Vulkan core or extension function for
- /// the specified instance. If instance is set to null it can return any function exported
- /// from the Vulkan loader, including at least the following functions:
- ///
- ///
- /// -
- ///
- /// vkEnumerateInstanceExtensionProperties
- ///
- ///
- /// vkEnumerateInstanceLayerProperties
- ///
- ///
- /// vkCreateInstance
- ///
- ///
- /// vkGetInstanceProcAddr
- ///
- ///
- ///
- ///
- /// If Vulkan is not available on the machine, this function returns null and generates
- /// a error. Call to check
- /// whether Vulkan is at least minimally available.
- ///
- ///
- /// This function is equivalent to calling vkGetInstanceProcAddr with a platform-specific
- /// query of the Vulkan loader as a fallback.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- /// The returned function pointer is valid until the library is terminated.
- ///
- ///
- ///
- /// The Vulkan instance to query, or null to retrieve functions related to instance creation.
- ///
- /// The ASCII encoded name of the function.
- /// The address of the function, or null if an error occurred.
- unsafe IntPtr GetInstanceProcAddress(VkHandle instance, byte* procName);
-
- ///
- /// Returns whether the specified queue family can present images.
- ///
- ///
- ///
- /// This function returns whether the specified queue family of the specified physical device
- /// supports presentation to the platform GLFW was built for.
- ///
- ///
- /// 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 false and generates a error.
- /// Call to check whether Vulkan is at least minimally available and
- /// to check what instance extensions are required.
- ///
- ///
- /// Possible errors include and .
- ///
- ///
- /// macOS: This function currently always returns true, as the VK_MVK_macos_surface
- /// extension does not provide a vkGetPhysicalDevice*PresentationSupport type function.
- ///
- ///
- /// This function may be called from any thread.
- /// For synchronization details of Vulkan objects, see the Vulkan specification.
- ///
- ///
- /// The instance that the physical device belongs to.
- /// The physical device that the queue family belongs to.
- /// The index of the queue family to query.
- /// true if the queue family supports presentation, or false otherwise.
- bool GetPhysicalDevicePresentationSupport(VkHandle instance, VkHandle device, int queueFamily);
-
- ///
- /// Creates a Vulkan surface for the specified window.
- ///
- ///
- ///
- /// This function creates a Vulkan surface for the specified window.
- ///
- ///
- /// If the Vulkan loader or at least one minimally functional ICD were not found,
- /// this function returns VK_ERROR_INITIALIZATION_FAILED and generates a
- /// error.
- /// Call to check whether Vulkan is at least minimally available.
- ///
- ///
- /// If the required window surface creation instance extensions are not available or
- /// if the specified instance was not created with these extensions enabled,
- /// this function returns VK_ERROR_EXTENSION_NOT_PRESENT and generates a
- /// error.
- /// Call to check what instance extensions are required.
- ///
- ///
- /// The window surface cannot be shared with another API so the window must have been created with
- /// the client api hint set to otherwise it generates a
- /// error and returns VK_ERROR_NATIVE_WINDOW_IN_USE_KHR.
- ///
- ///
- /// The window surface must be destroyed before the specified Vulkan instance.
- /// It is the responsibility of the caller to destroy the window surface.
- /// GLFW does not destroy it for you. Call vkDestroySurfaceKHR to destroy the surface.
- ///
- ///
- /// Possible errors include , ,
- /// and .
- ///
- ///
- /// If an error occurs before the creation call is made, GLFW returns the Vulkan error code most
- /// appropriate for the error. Appropriate use of and
- /// should eliminate almost all occurrences of these errors.
- ///
- ///
- /// macOS: This function currently only supports the VK_MVK_macos_surface extension from MoltenVK.
- ///
- ///
- /// macOS: This function creates and sets a CAMetalLayer instance for the window content view,
- /// which is required for MoltenVK to function.
- ///
- ///
- /// This function may be called from any thread.
- /// For synchronization details of Vulkan objects, see the Vulkan specification.
- ///
- ///
- /// The Vulkan instance to create the surface in.
- /// The window to create the surface for.
- /// The allocator to use, or null to use the default allocator.
- ///
- /// Where to store the handle of the surface.
- /// This is set to VK_NULL_HANDLE if an error occurred.
- ///
- ///
- /// VK_SUCCESS if successful, or a Vulkan error code if an error occurred.
- ///
- unsafe int CreateWindowSurface(VkHandle instance, WindowHandle* window, void* allocator, VkHandle* surface);
-
- ///
- ///
- /// Returns the address of the specified function for the current context.
- ///
- ///
- /// This function returns the address of the specified OpenGL or OpenGL ES core
- /// or extension function, if it is supported by the current context.
- ///
- ///
- /// A context must be current on the calling thread. Calling this function without a current context will
- /// cause a error. This function does not apply to Vulkan. If you are rendering
- /// with Vulkan, see , and
- /// instead.
- ///
- ///
- /// Possible errors include , and
- /// .
- ///
- ///
- ///
- /// The address of a given function is not guaranteed to be the same between contexts.
- ///
- ///
- /// This function may return a non- address despite the associated version or extension not being
- /// available. Always check the context version or extension string first.
- ///
- ///
- /// The returned function pointer is valid until the context is destroyed or the library is terminated.
- ///
- ///
- /// This function may be called from any thread.
- ///
- ///
- ///
- /// The ASCII encoded name of the function.
- /// The address of the function, or IntPtr.Zero if an error occurred.
- IntPtr GetProcAddress(string name);
-
-
- /// Retrieves the work area of the monitor.
- ///
- ///
- /// This function returns the position, in screen coordinates, of the upper-left
- /// corner of the work area of the specified monitor along with the work area
- /// size in screen coordinates. The work area is defined as the area of the
- /// monitor not occluded by the operating system task bar where present. If no
- /// task bar exists then the work area is the monitor resolution in screen
- /// coordinates.
- ///
- ///
- /// Any or all of the position and size arguments may be null. If an error
- /// occurs, all non-null position and size arguments will be set to zero.
- ///
- ///
- /// The monitor to query.
- /// Where to store the monitor x-coordinate, or null.
- /// Where to store the monitor y-coordinate, or null.
- /// Where to store the monitor width, or null.
- /// Where to store the monitor height, or null.
- unsafe void GetMonitorWorkarea(Monitor* monitor, out int x, out int y, out int width, out int height);
- }
-}
-#endif
\ No newline at end of file